Skip to contentSkip to conversation

collectd: Fix compatibility with lmsensors 3.5

PATCH New [email protected] 1 participant 1 message Apr 29, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 collectd: Fix compatibility with lmsensors 3.5

Collectd with the 'sensors' PACKAGECONFIG enabled fails to build because of an incompatibility with the lmsensors version in meta-oe. This is a backport of the relevant patch from collectd, which actually just removes the lmsensors version checks.

../collectd-5.8.1/src/sensors.c:165:2: error: #error "This version of libsensors is not supported yet. Please report this " "as bug."

---
 ...checks-for-upper-limit-of-SENSORS_AP.patch | 90 +++++++++++++++++++
 .../collectd/collectd_5.8.1.bb                |  1 +
 2 files changed, 91 insertions(+)
 create mode 100644 meta-oe/recipes-extended/collectd/collectd/0001-sensors-Removed-checks-for-upper-limit-of-SENSORS_AP.patch
meta-oe/recipes-extended/collectd/collectd/0001-sensors-Removed-checks-for-upper-limit-of-SENSORS_AP.patch new file +90 -0
new file mode 100644
index 000000000..6d4aa4335
@@ -0,0 +1,90 @@
+From 1d6dbbfc5b548fcd8ad542a5d29d59bae5da4ed8 Mon Sep 17 00:00:00 2001
+From: Nicolas Jeker <[email protected]>
+Date: Wed, 29 Apr 2020 18:53:06 +0200
+Subject: [PATCH] sensors: Removed checks for upper limit of
+ SENSORS_API_VERSION
+
+That makes no more sense after lm-sensors got new maintainers.
+
+Issue: #3006
+
+Backported to collectd 5.8.1
+
+Signed-off-by: Nicolas Jeker <[email protected]>
+---
+ src/sensors.c | 17 ++++++-----------
+ 1 file changed, 6 insertions(+), 11 deletions(-)
+
+diff --git a/src/sensors.c b/src/sensors.c
+index f4ecda5e..33982e06 100644
+--- a/src/sensors.c
++++ b/src/sensors.c
+@@ -149,7 +149,7 @@ typedef struct featurelist {
+ static char *conffile = SENSORS_CONF_PATH;
+ /* #endif SENSORS_API_VERSION < 0x400 */
+
+-#elif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500)
++#elif (SENSORS_API_VERSION >= 0x400)
+ typedef struct featurelist {
+   const sensors_chip_name *chip;
+   const sensors_feature *feature;
+@@ -159,11 +159,6 @@ typedef struct featurelist {
+
+ static char *conffile = NULL;
+ static _Bool use_labels = 0;
+-/* #endif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) */
+-
+-#else /* if SENSORS_API_VERSION >= 0x500 */
+-#error "This version of libsensors is not supported yet. Please report this " \
+-	"as bug."
+ #endif
+
+ static featurelist_t *first_feature = NULL;
+@@ -223,7 +218,7 @@ static int sensors_config(const char *key, const char *value) {
+     if (IS_TRUE(value))
+       ignorelist_set_invert(sensor_list, 0);
+   }
+-#if (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500)
++#if (SENSORS_API_VERSION >= 0x400)
+   else if (strcasecmp(key, "UseLabels") == 0) {
+     use_labels = IS_TRUE(value) ? 1 : 0;
+   }
+@@ -353,7 +348,7 @@ static int sensors_load_conf(void) {
+   }   /* while sensors_get_detected_chips */
+ /* #endif SENSORS_API_VERSION < 0x400 */
+
+-#elif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500)
++#elif (SENSORS_API_VERSION >= 0x400)
+   chip_num = 0;
+   while ((chip = sensors_get_detected_chips(NULL, &chip_num)) != NULL) {
+     const sensors_feature *feature;
+@@ -410,7 +405,7 @@ static int sensors_load_conf(void) {
+       } /* while (subfeature) */
+     }   /* while (feature) */
+   }     /* while (chip) */
+-#endif /* (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) */
++#endif /* (SENSORS_API_VERSION >= 0x400) */
+
+   if (first_feature == NULL) {
+     sensors_cleanup();
+@@ -485,7 +480,7 @@ static int sensors_read(void) {
+   } /* for fl = first_feature .. NULL */
+ /* #endif SENSORS_API_VERSION < 0x400 */
+
+-#elif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500)
++#elif (SENSORS_API_VERSION >= 0x400)
+   for (featurelist_t *fl = first_feature; fl != NULL; fl = fl->next) {
+     double value;
+     int status;
+@@ -528,7 +523,7 @@ static int sensors_read(void) {
+
+     sensors_submit(plugin_instance, type, type_instance, value);
+   } /* for fl = first_feature .. NULL */
+-#endif /* (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) */
++#endif /* (SENSORS_API_VERSION >= 0x400) */
+
+   return 0;
+ } /* int sensors_read */
+--
+2.26.2
+
meta-oe/recipes-extended/collectd/collectd_5.8.1.bb +1 -0
index 0951ac076..aa63f2559 100644
@@ -15,6 +15,7 @@ SRC_URI = "http://collectd.org/files/collectd-${PV}.tar.bz2 \
            file://0005-Disable-new-gcc8-warnings.patch \
            file://0006-libcollectdclient-Fix-string-overflow-errors.patch \
            file://0001-Remove-including-sys-sysctl.h-on-glibc-based-systems.patch \
+           file://0001-sensors-Removed-checks-for-upper-limit-of-SENSORS_AP.patch \
            "
 SRC_URI[md5sum] = "bfce96c42cede5243028510bcc57c1e6"
 SRC_URI[sha256sum] = "e796fda27ce06377f491ad91aa286962a68c2b54076aa77a29673d53204453da"

--
2.26.2