From 896faa49d6cd69e9508b1f4d8593b02abd8ba0cf Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 6 Nov 2002 17:44:06 +0000 Subject: do archscoring of packages in the hdlist passed in since we need to only look at packages of our architecture (#75106) --- findpackageset.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'findpackageset.py') diff --git a/findpackageset.py b/findpackageset.py index 0ed1c80f6..d2181da86 100644 --- a/findpackageset.py +++ b/findpackageset.py @@ -27,14 +27,30 @@ def addNewPackageToUpgSet(pkgDict, pkg): -def findpackageset(hdlist, dbPath='/'): +def findpackageset(hdrlist, dbPath='/'): ts = rpm.TransactionSet(dbPath) ts.setVSFlags(rpm.RPMVSF_NORSA|rpm.RPMVSF_NODSA) ts.setFlags(rpm.RPMTRANS_FLAG_NOMD5) pkgDict = {} + + # go through and figure out which packages in the header list are + # actually applicable for our architecture + pkgDict = {} + for h in hdrlist: + score1 = rpm.archscore(h[rpm.RPMTAG_ARCH]) + if (score1): + name = h[rpm.RPMTAG_NAME] + if pkgDict.has_key(name): + score2 = rpm.archscore(pkgDict[name][rpm.RPMTAG_ARCH]) + if (score1 < score2): + pkgDict[name] = h + else: + pkgDict[name] = h + hdlist = pkgDict.values() - # first loop through packages and find ones which are a newer + pkgDict = {} + # loop through packages and find ones which are a newer # version than what we have for pkg in hdlist: mi = ts.dbMatch('name', pkg[rpm.RPMTAG_NAME]) -- cgit