diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2009-06-11 01:21:02 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2009-06-11 01:21:02 +0000 |
commit | c02d3575ab0241209e67c7052dcd3767173860db (patch) | |
tree | f6fb27cb65f93e33338445b07829ba900defee18 /src/lib | |
parent | dd918eee28a022722d0d668b88b9397306abcabb (diff) | |
download | bcfg2-c02d3575ab0241209e67c7052dcd3767173860db.tar.gz bcfg2-c02d3575ab0241209e67c7052dcd3767173860db.tar.bz2 bcfg2-c02d3575ab0241209e67c7052dcd3767173860db.zip |
Implement RawURL support
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5271 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Plugins/Packages.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py index 010283fe9..2e25eaf90 100644 --- a/src/lib/Server/Plugins/Packages.py +++ b/src/lib/Server/Plugins/Packages.py @@ -13,12 +13,15 @@ class NoData(Exception): logger = logging.getLogger('Packages') def source_from_xml(xsource): - ret = dict() + ret = dict([('rawurl', False), ('url', False)]) for key, tag in [('groups', 'Group'), ('components', 'Component'), ('arches', 'Arch')]: ret[key] = [item.text for item in xsource.findall(tag)] ret['version'] = xsource.find('Version').text - ret['url'] = xsource.find('URL').text + if xsource.find('RawURL') is not None: + ret['rawurl'] = xsource.find('RawURL').text + else: + ret['url'] = xsource.find('URL').text return ret class Source(object): @@ -120,10 +123,16 @@ class YUMSource(Source): basegroups = ['redhat', 'centos'] ptype = 'yum' - def __init__(self, basepath, url, version, arches, components, groups): - self.urls = ["%s/%s/%s/%s/repodata/%s.xml.gz" % \ - (url, version, part, arch, basename) for part in components \ - for arch in arches for basename in ['primary', 'filelists']] + def __init__(self, basepath, url, version, arches, components, groups, rawurl): + if not rawurl: + urlbase = url + '%%(version)s/%(component)s/%(arch)s/repodata/' % url + else: + urlbase = rawurl + usettings = [{'version': version, 'component':part, 'arch':arch} + for part in components for arch in arches] + fnames = ['primary.xml.gz', 'filelists.xml.gz'] + self.urls = [urlbase % item + fname \ + for item in usettings for fname in fnames] Source.__init__(self, basepath, url, version, arches, components, groups) self.packages = dict() self.deps = dict([('global', dict())]) @@ -212,7 +221,7 @@ class APTSource(Source): basegroups = ['debian', 'ubuntu', 'nexenta'] ptype = 'deb' - def __init__(self, basepath, url, version, arches, components, groups): + def __init__(self, basepath, url, version, arches, components, groups, rawurl): self.urls = ["%s/dists/%s/%s/binary-%s/Packages.gz" % \ (url, version, part, arch) for part in components \ for arch in arches] |