Code

Add patch + dh_autoreconf statements for librrd8
authorMarc Fournier <marc@bl.uem.li>
Tue, 24 May 2016 19:50:34 +0000 (21:50 +0200)
committerMarc Fournier <marc@bl.uem.li>
Wed, 25 May 2016 20:58:30 +0000 (22:58 +0200)
This fix is already upstream, but not part of any release yet. This
commit can be reverted once upcoming 5.5.2 gets packaged.

Thanks to Jean-Michel Vourgère (@nirgal) for providing the patch !

debian/changelog
debian/patches/bts823012_librrd8.patch [new file with mode: 0644]
debian/patches/series
debian/rules

index fce5050328b1aebfe2fa53eff4ecca29c51a1b2f..2f9510a707efee6b02273559be140fe0fac61708 100644 (file)
@@ -1,7 +1,10 @@
 collectd (5.5.1-3) UNRELEASED; urgency=medium
 
   * Re-enable gmond plugin. Thanks to Michael Tautschnig and Jean-Michel
-    Nirgal Vourgère for fixing #812462.
+    Vourgère for fixing #812462.
+  * debian/patches:
+    - Add bts823012_librrd8.patch. Properly detect thread safety with librrd8.
+      Thanks to Jean-Michel Vourgère for the patch (Closes: #823012).
 
  -- Marc Fournier <marc@bl.uem.li>  Tue, 24 May 2016 08:10:45 +0200
 
diff --git a/debian/patches/bts823012_librrd8.patch b/debian/patches/bts823012_librrd8.patch
new file mode 100644 (file)
index 0000000..67b60cf
--- /dev/null
@@ -0,0 +1,205 @@
+Description: rrdtool plugin: fix thread-safety detection
+ librrd 1.6.0 is now threadsafe and librrd_th is gone.
+ .
+ Since there doesn't seem to be a way to detect that librrd
+ is threadsafe, use pkg-config to check for 1.6.0 or newer instead.
+ .
+ The logic is now as follows:
+ Check for librrd >= 1.6.0 with pkg-config
+ If not found, look for rrd_update_r in librrd_th.
+ If not found, look for rrd_update in librrd and assume librrd is not
+ thread safe.
+Author: Ruben Kerkhof <ruben@rubenkerkhof.com>
+Origin: upstream,
+ commit:ef43260cd901847220c2a9de400579ff903ca13e,
+ commit:32c0ce39f786c56e9d13f3615253a7ae55b578e6,
+ commit:f7e09269879b74e61324de9178503221b2df9136,
+ commit:38068ecc7922ace29bb6af3f8ee5568c3fe96c08
+Bug-Debian: https://bugs.debian.org/823012
+Reviewed-By: Jean-Michel Vourgere <nirgal@debian.org>
+Last-Update: 2016-05-01
+
+Index: collectd-5.5.1/configure.ac
+===================================================================
+--- collectd-5.5.1.orig/configure.ac
++++ collectd-5.5.1/configure.ac
+@@ -3942,76 +3942,102 @@ AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, t
+ # }}}
+ # --with-librrd {{{
+-# AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
+ librrd_cflags=""
+ librrd_ldflags=""
+-librrd_threadsafe="yes"
++librrd_threadsafe="no"
+ librrd_rrdc_update="no"
+-AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
+-[     if test "x$withval" != "xno" && test "x$withval" != "xyes"
+-      then
+-              librrd_cflags="-I$withval/include"
+-              librrd_ldflags="-L$withval/lib"
+-              with_librrd="yes"
+-      else
+-              with_librrd="$withval"
+-      fi
+-], [with_librrd="yes"])
++AC_ARG_WITH(librrd,
++  [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
++  [
++    if test "x$withval" != "xno" && test "x$withval" != "xyes"
++    then
++      librrd_cflags="-I$withval/include"
++      librrd_ldflags="-L$withval/lib"
++      with_librrd="yes"
++    else
++      with_librrd="$withval"
++    fi
++  ],
++  [with_librrd="yes"]
++)
++
+ if test "x$with_librrd" = "xyes"
+ then
+-      SAVE_CPPFLAGS="$CPPFLAGS"
+-      SAVE_LDFLAGS="$LDFLAGS"
++  SAVE_LDFLAGS="$LDFLAGS"
++  LDFLAGS="$LDFLAGS $librrd_ldflags"
++  PKG_CHECK_MODULES([RRD], [librrd >= 1.6.0],
++    [
++      AC_CHECK_LIB([rrd], [rrd_update_r],
++        [librrd_threadsafe="yes"],
++        [:]
++      )
++      AC_CHECK_LIB([rrd], [rrdc_update],
++        [librrd_rrdc_update="yes"],
++        [:]
++      )
++    ],[:]
++  )
++  LDFLAGS="$SAVE_LDFLAGS"
+-      CPPFLAGS="$CPPFLAGS $librrd_cflags"
+-      LDFLAGS="$LDFLAGS $librrd_ldflags"
++  SAVE_CPPFLAGS="$CPPFLAGS"
++  CPPFLAGS="$CPPFLAGS $RRD_CFLAGS $librrd_cflags"
+-      AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
++  AC_CHECK_HEADERS([rrd.h],, [with_librrd="no (rrd.h not found)"])
+-      CPPFLAGS="$SAVE_CPPFLAGS"
+-      LDFLAGS="$SAVE_LDFLAGS"
++  CPPFLAGS="$SAVE_CPPFLAGS"
+ fi
+-if test "x$with_librrd" = "xyes"
++
++if test "x$with_librrd" = "xyes" && test "x$librrd_threadsafe" = "xno"
+ then
+-      SAVE_CPPFLAGS="$CPPFLAGS"
+-      SAVE_LDFLAGS="$LDFLAGS"
++  SAVE_LDFLAGS="$LDFLAGS"
++  LDFLAGS="$LDFLAGS $librrd_ldflags"
+-      CPPFLAGS="$CPPFLAGS $librrd_cflags"
+-      LDFLAGS="$LDFLAGS $librrd_ldflags"
++  AC_CHECK_LIB([rrd_th], [rrd_update_r],
++    [
++      librrd_ldflags="$librrd_ldflags -lrrd_th"
++      librrd_threadsafe="yes"
++      AC_CHECK_LIB([rrd_th], [rrdc_update],
++        [librrd_rrdc_update="yes"],
++        [:],
++      )
++    ],
++    [:]
++  )
++  LDFLAGS="$SAVE_LDFLAGS"
++fi
+-      AC_CHECK_LIB(rrd_th, rrd_update_r,
+-      [with_librrd="yes"
+-       librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
+-      ],
+-      [librrd_threadsafe="no"
+-       AC_CHECK_LIB(rrd, rrd_update,
+-       [with_librrd="yes"
+-        librrd_ldflags="$librrd_ldflags -lrrd -lm"
+-       ],
+-       [with_librrd="no (symbol 'rrd_update' not found)"],
+-       [-lm])
+-      ],
+-      [-lm])
+-
+-      if test "x$librrd_threadsafe" = "xyes"
+-      then
+-              AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
+-      else
+-              AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
+-      fi
++if test "x$with_librrd" = "xyes" && test "x$librrd_threadsafe" = "xno"
++then
++  SAVE_LDFLAGS="$LDFLAGS"
++  LDFLAGS="$LDFLAGS $librrd_ldflags"
+-      CPPFLAGS="$SAVE_CPPFLAGS"
+-      LDFLAGS="$SAVE_LDFLAGS"
++  AC_CHECK_LIB([rrd], [rrd_update],
++    [
++      librrd_ldflags="$librrd_ldflags -lrrd"
++      AC_CHECK_LIB([rrd], [rrdc_update],
++        [librrd_rrdc_update="yes"],
++        [:]
++      )
++    ],
++    [with_librrd="no (symbol 'rrd_update' not found)"]
++  )
++  LDFLAGS="$SAVE_LDFLAGS"
+ fi
++
+ if test "x$with_librrd" = "xyes"
+ then
+-      BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
+-      BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
+-      AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
+-      AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
++  BUILD_WITH_LIBRRD_CFLAGS="$RRD_CFLAGS $librrd_cflags"
++  BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
++  BUILD_WITH_LIBRRD_LIBS="$RRD_LIBS"
++  AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
++  AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
++  AC_SUBST(BUILD_WITH_LIBRRD_LIBS)
+ fi
+ if test "x$librrd_threadsafe" = "xyes"
+ then
+-      AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
++  AC_DEFINE([HAVE_THREADSAFE_LIBRRD], [1],
++    [Define to 1 if the rrd library is thread-safe]
++  )
+ fi
+ # }}}
+Index: collectd-5.5.1/src/Makefile.am
+===================================================================
+--- collectd-5.5.1.orig/src/Makefile.am
++++ collectd-5.5.1/src/Makefile.am
+@@ -876,17 +876,17 @@ endif
+ if BUILD_PLUGIN_RRDCACHED
+ pkglib_LTLIBRARIES += rrdcached.la
+ rrdcached_la_SOURCES = rrdcached.c utils_rrdcreate.c utils_rrdcreate.h
+-rrdcached_la_LDFLAGS = $(PLUGIN_LDFLAGS)
++rrdcached_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBRRD_LDFLAGS)
+ rrdcached_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBRRD_CFLAGS)
+-rrdcached_la_LIBADD = $(BUILD_WITH_LIBRRD_LDFLAGS)
++rrdcached_la_LIBADD = $(BUILD_WITH_LIBRRD_LIBS)
+ endif
+ if BUILD_PLUGIN_RRDTOOL
+ pkglib_LTLIBRARIES += rrdtool.la
+ rrdtool_la_SOURCES = rrdtool.c utils_rrdcreate.c utils_rrdcreate.h
+-rrdtool_la_LDFLAGS = $(PLUGIN_LDFLAGS)
++rrdtool_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBRRD_LDFLAGS)
+ rrdtool_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBRRD_CFLAGS)
+-rrdtool_la_LIBADD = $(BUILD_WITH_LIBRRD_LDFLAGS)
++rrdtool_la_LIBADD = $(BUILD_WITH_LIBRRD_LIBS)
+ endif
+ if BUILD_PLUGIN_SENSORS
index 5e9e15a6b55248a10a406eaf960766283ff29e20..5861ece33cc06f9fd233c9bd9a2f403de74bed88 100644 (file)
@@ -1,3 +1,4 @@
 rrd_filter_path.patch
 collection_conf_path.patch
 myplugin_includes.patch
+bts823012_librrd8.patch
index b25ae8e9e1ba1c0e663d77bc8b37172881681051..2dd1b357066bfcdbc918c82d148b0202f6d80edf 100755 (executable)
@@ -159,6 +159,7 @@ endif
 
 config.status: configure
        dh_testdir
+       dh_autoreconf
        
        # This is a work-around for #474087 (broken openipmi .pc files).
        mkdir debian/pkgconfig
@@ -196,6 +197,7 @@ clean:
        
        rm -rf debian/pkgconfig
        
+       dh_autoreconf_clean
        dh_clean
        debconf-updatepo