collectd: Upgrade to 5.8.0

Fix build with gcc8 along the way
Forward port existing patches

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Khem Raj
2018-05-09 22:05:56 -07:00
committed by Armin Kuster
parent 2efc9d3ebf
commit e7b6b648da
5 changed files with 136 additions and 85 deletions

View File

@@ -1,28 +1,31 @@
[PATCH] conditionally check libvirt
From 385bf1c2ec57942e17ee529e57eef0dcd99904e6 Mon Sep 17 00:00:00 2001
From: Roy Li <rongqing.li@windriver.com>
Date: Tue, 1 Sep 2015 17:00:33 +0800
Subject: [PATCH] [PATCH] conditionally check libvirt
Upstream-Statue: Pending
check if libvirt is available only when a user wants to use libvirt
Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
configure.ac | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
Index: collectd-5.7.1/configure.ac
===================================================================
--- collectd-5.7.1.orig/configure.ac
+++ collectd-5.7.1/configure.ac
@@ -5556,12 +5556,14 @@ else
with_libxml2="no (pkg-config doesn't know libxml-2.0)"
---
configure.ac | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 101d6f9f..a7eca97d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5758,11 +5758,14 @@ else
with_libxml2="no (pkg-config doesn't know libxml-2.0)"
fi
-$PKG_CONFIG --exists libvirt 2>/dev/null
-if test "$?" = "0"
-then
- with_libvirt="yes"
-if test $? = 0; then
- with_libvirt="yes"
-else
- with_libvirt="no (pkg-config doesn't know libvirt)"
- with_libvirt="no (pkg-config doesn't know libvirt)"
+if test "x$enable_libvirt" = "xyes"; then
+ $PKG_CONFIG --exists libvirt 2>/dev/null
+ if test "$?" = "0"
@@ -32,5 +35,5 @@ Index: collectd-5.7.1/configure.ac
+ with_libvirt="no (pkg-config doesn't know libvirt)"
+ fi
fi
if test "x$with_libxml2" = "xyes"
then
if test "x$with_libxml2" = "xyes"; then

View File

