setting root in python script

Miroslav Suchý msuchy at redhat.com
Thu Apr 30 14:28:08 UTC 2020


Hi,
I have this python code:

import rpm
trans = rpm.TransactionSet()
packages = [trans.dbMatch()]

But now, I want to support --root option in my script and allow to use different root.

I found in
https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch16s03.html#id619811
that I can override `_dbpath` macro. But that requires from me to doing:
  root + `/var/lib/rpm`
and I would like to get rid of that plus part (i.e. do not maintain the path inside of that changed root).

Can you please give me guidance what is the recommended way to do this?

-- 
Miroslav Suchy, RHCA
Red Hat, Associate Manager ABRT/Copr, #brno, #fedora-buildsys



More information about the Rpm-list mailing list