summaryrefslogtreecommitdiffstats
path: root/comps.py
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>1999-08-21 01:05:01 +0000
committerErik Troan <ewt@redhat.com>1999-08-21 01:05:01 +0000
commit3597dc276979f56be1d5b9b5bc933c95a102b8a4 (patch)
treeefe8417cab93afe36f27c8a7c179031e3a56ceac /comps.py
parentc5df9419ad4b76e7636f6c0fffb509fdc48c3d41 (diff)
downloadanaconda-3597dc276979f56be1d5b9b5bc933c95a102b8a4.tar.gz
anaconda-3597dc276979f56be1d5b9b5bc933c95a102b8a4.tar.xz
anaconda-3597dc276979f56be1d5b9b5bc933c95a102b8a4.zip
use url gets for comps.py
Diffstat (limited to 'comps.py')
-rw-r--r--comps.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/comps.py b/comps.py
index 87bd73ac5..6aaa581e5 100644
--- a/comps.py
+++ b/comps.py
@@ -1,6 +1,7 @@
import rpm
from string import *
import types
+import urllib
class Package:
@@ -34,8 +35,7 @@ class HeaderList:
def __getitem__(self, item):
return self.packages[item]
- def __init__(self, path):
- hdlist = rpm.readHeaderListFromFile(path)
+ def __init__(self, hdlist):
self.hdlist = hdlist
self.packages = {}
for h in hdlist:
@@ -48,20 +48,16 @@ class HeaderList:
else:
self.packages[h[rpm.RPMTAG_NAME]] = Package(h)
+class HeaderListFromFile (HeaderList):
+
+ def __init__(self, path):
+ hdlist = rpm.readHeaderListFromFile(path)
+ HeaderList.__init__(self, hdlist)
+
class HeaderListFD (HeaderList):
def __init__(self, fd):
hdlist = rpm.readHeaderListFromFD (fd)
- self.hdlist = hdlist
- 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)
+ HeaderList.__init__(self, hdlist)
class Component:
@@ -111,8 +107,9 @@ class ComponentSet:
return self.compsDict[key]
def readCompsFile(self, arch, filename, packages):
- file = open(filename, "r")
+ file = urllib.urlopen(filename)
lines = file.readlines()
+
file.close()
top = lines[0]
lines = lines[1:]