Rebuild (again) against newer rpm, now with proper rpm-4.9 detection
This commit is contained in:
parent
eccee2e78f
commit
f6ee02775b
65
net-snmp-5.6.1-find-librpm.patch
Normal file
65
net-snmp-5.6.1-find-librpm.patch
Normal file
@ -0,0 +1,65 @@
|
||||
From Panu Matilainen: update the code to work with rpm-4.9
|
||||
I've applied this patch also upstream.
|
||||
|
||||
diff -up net-snmp-5.6.1/configure.rpm49 net-snmp-5.6.1/configure
|
||||
--- net-snmp-5.6.1/configure.rpm49 2011-01-14 15:42:47.000000000 +0200
|
||||
+++ net-snmp-5.6.1/configure 2011-01-14 15:43:09.000000000 +0200
|
||||
@@ -27418,9 +27418,9 @@ $as_echo "$netsnmp_cv_func_rpmdbOpen__rp
|
||||
|
||||
# now check for rpm using the appropriate libraries.
|
||||
|
||||
- { $as_echo "$as_me:$LINENO: checking for library containing rpmGetFilesystemList" >&5
|
||||
-$as_echo_n "checking for library containing rpmGetFilesystemList... " >&6; }
|
||||
-if test "${netsnmp_cv_func_rpmGetFilesystemList__rpmlibs+set}" = set; then
|
||||
+ { $as_echo "$as_me:$LINENO: checking for library containing rpmReadConfigFiles" >&5
|
||||
+$as_echo_n "checking for library containing rpmReadConfigFiles... " >&6; }
|
||||
+if test "${netsnmp_cv_func_rpmReadConfigFiles__rpmlibs+set}" = set; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
netsnmp_func_search_save_LIBS="$LIBS"
|
||||
@@ -27441,11 +27441,11 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
-char rpmGetFilesystemList ();
|
||||
+char rpmReadConfigFiles ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
-return rpmGetFilesystemList ();
|
||||
+return rpmReadConfigFiles ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -27491,11 +27491,11 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
-char rpmGetFilesystemList ();
|
||||
+char rpmReadConfigFiles ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
-return rpmGetFilesystemList ();
|
||||
+return rpmReadConfigFiles ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -27540,12 +27540,12 @@ rm -rf conftest.dSYM
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS="${netsnmp_func_search_save_LIBS}"
|
||||
- netsnmp_cv_func_rpmGetFilesystemList__rpmlibs="${netsnmp_result}"
|
||||
+ netsnmp_cv_func_rpmReadConfigFiles__rpmlibs="${netsnmp_result}"
|
||||
fi
|
||||
-{ $as_echo "$as_me:$LINENO: result: $netsnmp_cv_func_rpmGetFilesystemList__rpmlibs" >&5
|
||||
-$as_echo "$netsnmp_cv_func_rpmGetFilesystemList__rpmlibs" >&6; }
|
||||
- if test "${netsnmp_cv_func_rpmGetFilesystemList__rpmlibs}" != "no" ; then
|
||||
- if test "${netsnmp_cv_func_rpmGetFilesystemList__rpmlibs}" != "none required" ; then
|
||||
+{ $as_echo "$as_me:$LINENO: result: $netsnmp_cv_func_rpmReadConfigFiles__rpmlibs" >&5
|
||||
+$as_echo "$netsnmp_cv_func_rpmReadConfigFiles__rpmlibs" >&6; }
|
||||
+ if test "${netsnmp_cv_func_rpmReadConfigFiles__rpmlibs}" != "no" ; then
|
||||
+ if test "${netsnmp_cv_func_rpmReadConfigFiles__rpmlibs}" != "none required" ; then
|
||||
_rpmlibs="${netsnmp_result} ${netsnmp_target_val}"
|
||||
fi
|
||||
|
114
net-snmp-5.6.1-rpm-modernize.patch
Normal file
114
net-snmp-5.6.1-rpm-modernize.patch
Normal file
@ -0,0 +1,114 @@
|
||||
From Panu Matilainen: update the code to work with rpm-4.9
|
||||
I'm waiting for better version from Panu to work with all versions of rpm >= 4.1
|
||||
and then I'll post it upstream.
|
||||
|
||||
diff -up net-snmp-5.6.1/agent/mibgroup/host/data_access/swinst_rpm.c.rpm-sanity net-snmp-5.6.1/agent/mibgroup/host/data_access/swinst_rpm.c
|
||||
--- net-snmp-5.6.1/agent/mibgroup/host/data_access/swinst_rpm.c.rpm-sanity 2010-11-05 12:00:21.000000000 +0200
|
||||
+++ net-snmp-5.6.1/agent/mibgroup/host/data_access/swinst_rpm.c 2011-01-18 09:55:44.000000000 +0200
|
||||
@@ -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>
|
||||
@@ -64,14 +65,8 @@ netsnmp_swinst_arch_init(void)
|
||||
rpmdbpath = rpmGetPath( "%{_dbpath}", NULL );
|
||||
dbpath = rpmdbpath;
|
||||
#else
|
||||
-#ifdef RPMVAR_DBPATH
|
||||
- rpmReadConfigFiles( NULL, NULL, NULL, 0 );
|
||||
- rpmdbpath = rpmGetVar( RPMVAR_DBPATH );
|
||||
- dbpath = rpmdbpath;
|
||||
-#else
|
||||
dbpath = "/var/lib/rpm"; /* Most likely */
|
||||
#endif
|
||||
-#endif
|
||||
|
||||
snprintf( pkg_directory, SNMP_MAXPATH, "%s/Packages", dbpath );
|
||||
if (-1 == stat( pkg_directory, &stat_buf ))
|
||||
@@ -96,32 +91,25 @@ netsnmp_swinst_arch_shutdown(void)
|
||||
int
|
||||
netsnmp_swinst_arch_load( netsnmp_container *container, u_int flags)
|
||||
{
|
||||
- rpmdb db;
|
||||
+ rpmts ts;
|
||||
|
||||
-#if defined(RPMDBI_PACKAGES)
|
||||
rpmdbMatchIterator mi;
|
||||
-#else
|
||||
- int offset;
|
||||
-#endif
|
||||
Header h;
|
||||
- char *n, *v, *r, *g;
|
||||
- int32_t *t;
|
||||
+ char *nvr;
|
||||
+ const char *g;
|
||||
time_t install_time;
|
||||
size_t date_len;
|
||||
int rc, i = 1;
|
||||
netsnmp_swinst_entry *entry;
|
||||
|
||||
- if (rpmdbOpen("", &db, O_RDONLY, 0644))
|
||||
- NETSNMP_LOGONCE((LOG_ERR, "rpmdbOpen() failed\n"));
|
||||
+ ts = rpmtsCreate();
|
||||
+ rpmtsSetVSFlags( ts, (_RPMVSF_NOSIGNATURES|_RPMVSF_NODIGESTS));
|
||||
+
|
||||
+ mi = rpmtsInitIterator( ts, RPMDBI_PACKAGES, NULL, 0);
|
||||
+ if (mi == NULL)
|
||||
+ NETSNMP_LOGONCE((LOG_ERR, "rpmdbOpen() failed\n"));
|
||||
|
||||
-#if defined(RPMDBI_PACKAGES)
|
||||
- mi = rpmdbInitIterator( db, RPMDBI_PACKAGES, NULL, 0);
|
||||
while (NULL != (h = rpmdbNextIterator( mi )))
|
||||
-#else
|
||||
- for (offset = rpmdbFirstRecNum( db );
|
||||
- offset != 0;
|
||||
- offset = rpmdbNextRecNum( db, offset ))
|
||||
-#endif
|
||||
{
|
||||
|
||||
entry = netsnmp_swinst_entry_create( i++ );
|
||||
@@ -129,35 +117,27 @@ netsnmp_swinst_arch_load( netsnmp_contai
|
||||
continue; /* error already logged by function */
|
||||
rc = CONTAINER_INSERT(container, entry);
|
||||
|
||||
-#if defined(RPMDBI_PACKAGES)
|
||||
h = headerLink( h );
|
||||
-#else
|
||||
- h = rpmdbGetRecord( db, offset );
|
||||
-#endif
|
||||
- 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);
|
||||
+ nvr = headerGetAsString( h, RPMTAG_NVR);
|
||||
+ 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);
|
||||
+ "%s", nvr);
|
||||
if (entry->swName_len > sizeof(entry->swName))
|
||||
entry->swName_len = sizeof(entry->swName);
|
||||
entry->swType = (NULL != strstr( g, "System Environment"))
|
||||
? 2 /* operatingSystem */
|
||||
: 4; /* application */
|
||||
|
||||
- install_time = *t;
|
||||
entry->swDate_len = snprintf( entry->swDate, sizeof(entry->swDate),
|
||||
"%s", date_n_time( &install_time, &date_len ));
|
||||
|
||||
headerFree( h );
|
||||
+ free(nvr);
|
||||
}
|
||||
-#if defined(RPMDBI_PACKAGES)
|
||||
rpmdbFreeIterator( mi );
|
||||
-#endif
|
||||
- rpmdbClose( db );
|
||||
+ rpmtsFree( ts );
|
||||
|
||||
DEBUGMSGTL(("swinst:load:arch", "loaded %d entries\n",
|
||||
(int)CONTAINER_SIZE(container)));
|
@ -11,7 +11,7 @@
|
||||
Summary: A collection of SNMP protocol tools and libraries
|
||||
Name: net-snmp
|
||||
Version: 5.6.1
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Epoch: 1
|
||||
|
||||
License: BSD
|
||||
@ -34,6 +34,8 @@ Patch4: net-snmp-5.5-include-struct.patch
|
||||
Patch5: net-snmp-5.5-apsl-copying.patch
|
||||
Patch6: net-snmp-5.5-perl-linking.patch
|
||||
Patch7: net-snmp-5.6-test-debug.patch
|
||||
Patch8: net-snmp-5.6.1-find-librpm.patch
|
||||
Patch9: net-snmp-5.6.1-rpm-modernize.patch
|
||||
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig
|
||||
@ -164,6 +166,8 @@ Net-SNMP toolkit library.
|
||||
%patch5 -p1 -b .apsl
|
||||
%patch6 -p1 -b .perl-linking
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
|
||||
%build
|
||||
MIBS="host agentx smux \
|
||||
@ -314,7 +318,7 @@ LD_LIBRARY_PATH=${RPM_BUILD_ROOT}/%{_libdir} make test
|
||||
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add snmpd
|
||||
/sbin/chkconfig --add snmpd
|
||||
/sbin/chkconfig --add snmptrapd
|
||||
|
||||
# move local state files from /var/net-snmp to new location when updating the package
|
||||
@ -427,6 +431,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%{_datadir}/snmp/mibs/*
|
||||
|
||||
%changelog
|
||||
* Wed Jan 19 2011 Jan Safranek <jsafrane@redhat.com> - 1:5.6.1-3
|
||||
- Rebuild (again) against newer rpm, now with proper rpm-4.9 detection
|
||||
|
||||
* Wed Jan 17 2011 Matthias Clasen <mclasen@redhat.com> - 1:5.6.1-2
|
||||
- Rebuild against newer rpm
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user