Add a fake rpm in database

FlorianFesti ffesti at
Tue Nov 16 12:28:11 UTC 2010

Depending on what you are actually trying to do it might be easier to 
just create a database on your own. Probably using the rpm version 
compare function as stored procedure.

If you really what to use a rpmdb have a look at the --justdb and 
--dbpath/--root cli parameters. You still need to create real packages 
to be able to install them into the data base. But just creating a 
simple spec file and building it on the fly shouldn't be too hard. Just 
creating the headers and installing them into the database might also be 
possible, but I have doubts that the Python API is really complete and 
tested well enough to make that work easily.


import rpm
rpm.addMacro('_dbpath', '/tmp/rpm')

sets the dbpath from within a Python script

More information about the Rpm-list mailing list