summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2010-04-16 14:20:31 +0000
committerSol Jerome <solj@ices.utexas.edu>2010-04-17 16:21:44 -0500
commit0f9e5d0e3da14218664db0d6b71cfc854313dd88 (patch)
treed721137b931a345ea653179d6dfdbac54e110bf0 /src
parent44805971b3911bad4809f389eb00e5ed3e56946f (diff)
downloadbcfg2-0f9e5d0e3da14218664db0d6b71cfc854313dd88.tar.gz
bcfg2-0f9e5d0e3da14218664db0d6b71cfc854313dd88.tar.bz2
bcfg2-0f9e5d0e3da14218664db0d6b71cfc854313dd88.zip
Packages: implement support for recommended packages in APTSources
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5826 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Plugins/Packages.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py
index 40d6ed6cd..1621451c3 100644
--- a/src/lib/Server/Plugins/Packages.py
+++ b/src/lib/Server/Plugins/Packages.py
@@ -33,6 +33,11 @@ def source_from_xml(xsource):
ret['version'] = 'placeholder'
if ret['components'] == []:
ret['components'] = ['placeholder']
+ try:
+ if xsource.find('Recommended').text is not None:
+ ret['recommended'] = True
+ except:
+ ret['recommended'] = False
if xsource.find('RawURL') is not None:
ret['rawurl'] = xsource.find('RawURL').text
if not ret['rawurl'].endswith('/'):
@@ -46,7 +51,7 @@ def source_from_xml(xsource):
class Source(object):
basegroups = []
def __init__(self, basepath, url, version, arches, components, groups, rawurl,
- blacklist):
+ blacklist, recommended):
self.basepath = basepath
self.version = version
self.components = components
@@ -58,6 +63,7 @@ class Source(object):
self.provides = dict()
self.blacklist = set(blacklist)
self.cachefile = None
+ self.recommended = recommended
def load_state(self):
pass
@@ -224,9 +230,9 @@ class YUMSource(Source):
ptype = 'yum'
def __init__(self, basepath, url, version, arches, components, groups,
- rawurl, blacklist):
+ rawurl, blacklist, recommended):
Source.__init__(self, basepath, url, version, arches, components,
- groups, rawurl, blacklist)
+ groups, rawurl, blacklist, recommended)
if not self.rawurl:
self.baseurl = self.url + '%(version)s/%(component)s/%(arch)s/'
else:
@@ -373,9 +379,9 @@ class APTSource(Source):
ptype = 'deb'
def __init__(self, basepath, url, version, arches, components, groups,
- rawurl, blacklist):
+ rawurl, blacklist, recommended):
Source.__init__(self, basepath, url, version, arches, components, groups,
- rawurl, blacklist)
+ rawurl, blacklist, recommended)
self.cachefile = self.escape_url(self.url + '@' + version) + '.data'
self.pkgnames = set()
@@ -404,6 +410,10 @@ class APTSource(Source):
def read_files(self):
bdeps = dict()
bprov = dict()
+ if self.recommended:
+ depfnames = ['Depends', 'Pre-Depends', 'Recommends']
+ else:
+ depfnames = ['Depends', 'Pre-Depends']
for fname in self.files:
barch = [x for x in fname.split('@') if x.startswith('binary-')][0][7:]
if barch not in bdeps:
@@ -420,7 +430,7 @@ class APTSource(Source):
pkgname = words[1].strip().rstrip()
self.pkgnames.add(pkgname)
bdeps[barch][pkgname] = []
- elif words[0] in ['Depends', 'Pre-Depends']:
+ elif words[0] in depfnames:
vindex = 0
for dep in words[1].split(','):
if '|' in dep: