Merge branch 'master' into ff/rrdd
authorFlorian Forster <octo@leeloo.home.verplant.org>
Sun, 29 Jun 2008 21:38:36 +0000 (23:38 +0200)
committerFlorian Forster <octo@leeloo.home.verplant.org>
Sun, 29 Jun 2008 21:38:36 +0000 (23:38 +0200)
doc/rrdgraph.pod
rrdtool.spec
src/rrd_graph.c
src/rrd_update.c

index 262410e..99b2e6b 100644 (file)
@@ -262,8 +262,10 @@ Note that for linear graphs, SI notation is used by default.
 
 [B<-z>|B<--lazy>]
 
-Only generate the graph if the current graph is out of date or not
-existent.
+Only generate the graph if the current graph is out of date or not existent.
+Note, that only the image size will be returned, if you run with lazy even
+when using graphv.
+
 
 [B<--daemon> I<address>]
 
index 280ea60..db1a055 100644 (file)
@@ -16,8 +16,10 @@ Group: Applications/Databases
 URL: http://oss.oetiker.ch/rrdtool/
 #Source0: http://oss.oetiker.ch/%{name}/pub/%{name}-%{version}.tar.gz
 Source0: http://oss.oetiker.ch/rrdtool/pub/beta/%{name}-%{version}%{pre}.tar.gz
+%if %{with_php}
 Source1: php4-%{svnrev}.tar.gz
 Patch1: rrdtool-1.3.0-beta4-fix-rrd_update-in-php-bindings.patch
+%endif
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: dejavu-lgc-fonts
 BuildRequires: gcc-c++, openssl-devel, freetype-devel
@@ -142,9 +144,11 @@ The %{name}-ruby package includes RRDtool bindings for Ruby.
 %endif
 
 %prep
-%setup -q -n %{name}-%{version}%{pre} %{?with_php: -a 1}
 %if %{with_php}
+%setup -q -n %{name}-%{version}%{pre} -a 1
 %patch1 -p1
+%else
+%setup -q -n %{name}-%{version}%{pre}
 %endif
 
 # Fix to find correct python dir on lib64
@@ -153,8 +157,10 @@ The %{name}-ruby package includes RRDtool bindings for Ruby.
 
 # Most edits shouldn't be necessary when using --libdir, but
 # w/o, some introduce hardcoded rpaths where they shouldn't
-%{__perl} -pi.orig -e 's|/lib\b|/%{_lib}|g' \
-    configure Makefile.in php4/configure php4/ltconfig*
+%{__perl} -pi.orig -e 's|/lib\b|/%{_lib}|g' configure Makefile.in*
+%if %{with_php}
+%{__perl} -pi.orig -e 's|/lib\b|/%{_lib}|g' php4/configure php4/ltconfig*
+%endif
 
 # Perl 5.10 seems to not like long version strings, hack around it
 %{__perl} -pi.orig -e 's|1.299907080300|1.29990708|' \
@@ -163,7 +169,10 @@ The %{name}-ruby package includes RRDtool bindings for Ruby.
 #
 # fix config files for php4 bindings
 # workaround needed due to https://bugzilla.redhat.com/show_bug.cgi?id=211069
+%if %{with_php}
 cp -p /usr/lib/rpm/config.{guess,sub} php4/
+%endif
+
 
 %build
 %configure \
index 7dfb9ce..dbca157 100644 (file)
@@ -2960,8 +2960,13 @@ int graph_paint(
     PangoFontMap *font_map = pango_cairo_font_map_get_default();
 
     /* if we are lazy and there is nothing to PRINT ... quit now */
-    if (lazy && im->prt_c == 0)
+    if (lazy && im->prt_c == 0) {
+        info.u_cnt = im->ximg;
+        grinfo_push(im, sprintf_alloc("image_width"), RD_I_CNT, info);
+        info.u_cnt = im->yimg;
+        grinfo_push(im, sprintf_alloc("image_height"), RD_I_CNT, info);
         return 0;
+    }
     /* pull the data from the rrd files ... */
     if (data_fetch(im) == -1)
         return -1;
@@ -2970,14 +2975,16 @@ int graph_paint(
         return -1;
     /* calculate and PRINT and GPRINT definitions. We have to do it at
      * this point because it will affect the length of the legends
-     * if there are no graph elements we stop here ... 
+     * if there are no graph elements (i==0) we stop here ... 
      * if we are lazy, try to quit ... 
      */
-    i = print_calc(im);
+    i = print_calc(im); 
     if (i < 0)
         return -1;
+
     if ((i == 0) || lazy)
         return 0;
+
 /**************************************************************
  *** Calculating sizes and locations became a bit confusing ***
  *** so I moved this into a separate function.              ***
@@ -3565,7 +3572,11 @@ int rrd_graph(
         walker = walker->next;
     }
     walker = grinfo;
-    while (walker) {
+    *xsize = 0;
+    *ysize = 0;
+    *ymin = 0;
+    *ymax = 0;
+    while (walker) {        
         if (strcmp(walker->key, "image_width") == 0) {
             *xsize = walker->value.u_int;
         } else if (strcmp(walker->key, "image_height") == 0) {
@@ -4487,9 +4498,9 @@ int vdef_calc(
     src = &im->gdes[dst->vidx];
     data = src->data + src->ds;
     end =
-        src->end_orig % src->step ==
-        0 ? src->end_orig : (src->end_orig + src->step -
-                             src->end_orig % src->step);
+        src->end_orig % (long)src->step ==
+        0 ? src->end_orig : (src->end_orig + (long)src->step -
+                             src->end_orig % (long)src->step);
 
     steps = (end - src->start) / src->step;
 #if 0
index da68270..5536c3c 100644 (file)
@@ -579,6 +579,15 @@ int _rrd_update(
                         rra_step_cnt, updvals, tmpl_idx, tmpl_cnt,
                         &pcdp_summary, version, skip_update,
                         &schedule_smooth) == -1) {
+           if (rrd_test_error()) { /* Should have error string always here */
+               char *save_error;
+
+               /* Prepend file name to error message */
+               if ((save_error = strdup(rrd_get_error())) != NULL) {
+                   rrd_set_error("%s: %s", filename, save_error);
+                   free(save_error);
+               }
+           }
             free(arg_copy);
             break;
         }