Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2011-09-04 21:22:14 (GMT)
committer Daniel Drake <dsd@laptop.org>2011-09-04 21:22:14 (GMT)
commit1f9979af0a284c862a115e65bee61f088f3f0cf5 (patch)
tree92c9a48266a50141875261d87e3cdbecaac90a35 /lib
parentf981a2380d8f6a5fdb99665b46e4877292047f18 (diff)
repos: consider arch when building exclude list
This avoids the situation where a i686 xulrunner RPM causes xulrunner to be added to the exclude list on ARM. As though there is no xulrunner ARM RPM present in the OLPC repositories, this resulted in xulrunner not being able to be found in any repository. Fixed by only adding arch-relevant packages to the exclude list.
Diffstat (limited to 'lib')
-rw-r--r--lib/ooblib.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/lib/ooblib.py b/lib/ooblib.py
index 76845d5..a746c94 100644
--- a/lib/ooblib.py
+++ b/lib/ooblib.py
@@ -15,6 +15,8 @@ outputdir = os.environ['OOB__outputdir']
statedir = os.environ['OOB__statedir']
fsmount = os.environ['OOB__fsmount']
+METADATA_NS = "http://linux.duke.edu/metadata/common"
+
def read_config(module, option):
vname = "CFG_%s__%s" % (module, option)
if not vname in os.environ:
@@ -37,16 +39,38 @@ def image_name():
name_tmpl = read_config('global', 'image_name')
return name_tmpl % int(read_buildnr())
-def add_packages_from_xml(fd, pkglist):
+def arch_matches(myarch, arch):
+ # figure out if a package under 'arch' is suitable for 'myarch'
+ # myarch is either 'i386' or 'arm'
+ # but 'arch' can be i386, i586, i686, armv5tel, armv7hl, and so on
+
+ # noarch is always suitable
+ if arch == 'noarch':
+ return True
+
+ if myarch == 'arm':
+ return arch.startswith('arm')
+ elif myarch == 'i386':
+ return arch in ['i386', 'i486', 'i586', 'i686']
+ else:
+ return False
+
+def add_packages_from_xml(fd, pkglist, myarch=None):
et = ElementTree(file=fd)
root = et.getroot()
for i in root.getchildren():
if not i.tag.endswith("}package"):
continue
- for child in i.getchildren():
- if not child.tag.endswith("}name"):
+ arch = i.find("{%s}arch" % METADATA_NS)
+ name = i.find("{%s}name" % METADATA_NS)
+
+ # Only add packages that are suitable for myarch.
+ if myarch and arch is not None:
+ if not arch_matches(myarch, arch.text):
continue
- pkglist.add(child.text)
+
+ if name is not None:
+ pkglist.add(name.text)
def get_repomd(baseurl):