[Rpm-maint] Rpm Database musings

Panu Matilainen pmatilai at laiskiainen.org
Wed Apr 17 14:17:42 UTC 2013

On 03/09/2013 12:30 PM, Panu Matilainen wrote:
> On 03/08/2013 04:37 PM, Michael Schroeder wrote:
>> Anyway, attached is a little Packages database implementation I did
>> yesterday
>> and today. The code is very careful not to destroy things if the database
>> is corrupt, i.e. it makes sure that it does not overwrite data.
> Apart from implementation details, this also serves as a starting point
> for the pkg db API abstraction:
> int rpmpkgOpen(rpmpkgdb *pkgdbp, const char *filename, int flags, int
> mode);
> void rpmpkgClose(rpmpkgdb pkgdbp);
> void rpmpkgSetFsync(rpmpkgdb pkgdbp, int dofsync);
> int rpmpkgGet(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char
> **blobp, unsigned int *bloblp);
> int rpmpkgPut(rpmpkgdb pkgdb, unsigned int pkgidx, unsigned char *blob,
> unsigned int blobl);
> int rpmpkgErase(rpmpkgdb pkgdb, unsigned int pkgidx);
> Its going to need some kind of cursor/iterator interface to allow
> walking through all the elements in the db, but that's pretty much it
> (except for the inevitably forgotten pesky little details :)
> Adjusting the BDB implementation into something resembling that
> should make for a fun little refactoring excercise... Separating the
> package db from the index implementation and forcing more abstract APIs
> over them will make the codebase saner no matter what comes out of this
> all, and will allow further freedom for experimenting with different
> implementations.

Time for a status report, just to let you know I haven't forgotten or 
abandoned this "project".

All direct BDB ties in rpmdb.c were cut out last month, been pondering 
about the backend API since then. Since that "work" was just going 
around in circles I figured the more practical approach of trying to ram 
the newrpmdb code into rpm might help get things going again.

After a bit of poking around in the last two days, I have bits and 
pieces in semi-working state. However what soon became very clear is 
that while BDB might be technically gone from rpmdb.c, its spirit 
remains there rather strongly (not that this is particularly surprising)

So... another round of refactoring needed to eliminate the BDB semantics 
too from rpmdb.c, but I should now have a better idea what's needed 
there. At that point I think we'll need to start thinking about pulling 
the newrpmdb code into rpm codebase in order to move forward with it.

	- Panu -

More information about the Rpm-maint mailing list