PR#3618: handle migrated rpmdb path

Merges #3618
https://pagure.io/koji/pull-request/3618

Fixes: #3617
https://pagure.io/koji/issue/3617
Fedora changed rpmdb location which breaks buildroot listing
This commit is contained in:
Tomas Kopecek 2022-12-08 09:15:17 +01:00
commit fb202273b9

View file

@ -696,7 +696,13 @@ class BuildRoot(object):
'sigmd5',
'size',
'buildtime')
rpm.addMacro("_dbpath", "%s/var/lib/rpm" % self.rootdir())
# Determine db path
dbpath = "%s/var/lib/rpm" % self.rootdir()
if os.path.exists(os.path.join(dbpath, '.migratedb')):
dbpath = "%s/usr/lib/sysimage/rpm" % self.rootdir()
if not os.path.exists(dbpath):
raise koji.GenericError("Can't get list of installed rpms")
rpm.addMacro("_dbpath", dbpath)
ret = []
try:
ts = rpm.TransactionSet()