diff options
author | Jochen Friedrich <jochen@scram.de> | 2009-11-12 15:26:17 +0000 |
---|---|---|
committer | Jochen Friedrich <jochen@scram.de> | 2009-11-12 15:26:17 +0000 |
commit | 4595dcfc17761a3b91ff4a88a173bc865423798a (patch) | |
tree | 3b0877607e6fee284de7bc89b27b7b9a589f67b9 | |
parent | ff54e8143e009044be65ac7dd50cf068c30f5be1 (diff) | |
download | pkg-net-snmp-5.4.2.1_dfsg-2.tar.gz |
Add patch from Jonathan Nieder <jrnieder@gmail.com> to update lmsensors API to libsensors4.v5.4.2.1_dfsg-2
git-svn-id: svn://svn.debian.org/pkg-net-snmp/branches/net-snmp54@303 db575a87-f10d-0410-9662-f1d5ac62e4ba
-rw-r--r-- | debian/changelog | 11 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/patches/60_libsensors_api.README | 1 | ||||
-rw-r--r-- | debian/patches/60_libsensors_api.patch | 251 | ||||
-rw-r--r-- | debian/patches/series | 1 | ||||
-rwxr-xr-x | debian/rules | 2 |
6 files changed, 266 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index b2f9a16..deace51 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +net-snmp (5.4.2.1~dfsg-2) unstable; urgency=low + + * Add upstream patch R17470 to fix debugging output and numeric OID + reporting. (Closes: #524203, #509562) Thanks to Luca Ferroni + <luca.ferroni@labs.it> for the patch. + * Fix long description of debug package. + * Switch to libsensors4. (Closes: #518898) Thanks to Jonathan Nieder + <jrnieder@gmail.com> for the patch. + + -- Jochen Friedrich <jochen@scram.de> Thu, 12 Nov 2009 16:17:40 +0100 + net-snmp (5.4.2.1~dfsg-1) unstable; urgency=low * New upstream version diff --git a/debian/control b/debian/control index ad58839..14e9e71 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Net-SNMP Packaging Team <pkg-net-snmp-devel@lists.alioth.debian.org> Uploaders: Jochen Friedrich <jochen@scram.de>, Thomas Anders <tanders@users.sourceforge.net>, Noah Meyerhans <noahm@debian.org> -Build-Depends: debhelper (>=7), libtool, libwrap0-dev, libssl-dev (>> 0.9.8), perl (>=5.8), libperl-dev, python-all-dev, python-central (>=0.5.6), python (>=2.3.5-7), python-setuptools (>=0.6b3), autoconf, automake1.9, debianutils (>=1.13.1), bash (>=2.05), findutils (>=4.1.20), procps, cdbs (>=0.4.51), quilt, libkvm-dev [kfreebsd-i386 kfreebsd-amd64], libsensors-dev (>=2.8.5) [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64] +Build-Depends: debhelper (>=7), libtool, libwrap0-dev, libssl-dev (>> 0.9.8), perl (>=5.8), libperl-dev, python-all-dev, python-central (>=0.5.6), python (>=2.3.5-7), python-setuptools (>=0.6b3), autoconf, automake1.9, debianutils (>=1.13.1), bash (>=2.05), findutils (>=4.1.20), procps, cdbs (>=0.4.51), quilt, libkvm-dev [kfreebsd-i386 kfreebsd-amd64], libsensors4-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64] Standards-Version: 3.8.3 Vcs-Svn: svn://svn.debian.org/pkg-net-snmp/ Vcs-Browser: http://svn.debian.org/wsvn/pkg-net-snmp/ diff --git a/debian/patches/60_libsensors_api.README b/debian/patches/60_libsensors_api.README new file mode 100644 index 0000000..0b09631 --- /dev/null +++ b/debian/patches/60_libsensors_api.README @@ -0,0 +1 @@ +Patch from Jonathan Nieder <jrnieder@gmail.com> to update lmsensors API to libsensors4. diff --git a/debian/patches/60_libsensors_api.patch b/debian/patches/60_libsensors_api.patch new file mode 100644 index 0000000..ce0a38c --- /dev/null +++ b/debian/patches/60_libsensors_api.patch @@ -0,0 +1,251 @@ +diff --git a/agent/mibgroup/ucd-snmp/lmSensors.c b/agent/mibgroup/ucd-snmp/lmSensors.c +index d7dbd98..8f9fcd2 100644 +--- a/agent/mibgroup/ucd-snmp/lmSensors.c ++++ b/agent/mibgroup/ucd-snmp/lmSensors.c +@@ -390,7 +390,7 @@ static int + sensor_load(void) + { + int rc = 0; +- time_t t = time(NULL); ++ time_t t = time(NULL); + + if (t > timestamp + 7) /* this may require some tuning - currently 7 seconds*/ + { +@@ -962,77 +962,78 @@ else{ + } /* end for */ + + while ((chip = sensors_get_detected_chips(&chip_nr))) { +- int a = 0; +- int b = 0; ++ int a = 0; ++ int b = 0; + +- while ((data = sensors_get_all_features(*chip, &a, &b))) { +- char *label = NULL; +- double val; ++ while ((data = sensors_get_all_features(*chip, &a, &b))) { ++ char *label = NULL; ++ double val; + +- if ((data->mode & SENSORS_MODE_R) && +- (data->mapping == SENSORS_NO_MAPPING) && +- !sensors_get_label(*chip, data->number, &label) && +- !sensors_get_feature(*chip, data->number, &val)) { +- int type = -1; +- float mul; +- _sensor_array *array; ++ if ((data->mode & SENSORS_MODE_R) && ++ (data->mapping == SENSORS_NO_MAPPING) && ++ !sensors_get_label(*chip, data->number, &label) && ++ !sensors_get_feature(*chip, data->number, &val)) { ++ int type = -1; ++ float mul; ++ _sensor_array *array; + +- /* The label, as determined for a given chip in sensors.conf, +- * is used to place each sensor in the appropriate bucket. +- * Volt, Fan, Temp, and Misc. If the text being looked for below +- * is not in the label of a given sensor (e.g., the temp1 sensor +- * has been labeled 'CPU' and not 'CPU temp') it will end up being +- * lumped in the MISC bucket. */ ++ /* The label, as determined for a given chip in ++ * sensors.conf, is used to place each sensor in the ++ * appropriate bucket. Volt, Fan, Temp, and Misc. ++ * If the text being looked for below is not in the ++ * label of a given sensor (e.g., the temp1 sensor ++ * has been labeled 'CPU' and not 'CPU temp') it ++ * will end up being lumped in the MISC bucket. */ + +- if (strstr(label, "V")) { +- type = VOLT_TYPE; +- mul = 1000.0; +- } +- if (strstr(label, "fan") || strstr(label, "Fan")) { +- type = FAN_TYPE; +- mul = 1.0; +- } +- if (strstr(label, "temp") || strstr(label, "Temp")) { +- type = TEMP_TYPE; +- mul = 1000.0; +- } +- if (type == -1) { +- type = MISC_TYPE; +- mul = 1000.0; +- } ++ if (strstr(label, "V")) { ++ type = VOLT_TYPE; ++ mul = 1000.0; ++ } ++ if (strstr(label, "fan") || strstr(label, "Fan")) { ++ type = FAN_TYPE; ++ mul = 1.0; ++ } ++ if (strstr(label, "temp") || strstr(label, "Temp")) { ++ type = TEMP_TYPE; ++ mul = 1000.0; ++ } ++ if (type == -1) { ++ type = MISC_TYPE; ++ mul = 1000.0; ++ } + +- array = &sensor_array[type]; +- if ( array->current_len <= array->n) { +- _sensor* old_buffer = array->sensor; +- size_t new_size = (sizeof(_sensor) * array->current_len) + (sizeof(_sensor) * DEFAULT_SENSORS); +- array->sensor = (_sensor*)realloc(array->sensor, new_size); +- if (array->sensor == NULL) +- { +- /* Continuing would be unsafe */ +- snmp_log(LOG_ERR, "too many sensors to fit, and failed to alloc more, failing on %s\n", label); +- free(old_buffer); +- old_buffer = NULL; +- if (label) { +- free(label); +- label = NULL; +- } /* end if label */ +- return (rc=1); +- } /* end if array->sensor */ +- array->current_len = new_size / sizeof(_sensor); +- DEBUGMSG(("ucd-snmp/lmSensors", "type #%d increased to %d elements\n", type, array->current_len)); +- } /* end if array->current */ +- strncpy(array->sensor[array->n].name, label, MAX_NAME); +- array->sensor[array->n].value = (int) (val * mul); +- DEBUGMSGTL(("sensors","sensor %d, value %d\n", +- array->sensor[array->n].name, +- array->sensor[array->n].value)); +- array->n++; +- } /* end if data-mode */ +- if (label) { +- free(label); +- label = NULL; +- } /* end if label */ +- } /* end while data */ ++ array = &sensor_array[type]; ++ if ( array->current_len <= array->n) { ++ _sensor* old_buffer = array->sensor; ++ size_t new_size = (sizeof(_sensor) * array->current_len) + (sizeof(_sensor) * DEFAULT_SENSORS); ++ array->sensor = (_sensor*)realloc(array->sensor, new_size); ++ if (array->sensor == NULL) ++ { ++ /* Continuing would be unsafe */ ++ snmp_log(LOG_ERR, "too many sensors to fit, and failed to alloc more, failing on %s\n", label); ++ free(old_buffer); ++ old_buffer = NULL; ++ if (label) { ++ free(label); ++ label = NULL; ++ } /* end if label */ ++ return (rc=1); ++ } /* end if array->sensor */ ++ array->current_len = new_size / sizeof(_sensor); ++ DEBUGMSG(("ucd-snmp/lmSensors", "type #%d increased to %d elements\n", type, array->current_len)); ++ } /* end if array->current */ ++ strncpy(array->sensor[array->n].name, label, MAX_NAME); ++ array->sensor[array->n].value = (int) (val * mul); ++ DEBUGMSGTL(("sensors","sensor %d, value %d\n", ++ array->sensor[array->n].name, ++ array->sensor[array->n].value)); ++ array->n++; ++ } /* end if data-mode */ ++ if (label) { ++ free(label); ++ label = NULL; ++ } /* end if label */ ++ } /* end while data */ + } /* end while chip */ + return rc; + #endif /* end else ie. ifdef everything else */ +diff --git a/agent/mibgroup/ucd-snmp/lmSensors.c b/agent/mibgroup/ucd-snmp/lmSensors.c +index 8f9fcd2..e42e0e2 100644 +--- a/agent/mibgroup/ucd-snmp/lmSensors.c ++++ b/agent/mibgroup/ucd-snmp/lmSensors.c +@@ -89,7 +89,6 @@ + #include </usr/platform/sun4u/include/sys/envctrl.h> + #else + #include <sensors/sensors.h> +- #define CONFIG_FILE_NAME "/etc/sensors.conf" + #endif + + #include "lmSensors.h" +@@ -247,7 +246,7 @@ var_lmSensorsTable(struct variable *vp, + size_t * var_len, WriteMethod ** write_method) + { + static long long_ret; +- static unsigned char string[SPRINT_MAX_LEN]; ++ static char string[SPRINT_MAX_LEN]; + + int s_index; + int s_type = -1; +@@ -352,9 +351,7 @@ sensor_init(void) + { + int res; + #ifndef solaris2 +- char filename[] = CONFIG_FILE_NAME; + time_t t = time(NULL); +- FILE *fp = fopen(filename, "r"); + int i = 0; + + DEBUGMSG(("ucd-snmp/lmSensors", "=> sensor_init\n")); +@@ -366,13 +363,7 @@ sensor_init(void) + sensor_array[i].sensor = NULL; + } + +- if (!fp) +- { +- res = 1; +- goto leaving; +- } +- +- if (sensors_init(fp)) ++ if (sensors_init(NULL)) + { + res = 2; + goto leaving; +@@ -940,7 +931,8 @@ else{ + #else /* end solaris2 only ie. ifdef everything else */ + + const sensors_chip_name *chip; +- const sensors_feature_data *data; ++ const sensors_feature *feature; ++ const sensors_subfeature *subfeature; + int chip_nr = 0; + int rc = 0; + unsigned int i = 0; +@@ -961,18 +953,19 @@ else{ + sensor_array[i].current_len = DEFAULT_SENSORS; + } /* end for */ + +- while ((chip = sensors_get_detected_chips(&chip_nr))) { ++ while ((chip = sensors_get_detected_chips(NULL, &chip_nr))) { + int a = 0; ++ while ((feature = sensors_get_features(chip, &a))) { + int b = 0; +- +- while ((data = sensors_get_all_features(*chip, &a, &b))) { ++ while ((subfeature = sensors_get_all_subfeatures(chip, ++ feature, &b))) { + char *label = NULL; + double val; + +- if ((data->mode & SENSORS_MODE_R) && +- (data->mapping == SENSORS_NO_MAPPING) && +- !sensors_get_label(*chip, data->number, &label) && +- !sensors_get_feature(*chip, data->number, &val)) { ++ if ((subfeature->flags & SENSORS_MODE_R) && ++ (subfeature->mapping == 0) && ++ (label = sensors_get_label(chip, feature)) && ++ !sensors_get_value(chip, subfeature->number, &val)) { + int type = -1; + float mul; + _sensor_array *array; +@@ -1033,7 +1026,8 @@ else{ + free(label); + label = NULL; + } /* end if label */ +- } /* end while data */ ++ } /* end while subfeature */ ++ } /* end while feature */ + } /* end while chip */ + return rc; + #endif /* end else ie. ifdef everything else */ diff --git a/debian/patches/series b/debian/patches/series index 1674dfa..c29b05b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -13,3 +13,4 @@ 57_fix_ipv6_memleak.patch 58_download_mibs.patch 59_fix_python.patch +60_libsensors_api.patch diff --git a/debian/rules b/debian/rules index 5834bac..2d653c4 100755 --- a/debian/rules +++ b/debian/rules @@ -22,7 +22,7 @@ PYVERS=$(shell pyversions -vr) ifeq (linux,$(DEB_HOST_ARCH_OS)) MIB_MODULES += ucd-snmp/diskio ucd-snmp/lmSensors IPV6 = --enable-ipv6 -DEB_DH_GENCONTROL_ARGS=-- -Vos-specific-dev="libsensors-dev (>= 2.8.5)" +DEB_DH_GENCONTROL_ARGS=-- -Vos-specific-dev="libsensors4-dev" else ifeq (kfreebsd,$(DEB_HOST_ARCH_OS)) IPV6 = --disable-ipv6 |