Accepting request 70705 from net-snmp:factory

-> (forwarded request 70703 from mlschroe)

OBS-URL: https://build.opensuse.org/request/show/70705
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/net-snmp?expand=0&rev=47
This commit is contained in:
Berthold Gunreben 2011-05-19 14:06:23 +00:00 committed by Git OBS Bridge
parent 91eece14c7
commit 1089ed7d15
3 changed files with 152 additions and 0 deletions

145
net-snmp-5.6.1-rpm490.patch Normal file
View File

@ -0,0 +1,145 @@
--- net-snmp-5.6.1/agent/mibgroup/host/data_access/swinst_rpm.c.orig 2011-05-19 13:09:07.000000000 +0000
+++ net-snmp-5.6.1/agent/mibgroup/host/data_access/swinst_rpm.c 2011-05-19 13:13:43.000000000 +0000
@@ -34,6 +34,7 @@
#endif
#ifdef HAVE_RPM_RPMDB_H
#include <rpm/rpmdb.h>
+#include <rpm/rpmts.h>
#endif
#include <net-snmp/net-snmp-includes.h>
@@ -96,9 +97,9 @@ netsnmp_swinst_arch_shutdown(void)
int
netsnmp_swinst_arch_load( netsnmp_container *container, u_int flags)
{
- rpmdb db;
+ rpmts ts;
-#if defined(RPMDBI_PACKAGES)
+#if 1 /* defined(RPMDBI_PACKAGES) */
rpmdbMatchIterator mi;
#else
int offset;
@@ -111,11 +112,12 @@ netsnmp_swinst_arch_load( netsnmp_contai
int rc, i = 1;
netsnmp_swinst_entry *entry;
- if (rpmdbOpen("", &db, O_RDONLY, 0644))
- NETSNMP_LOGONCE((LOG_ERR, "rpmdbOpen() failed\n"));
+ ts = rpmtsCreate();
+ if (rpmtsOpenDB(ts, O_RDONLY))
+ NETSNMP_LOGONCE((LOG_ERR, "rpmtsOpenDB() failed\n"));
-#if defined(RPMDBI_PACKAGES)
- mi = rpmdbInitIterator( db, RPMDBI_PACKAGES, NULL, 0);
+#if 1 /* defined(RPMDBI_PACKAGES) */
+ mi = rpmtsInitIterator( ts, RPMDBI_PACKAGES, NULL, 0);
while (NULL != (h = rpmdbNextIterator( mi )))
#else
for (offset = rpmdbFirstRecNum( db );
@@ -129,7 +131,7 @@ netsnmp_swinst_arch_load( netsnmp_contai
continue; /* error already logged by function */
rc = CONTAINER_INSERT(container, entry);
-#if defined(RPMDBI_PACKAGES)
+#if 1 /* defined(RPMDBI_PACKAGES) */
h = headerLink( h );
#else
h = rpmdbGetRecord( db, offset );
@@ -154,10 +156,11 @@ netsnmp_swinst_arch_load( netsnmp_contai
headerFree( h );
}
-#if defined(RPMDBI_PACKAGES)
+#if 1 /* defined(RPMDBI_PACKAGES) */
rpmdbFreeIterator( mi );
#endif
- rpmdbClose( db );
+
+ rpmtsFree( ts );
DEBUGMSGTL(("swinst:load:arch", "loaded %d entries\n",
(int)CONTAINER_SIZE(container)));
--- net-snmp-5.6.1/agent/mibgroup/host/hr_swinst.c.orig 2011-05-19 12:33:25.000000000 +0000
+++ net-snmp-5.6.1/agent/mibgroup/host/hr_swinst.c 2011-05-19 13:01:12.000000000 +0000
@@ -43,6 +43,7 @@
#ifdef HAVE_LIBRPM
#include <rpm/rpmlib.h>
#include <rpm/header.h>
+#include <rpm/rpmts.h>
#include <fcntl.h>
#ifdef HAVE_RPM_RPMFILEUTIL_H
@@ -113,7 +114,7 @@ typedef struct {
int swi_maxrec; /* no. of allocations */
int swi_nrec; /* no. of valid offsets */
int *swi_recs; /* db record offsets */
- rpmdb swi_rpmdb;
+ rpmts swi_rpmts;
Header swi_h;
int swi_prevx;
#else
@@ -567,10 +568,11 @@ Check_HRSW_cache(void *xxx)
int ix = 0;
int offset;
-#if defined(RPMDBI_PACKAGES)
+
+#if 1 /* defined(RPMDBI_PACKAGES) */
rpmdbMatchIterator mi = NULL;
Header h;
- mi = rpmdbInitIterator(swi->swi_rpmdb, RPMDBI_PACKAGES, NULL, 0);
+ mi = rpmtsInitIterator(swi->swi_rpmts, RPMDBI_PACKAGES, NULL, 0);
while ((h = rpmdbNextIterator(mi)) != NULL) {
offset = rpmdbGetIteratorOffset(mi);
#else
@@ -588,7 +590,7 @@ Check_HRSW_cache(void *xxx)
}
swi->swi_recs[ix++] = offset;
-#if !defined(RPMDBI_PACKAGES)
+#if 0 /* !defined(RPMDBI_PACKAGES) */
}
#else
}
@@ -607,10 +609,14 @@ Init_HR_SWInst(void)
swi->swi_index = 0;
#ifdef HAVE_LIBRPM
- if (swi->swi_rpmdb != NULL)
+ if (swi->swi_rpmts != NULL)
return;
- if (rpmdbOpen("", &swi->swi_rpmdb, O_RDONLY, 0644) != 0)
+ swi->swi_rpmts = rpmtsCreate();
+ if (rpmtsOpenDB(swi->swi_rpmts, O_RDONLY)) {
+ rpmtsFree(swi->swi_rpmts);
+ swi->swi_rpmts = 0;
swi->swi_index = -1;
+ }
Check_HRSW_cache(swi);
#else
if (swi->swi_directory != NULL) {
@@ -673,10 +679,10 @@ Save_HR_SW_info(int ix)
offset = swi->swi_recs[ix - 1];
-#if defined(RPMDBI_PACKAGES)
+#if 1 /* defined(RPMDBI_PACKAGES) */
{
rpmdbMatchIterator mi;
- mi = rpmdbInitIterator(swi->swi_rpmdb, RPMDBI_PACKAGES,
+ mi = rpmtsInitIterator(swi->swi_rpmts, RPMDBI_PACKAGES,
&offset, sizeof(offset));
if ((h = rpmdbNextIterator(mi)) != NULL)
h = headerLink(h);
@@ -737,8 +743,8 @@ End_HR_SWInst(void)
SWI_t *swi = &_myswi; /* XXX static for now */
#ifdef HAVE_LIBRPM
- rpmdbClose(swi->swi_rpmdb); /* or only on finishing ? */
- swi->swi_rpmdb = NULL;
+ rpmtsFree(swi->swi_rpmts); /* or only on finishing ? */
+ swi->swi_rpmts = NULL;
#else
if (swi->swi_dp != NULL)
closedir(swi->swi_dp);

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu May 19 14:43:13 CEST 2011 - mls@suse.de
- switch from rpmdb to rpmts to support rpm-4.9.0
-------------------------------------------------------------------
Thu May 12 14:49:34 UTC 2011 - lchiquitto@novell.com

View File

@ -65,6 +65,7 @@ Patch6: net-snmp-5.5.0-perl-tk-warning.patch
Patch7: net-snmp-5.5.0-velocity-mib.patch
Patch9: net-snmp-5.6.0-enable-hrh-filesys.patch
Patch10: net-snmp-5.6.1-recognize-jfs-and-xfs.patch
Patch11: net-snmp-5.6.1-rpm490.patch
#
Summary: SNMP Daemon
@ -208,6 +209,7 @@ Authors:
%patch7 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%build
MIBS="misc/ipfwacc ucd-snmp/diskio etherlike-mib rmon-mib velocity smux \