summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2010-06-24 15:45:53 +0000
committerSol Jerome <sol.jerome@gmail.com>2010-06-24 14:59:11 -0500
commiteae6b6c8932496b374170e990a756ad1d4ac925c (patch)
treef4e0e2281a658f9ab68cbc30574021205c44ab3a
parent224025473e2f37c684c80556fdeb8102ddaf3b13 (diff)
downloadbcfg2-eae6b6c8932496b374170e990a756ad1d4ac925c.tar.gz
bcfg2-eae6b6c8932496b374170e990a756ad1d4ac925c.tar.bz2
bcfg2-eae6b6c8932496b374170e990a756ad1d4ac925c.zip
Packages: Add RawURL support for APT sources (Patch from Remi Broemeling for Ticket #896)
Signed-off-by: Sol Jerome <sol.jerome@gmail.com> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5958 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--doc/server/plugins/generators/packages.txt16
-rw-r--r--src/lib/Server/Plugins/Packages.py27
2 files changed, 31 insertions, 12 deletions
diff --git a/doc/server/plugins/generators/packages.txt b/doc/server/plugins/generators/packages.txt
index 67c6ac119..75349b3a3 100644
--- a/doc/server/plugins/generators/packages.txt
+++ b/doc/server/plugins/generators/packages.txt
@@ -147,7 +147,7 @@ Yum sources can be similarly specified:
</YUMSource>
</Sources>
-.. note:: There is also a RawURL syntax for specifying sources that
+.. note:: There is also a RawURL syntax for specifying APT or YUM sources that
don't follow the conventional layout:
.. code-block:: xml
@@ -171,6 +171,20 @@ Yum sources can be similarly specified:
</YUMSource>
</Sources>
+ .. code-block:: xml
+
+ <Sources>
+ <APTSource>
+ <Group>ubuntu-lucid</Group>
+ <RawURL>http://hudson-ci.org/debian/binary</RawURL>
+ <Arch>amd64</Arch>
+ </APTSource>
+ <APTSource>
+ <Group>ubuntu-lucid</Group>
+ <RawURL>http://hudson-ci.org/debian/binary</RawURL>
+ <Arch>i386</Arch>
+ </APTSource>
+ </Sources>
Configuration Updates
=====================
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py
index 2e0b3bd4a..ac20ca1f0 100644
--- a/src/lib/Server/Plugins/Packages.py
+++ b/src/lib/Server/Plugins/Packages.py
@@ -384,7 +384,10 @@ class APTSource(Source):
rawurl, blacklist, recommended):
Source.__init__(self, basepath, url, version, arches, components, groups,
rawurl, blacklist, recommended)
- self.cachefile = self.escape_url(self.url + '@' + version) + '.data'
+ if not self.rawurl:
+ self.cachefile = self.escape_url(self.url + '@' + self.version) + '.data'
+ else:
+ self.cachefile = self.escape_url(self.rawurl) + '.data'
self.pkgnames = set()
def save_state(self):
@@ -398,17 +401,14 @@ class APTSource(Source):
self.pkgnames, self.deps, self.provides = cPickle.load(data)
def get_urls(self):
- return ["%sdists/%s/%s/binary-%s/Packages.gz" % \
- (self.url, self.version, part, arch) for part in self.components \
- for arch in self.arches]
+ if not self.rawurl:
+ return ["%sdists/%s/%s/binary-%s/Packages.gz" % \
+ (self.url, self.version, part, arch) for part in self.components \
+ for arch in self.arches]
+ else:
+ return ["%sPackages.gz" % (self.rawurl)]
urls = property(get_urls)
- def get_aptsrc(self):
- return ["deb %s %s %s" % (self.url, self.version,
- " ".join(self.components)),
- "deb-src %s %s %s" % (self.url, self.version,
- " ".join(self.components))]
-
def read_files(self):
bdeps = dict()
bprov = dict()
@@ -417,7 +417,12 @@ class APTSource(Source):
else:
depfnames = ['Depends', 'Pre-Depends']
for fname in self.files:
- barch = [x for x in fname.split('@') if x.startswith('binary-')][0][7:]
+ if not self.rawurl:
+ barch = [x for x in fname.split('@') if x.startswith('binary-')][0][7:]
+ else:
+ # RawURL entries assume that they only have one <Arch></Arch>
+ # element and that it is the architecture of the source.
+ barch = self.arches[0]
if barch not in bdeps:
bdeps[barch] = dict()
bprov[barch] = dict()