How to determine package that has depencency when ts.check callback function is called?
Ben Grommes <ben.grommes-nyrKeVN/5HzXD/[email protected]> Fri, 18 Aug 2006 01:42:40 +0000 (UTC)
| Newsgroups | gmane.linux.redhat.rpm.python |
|---|---|
| Message-ID | <[email protected]> |
I'm using ts.check to determine if a subset of packages from a CentOS
distribution has any unsatisfied dependencies. In the ts.check callback
function I do a allts.dbMatch call to find out what package provides the
dependency handed to the callback. allts is a transaction set that uses the rpm
database from the rpmbd-CentOS package, which contains all the packages in the
distribution. This approach works great for catching any missing packages in my
subset of packages.
My question though, is how can I determine which package is the source of the
dependency that was handed to the ts.check callback? Am I missing something or
is this just an omission on the part of the python binding?
def checkCallback(ts, depType, depName, depEVR, senseFlags):
if depType == rpm.RPMTAG_REQUIRENAME:
prevHdrName = ""
newPkg = None
if depName[0] == "/":
dbIndex = "basenames"
else:
dbIndex = "providename"
for hdr in allts.dbMatch(dbIndex, depName):
hdrName = hdr[rpm.RPMTAG_NAME]
# If this package has a shorter name use it so that shortest name wins
if prevHdrName == "" or len(hdrName) < len(prevHdrName):
prevHdrName = hdrName
newPkg = hdr
if newPkg:
ts.addInstall(newPkg, newPkg, "i")
return -1
return 1