Two years ago I suggested that net-snmp doesn't need to do -lrpm:
http://www.usenet-forums.com/snmp-coders/286442-re-unsnarling-rpmdb-hr-mib.htmlin order to populate the HR MIB.
Since there was little interest from net-snmp at the time (note "Ugh!" comments),
I dinna bother to pursue sending the patch.
Since then, rpm-5.0 has been released, and is now "masked" in Gentoo because
net-snmp doesn't link with -lrpm.
So its time for me to attempt to fix the problem in net-snmp for Gentoo.
(aside) Note also that rpm-4.6 from @rpm.org is being released, which, unlike rpm-5.x,
has a -D_RPM_4_4_COMPAT flag for the *transition* to Yet Another Incompatible API.
Caveat emptor, note "transition" ...
Hence I believe its finally time to _REALLY_ solve the development issue of net-snmp <-> rpm
linkage forever.
There is no reason that I know of that the HR MIB *must* link -lrpm (and Berkeley DB and ...),
the HR MIB can be populated in other ways.
In fact, all non-rpm based systems *already* populate the HR MIB without linking in Berkeley DB.
What is present in rpm-4.4.6 and later is the ability to pass all the information needed
to populate the HR MIB using 0b files in a directory. The name of the file carries the necessary
name-version-release.arch information, and the timestamp on the file carries the installtime.
The 0b files are maintained synchronously with rpmdb entries in rpm-4.4.6 and later, so
one will get the same answer whether you walk the directory, or query an rpmdb.
The mechanism of reading 0b files from a directory is currently in use with PLD linux
net-snmp and is known to work.
A very simple script, possibly run by cron, or triggered by an event timer, can be run
for *all* version of rpm, not just rpm-4.4.6 which maintains the files internally.
The script used by PLD is attached.
Which means that the code in net-snmp becomes extremely simple, basically just
walking files in a directory, and running stat to get the install time. This code is
*already* present in net-snmp, and a extremely minor change is necessary to
specify which directory path to walk.
I assure you that opendir(3) and stat(2) are much easier coding than Berkeley DB and
forked RPM API's. But YMMV as always ...
So what sort of patch do you wish? I suggest ripping -lrpm entirely as described above.
Alternatively, I can/will send along the necessary AutoFu in order to teach net-snmp
to recognize and link against RPM 5.0, and delver the same to Gentoo.
73 de Jeff