@@ -1,4 +1,4 @@
From b459c55e4968321e5a82272cb39aa69d4054990f Mon Sep 17 00:00:00 2001
From b0a64db90a24469e36978c748417ebe456b34d59 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 22 Apr 2017 11:54:57 -0700
Subject: [PATCH] configure: Check for -Wno-error=format-truncation compiler
@@ -14,35 +14,26 @@ client.c:834:23: error: '%s' directive output may be truncated writing up to 102
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure.ac | 3 +-
m4/ax_check_compile_flag.m4 | 74 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+), 1 deletion(-)
configure.ac | 1 +
m4/ax_check_compile_flag.m4 | 74 +++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+)
create mode 100644 m4/ax_check_compile_flag.m4
diff --git a/configure.ac b/configure.ac
index 8854542..edb8cfb 100644
index a7eca97d..560eb988 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,6 @@ AC_INIT([collectd],[m4_esyscmd(./version-gen.sh)])
AC_CONFIG_SRCDIR(src/target_set.c)
AC_CONFIG_HEADERS(src/config.h)
AC_CONFIG_AUX_DIR([libltdl/config])
-
dnl older automake's default of ARFLAGS=cru is noisy on newer binutils;
dnl we don't really need the 'u' even in older toolchains. Then there is
dnl older libtool, which spelled it AR_FLAGS
@@ -6688,6 +6687,8 @@ then
AM_CFLAGS="$AM_CFLAGS -Werror"
AM_CXXFLAGS="$AM_CXXFLAGS -Werror"
@@ -6794,6 +6794,7 @@ if test "x$enable_werror" != "xno"; then
AM_CFLAGS="$AM_CFLAGS -Werror"
AM_CXXFLAGS="$AM_CXXFLAGS -Werror"
fi
+AX_CHECK_COMPILE_FLAG([-Werror -Werror=format-truncation],[AM_CFLAGS="$AM_CFLAGS -Wno-error=format-truncation" AM_CXXFLAGS="$AM_CXXFLAGS -Wno-error=format-truncation"])
+
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CXXFLAGS])
diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4
new file mode 100644
index 0000000..dcabb92
index 00000000..dcabb92a
--- /dev/null
+++ b/m4/ax_check_compile_flag.m4
@@ -0,0 +1,74 @@
@@ -120,6 +111,3 @@ index 0000000..dcabb92
+ [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_COMPILE_FLAGS
--
2.13.4

View File

@@ -0,0 +1,65 @@
From d65e48b68076d5b304e6d865967003ae1fea0e6c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 9 May 2018 21:45:38 -0700
Subject: [PATCH] Disable new gcc8 warnings
GCC seems to be not able to detect the checks for size are
already in place
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Submitted [https://github.com/collectd/collectd/pull/2768]
src/libcollectdclient/network_parse.c | 7 +++++++
src/write_sensu.c | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/src/libcollectdclient/network_parse.c b/src/libcollectdclient/network_parse.c
index 2365ab0a..79e6ed96 100644
--- a/src/libcollectdclient/network_parse.c
+++ b/src/libcollectdclient/network_parse.c
@@ -163,6 +163,11 @@ static int parse_int(void *payload, size_t payload_size, uint64_t *out) {
return 0;
}
+#pragma GCC diagnostic push
+#if __GNUC__ == 8
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
+
static int parse_string(void *payload, size_t payload_size, char *out,
size_t out_size) {
char *in = payload;
@@ -175,6 +180,8 @@ static int parse_string(void *payload, size_t payload_size, char *out,
return 0;
}
+#pragma GCC diagnostic pop
+
static int parse_identifier(uint16_t type, void *payload, size_t payload_size,
lcc_value_list_t *state) {
char buf[LCC_NAME_LEN];
diff --git a/src/write_sensu.c b/src/write_sensu.c
index ce23e654..63e1f599 100644
--- a/src/write_sensu.c
+++ b/src/write_sensu.c
@@ -569,6 +569,11 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */
return ret_str;
} /* }}} char *sensu_value_to_json */
+#pragma GCC diagnostic push
+#if __GNUC__ == 8
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
/*
* Uses replace_str2() implementation from
* http://creativeandcritical.net/str-replace-c/
@@ -631,6 +636,8 @@ static char *replace_str(const char *str, const char *old, /* {{{ */
return ret;
} /* }}} char *replace_str */
+#pragma GCC diagnostic pop
+
static char *replace_json_reserved(const char *message) /* {{{ */
{
char *msg = replace_str(message, "\\", "\\\\");

View File

@@ -1,43 +1,37 @@
Index: collectd-5.7.1/configure.ac
===================================================================
--- collectd-5.7.1.orig/configure.ac
+++ collectd-5.7.1/configure.ac
@@ -2305,7 +2305,7 @@ AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([
with_libgcrypt="yes"
else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
then
- with_libgcrypt_config="$withval/bin/gcrypt-config"
+ with_libgcrypt_config="$withval/bin/pkg-config"
with_libgcrypt="yes"
else if test -d "$withval"
then
@@ -2313,12 +2313,12 @@ AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([
GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
with_libgcrypt="yes"
else
- with_libgcrypt_config="gcrypt-config"
+ with_libgcrypt_config="pkg-config"
with_libgcrypt="$withval"
fi; fi; fi
],
[
- with_libgcrypt_config="libgcrypt-config"
+ with_libgcrypt_config="pkg-config"
with_libgcrypt="yes"
])
@@ -2326,12 +2326,12 @@ if test "x$with_libgcrypt" = "xyes" && t
then
if test "x$GCRYPT_CPPFLAGS" = "x"
then
- GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
+ GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags libgcrypt 2>/dev/null`
fi
if test "x$GCRYPT_LIBS" = "x"
then
- GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
+ GCRYPT_LIBS=`"$with_libgcrypt_config" --lib libgcrypt 2>/dev/null`
fi
fi
From d9b954bd9d0b084d9a1f5159a9f0c45802a51809 Mon Sep 17 00:00:00 2001
From: Paul Eggleton <paul.eggleton@linux.intel.com>
Date: Mon, 22 Apr 2013 16:28:16 +0000
---
configure.ac | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index e869a6a0..101d6f9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2514,20 +2514,20 @@ AC_ARG_WITH([libgcrypt],
if test -f "$withval" && test -x "$withval"; then
with_libgcrypt_config="$withval"
with_libgcrypt="yes"
- else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"; then
- with_libgcrypt_config="$withval/bin/gcrypt-config"
+ else if test -f "$withval/bin/pkg-config" && test -x "$withval/bin/pkg-config"; then
+ with_libgcrypt_config="$withval/bin/pkg-config"
with_libgcrypt="yes"
else if test -d "$withval"; then
GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
with_libgcrypt="yes"
else
- with_libgcrypt_config="gcrypt-config"
+ with_libgcrypt_config="pkg-config"
with_libgcrypt="$withval"
fi; fi; fi
],
[
- with_libgcrypt_config="libgcrypt-config"
+ with_libgcrypt_config="libpkg-config"
with_libgcrypt="yes"
]
)

View File

@@ -12,9 +12,10 @@ SRC_URI = "http://collectd.org/files/collectd-${PV}.tar.bz2 \
file://0001-conditionally-check-libvirt.patch \
file://0001-fix-to-build-with-glibc-2.25.patch \
file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch \
"
SRC_URI[md5sum] = "5da2b69c286a064db35c6cc1e758b039"
SRC_URI[sha256sum] = "9d20a0221569a8d6b80bbc52b86e5e84965f5bafdbf5dfc3790e0fed0763e592"
file://0005-Disable-new-gcc8-warnings.patch \
"
SRC_URI[md5sum] = "a841159323624f18bf03198e9f5aa364"
SRC_URI[sha256sum] = "b06ff476bbf05533cb97ae6749262cc3c76c9969f032bd8496690084ddeb15c9"
inherit autotools pythonnative update-rc.d pkgconfig systemd
@@ -62,7 +63,7 @@ do_install_append() {
sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/collectd
sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/collectd
sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/collectd
install -Dm 0640 ${B}/src/collectd.conf ${D}${sysconfdir}/collectd.conf
# Fix configuration file to allow collectd to start up
sed -i 's!^#FQDNLookup[ \t]*true!FQDNLookup false!g' ${D}${sysconfdir}/collectd.conf