summaryrefslogtreecommitdiffstats
path: root/comps.py
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>1999-05-05 18:22:56 +0000
committerErik Troan <ewt@redhat.com>1999-05-05 18:22:56 +0000
commit8a6c57b804571f62794a03722e1e19be1c7bf690 (patch)
tree1a35687b6188e8dcb1632c3737cb5ada056b90ac /comps.py
parentd2cd163beedf855c987e2b7cde4a179dd3716ddc (diff)
downloadanaconda-8a6c57b804571f62794a03722e1e19be1c7bf690.tar.gz
anaconda-8a6c57b804571f62794a03722e1e19be1c7bf690.tar.xz
anaconda-8a6c57b804571f62794a03722e1e19be1c7bf690.zip
provide a real headerlist object
Diffstat (limited to 'comps.py')
-rw-r--r--comps.py33
1 files changed, 22 insertions, 11 deletions
diff --git a/comps.py b/comps.py
index 2a57217d0..3233ec691 100644
--- a/comps.py
+++ b/comps.py
@@ -12,6 +12,27 @@ class Package:
self.name = header[rpm.RPMTAG_NAME]
self.selected = 0
+class HeaderList:
+
+ def has_key(self, item):
+ return self.packages.has_key(item)
+
+ def __getitem__(self, item):
+ return self.packages[item]
+
+ def __init__(self, path):
+ hdlist = rpm.readHeaderList(path)
+ self.packages = {}
+ for h in hdlist:
+ name = h[rpm.RPMTAG_NAME]
+ if self.packages.has_key(name):
+ score1 = rpm.archscore(h[rpm.RPMTAG_ARCH])
+ score2 = rpm.archscore(self.packages[name].h[rpm.RPMTAG_ARCH])
+ if (score2 < score1):
+ self.packages[h[rpm.RPMTAG_NAME]] = Package(h)
+ else:
+ self.packages[h[rpm.RPMTAG_NAME]] = Package(h)
+
class Component:
def __len__(self):
@@ -105,7 +126,6 @@ class ComponentSet:
self.compsDict[comp.name] = comp
comp = None
else:
-
if (l[0] == "@"):
(at, l) = split(l, None, 1)
comp.addInclude(self.compsDict[l])
@@ -127,14 +147,5 @@ class ComponentSet:
def __init__(self, arch, file, hdlist):
self.list = []
- self.packages = {}
- for h in hdlist:
- name = h[rpm.RPMTAG_NAME]
- if self.packages.has_key(name):
- score1 = rpm.archscore(h[rpm.RPMTAG_ARCH])
- score2 = rpm.archscore(self.packages[name].h[rpm.RPMTAG_ARCH])
- if (score2 < score1):
- self.packages[h[rpm.RPMTAG_NAME]] = Package(h)
- else:
- self.packages[h[rpm.RPMTAG_NAME]] = Package(h)
+ self.packages = hdlist
self.readCompsFile(arch, file, self.packages)