Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMartin Langhoff <martin@laptop.org>2011-03-17 15:08:37 (GMT)
committer Daniel Drake <dsd@laptop.org>2011-03-17 18:50:47 (GMT)
commit8786191fcf3406f07d95a629220d71faa140626a (patch)
tree402ce00ab9820a08997111163f4c6e231faed6c9 /lib
parentbde63ae9d99530cebb221d74c1e6fba12e56d37c (diff)
repos: read repomd.xml when available (#10758)
This adds support for standard Fedora and RPMFusion 'release' repositories which use repomd.xml to point to alternative filenames.
Diffstat (limited to 'lib')
-rw-r--r--lib/ooblib.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/ooblib.py b/lib/ooblib.py
index 69e0ddc..eea30a3 100644
--- a/lib/ooblib.py
+++ b/lib/ooblib.py
@@ -2,6 +2,7 @@
# Licensed under the terms of the GNU GPL v2 or later; see COPYING for details.
import os
+import urllib2
from xml.etree.ElementTree import ElementTree
libdir = os.environ['OOB__libdir']
@@ -46,3 +47,30 @@ def add_packages_from_xml(fd, pkglist):
continue
pkglist.add(child.text)
+def get_repomd(baseurl):
+
+ # default
+ md = {
+ 'primary' : 'repodata/primary.xml.gz',
+ 'primary_db' : 'repodata/primary.sqlite.bz2',
+ 'group' : 'repodata/comps.xml',
+ 'group_gz' : 'repodata/repodata/comps.xml.gz',
+ 'filelists' : 'repodata/filelists.xml.gz',
+ 'filelists_db' : 'repodata/filelists.sqlite.bz2',
+ 'other' : 'repodata/other.xml.gz',
+ 'other_db' : 'repodata/other.sqlite.bz2'
+ }
+
+ url = "%s/repodata/repomd.xml" % baseurl
+ try:
+ fd = urllib2.urlopen(url)
+ et = ElementTree(file=fd)
+ root = et.getroot()
+ # iterate over data tags
+ for data in root.findall('{http://linux.duke.edu/metadata/repo}data'):
+ type = data.attrib['type']
+ location = data.find('{http://linux.duke.edu/metadata/repo}location')
+ md[type] = location.attrib['href']
+ except:
+ pass
+ return md