From 314012657c7124f62af5a2e49b19d277c2df01a17243f205076fc9e01c2a3aaa Mon Sep 17 00:00:00 2001 From: OBS User mrdocs Date: Sun, 17 Dec 2017 07:58:36 +0000 Subject: [PATCH] Accepting request 556035 from home:dimstar:Factory - Add net-snmp-5.7.3-modern-rpm-api.patch: Supprt modern RPM (>= 4.6) API. In RPM 4.14, the RPM 4.4 compatibility APIs are being removed. OBS-URL: https://build.opensuse.org/request/show/556035 OBS-URL: https://build.opensuse.org/package/show/network:utilities/net-snmp?expand=0&rev=5 --- net-snmp-5.7.3-modern-rpm-api.patch | 90 +++++++++++++++++++++++++++++ net-snmp.changes | 7 +++ net-snmp.spec | 2 + 3 files changed, 99 insertions(+) create mode 100644 net-snmp-5.7.3-modern-rpm-api.patch diff --git a/net-snmp-5.7.3-modern-rpm-api.patch b/net-snmp-5.7.3-modern-rpm-api.patch new file mode 100644 index 0000000..3f0d5e1 --- /dev/null +++ b/net-snmp-5.7.3-modern-rpm-api.patch @@ -0,0 +1,90 @@ +diff -uNr net-snmp-5.7.3.orig/agent/mibgroup/host/data_access/swinst_rpm.c net-snmp-5.7.3/agent/mibgroup/host/data_access/swinst_rpm.c +--- net-snmp-5.7.3.orig/agent/mibgroup/host/data_access/swinst_rpm.c 2014-12-08 21:23:22.000000000 +0100 ++++ net-snmp-5.7.3/agent/mibgroup/host/data_access/swinst_rpm.c 2017-08-11 00:16:35.232470439 +0200 +@@ -96,8 +96,7 @@ + + rpmdbMatchIterator mi; + Header h; +- char *n, *v, *r, *g; +- int32_t *t; ++ const char *n, *v, *r, *g; + time_t install_time; + size_t date_len; + int i = 1; +@@ -119,11 +118,11 @@ + CONTAINER_INSERT(container, entry); + + h = headerLink( h ); +- headerGetEntry( h, RPMTAG_NAME, NULL, (void**)&n, NULL); +- headerGetEntry( h, RPMTAG_VERSION, NULL, (void**)&v, NULL); +- headerGetEntry( h, RPMTAG_RELEASE, NULL, (void**)&r, NULL); +- headerGetEntry( h, RPMTAG_GROUP, NULL, (void**)&g, NULL); +- headerGetEntry( h, RPMTAG_INSTALLTIME, NULL, (void**)&t, NULL); ++ n = headerGetString( h, RPMTAG_NAME); ++ v = headerGetString( h, RPMTAG_VERSION); ++ r = headerGetString( h, RPMTAG_RELEASE); ++ g = headerGetString( h, RPMTAG_GROUP); ++ install_time = headerGetNumber( h, RPMTAG_INSTALLTIME); + + entry->swName_len = snprintf( entry->swName, sizeof(entry->swName), + "%s-%s-%s", n, v, r); +@@ -133,7 +132,6 @@ + ? 2 /* operatingSystem */ + : 4; /* application */ + +- install_time = *t; + dt = date_n_time( &install_time, &date_len ); + if (date_len != 8 && date_len != 11) { + snmp_log(LOG_ERR, "Bogus length from date_n_time for %s", entry->swName); +diff -uNr net-snmp-5.7.3.orig/agent/mibgroup/host/hr_swinst.c net-snmp-5.7.3/agent/mibgroup/host/hr_swinst.c +--- net-snmp-5.7.3.orig/agent/mibgroup/host/hr_swinst.c 2014-12-08 21:23:22.000000000 +0100 ++++ net-snmp-5.7.3/agent/mibgroup/host/hr_swinst.c 2017-08-11 00:17:07.488544492 +0200 +@@ -484,9 +484,9 @@ + } + #else + # ifdef HAVE_LIBRPM +- char *rpm_groups; +- if ( headerGetEntry(swi->swi_h, RPMTAG_GROUP, NULL, (void **) &rpm_groups, NULL) ) { +- if ( strstr(rpm_groups, "System Environment") != NULL ) ++ const char *rpm_group = headerGetString(swi->swi_h, RPMTAG_GROUP); ++ if ( NULL != rpm_group ) { ++ if ( strstr(rpm_group, "System Environment") != NULL ) + long_return = 2; /* operatingSystem */ + else + long_return = 4; /* applcation */ +@@ -503,9 +503,8 @@ + case HRSWINST_DATE: + { + #ifdef HAVE_LIBRPM +- int32_t *rpm_data; +- if ( headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL, (void **) &rpm_data, NULL) ) { +- time_t installTime = *rpm_data; ++ time_t installTime = headerGetNumber(swi->swi_h, RPMTAG_INSTALLTIME); ++ if ( 0 != installTime) { + ret = date_n_time(&installTime, var_len); + } else { + ret = date_n_time(NULL, var_len); +@@ -665,7 +664,7 @@ + if (1 <= ix && ix <= swi->swi_nrec && ix != swi->swi_prevx) { + int offset; + Header h; +- char *n, *v, *r; ++ const char *n, *v, *r; + + offset = swi->swi_recs[ix - 1]; + +@@ -690,11 +689,9 @@ + swi->swi_h = h; + swi->swi_prevx = ix; + +- headerGetEntry(swi->swi_h, RPMTAG_NAME, NULL, (void **) &n, NULL); +- headerGetEntry(swi->swi_h, RPMTAG_VERSION, NULL, (void **) &v, +- NULL); +- headerGetEntry(swi->swi_h, RPMTAG_RELEASE, NULL, (void **) &r, +- NULL); ++ n = headerGetString(swi->swi_h, RPMTAG_NAME); ++ v = headerGetString(swi->swi_h, RPMTAG_VERSION); ++ r = headerGetString(swi->swi_h, RPMTAG_RELEASE); + snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r); + swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0; + } diff --git a/net-snmp.changes b/net-snmp.changes index 6a38137..46c3c76 100644 --- a/net-snmp.changes +++ b/net-snmp.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Dec 11 17:14:43 UTC 2017 - dimstar@opensuse.org + +- Add net-snmp-5.7.3-modern-rpm-api.patch: Supprt modern RPM (>= + 4.6) API. In RPM 4.14, the RPM 4.4 compatibility APIs are being + removed. + ------------------------------------------------------------------- Thu Nov 23 13:46:24 UTC 2017 - rbrown@suse.com diff --git a/net-snmp.spec b/net-snmp.spec index 7f79b09..424632c 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -81,6 +81,7 @@ Patch10: net-snmp-5.7.3-fix-snmp_pdu_parse-incomplete.patch Patch11: net-snmp-5.7.3-Remove-U64-typedef.patch Patch12: net-snmp-5.7.3-Fix-Makefile.PL.patch Patch13: net-snmp-5.7.3-build-with-openssl-1.1.patch +Patch14: net-snmp-5.7.3-modern-rpm-api.patch # Summary: SNMP Daemon License: BSD-3-Clause and MIT @@ -219,6 +220,7 @@ Net-SNMP toolkit library. %patch11 -p1 %patch12 -p1 %patch13 -p1 +%patch14 -p1 %build MIBS="misc/ipfwacc ucd-snmp/diskio etherlike-mib rmon-mib velocity smux \