diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2010-04-08 15:47:25 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2010-04-08 10:58:57 -0500 |
commit | 55ffe08ce17a328fde77987bfe16adce5b4f6199 (patch) | |
tree | 9caa425bea22dfa756f1d7b7594c9366f2af90dc /src | |
parent | fe05b7425ccfec3526a3bbe24c6b8726c9f86357 (diff) | |
download | bcfg2-55ffe08ce17a328fde77987bfe16adce5b4f6199.tar.gz bcfg2-55ffe08ce17a328fde77987bfe16adce5b4f6199.tar.bz2 bcfg2-55ffe08ce17a328fde77987bfe16adce5b4f6199.zip |
Packages: implement blacklist functionality
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5809 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Server/Plugins/Packages.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py index ffab8c881..490f1152c 100644 --- a/src/lib/Server/Plugins/Packages.py +++ b/src/lib/Server/Plugins/Packages.py @@ -24,7 +24,7 @@ logger = logging.getLogger('Packages') def source_from_xml(xsource): ret = dict([('rawurl', False), ('url', False)]) for key, tag in [('groups', 'Group'), ('components', 'Component'), - ('arches', 'Arch')]: + ('arches', 'Arch'), ('blacklist', 'Blacklist')]: ret[key] = [item.text for item in xsource.findall(tag)] # version and component need to both contain data for sources to work try: @@ -45,7 +45,8 @@ def source_from_xml(xsource): class Source(object): basegroups = [] - def __init__(self, basepath, url, version, arches, components, groups, rawurl): + def __init__(self, basepath, url, version, arches, components, groups, rawurl, + blacklist): self.basepath = basepath self.version = version self.components = components @@ -55,6 +56,7 @@ class Source(object): self.arches = arches self.deps = dict() self.provides = dict() + self.blacklist = set(blacklist) self.cachefile = None def load_state(self): @@ -143,6 +145,11 @@ class Source(object): Returns => (packages, unresolved requirements) ''' + + if requirement in self.blacklist: + # requirement and all deps are suppressed + return (set(), set()) + if self.is_package(metadata, requirement): item_is_pkg = True else: @@ -216,9 +223,10 @@ class YUMSource(Source): basegroups = ['redhat', 'centos', 'fedora'] ptype = 'yum' - def __init__(self, basepath, url, version, arches, components, groups, rawurl): + def __init__(self, basepath, url, version, arches, components, groups, + rawurl, blacklist): Source.__init__(self, basepath, url, version, arches, components, - groups, rawurl) + groups, rawurl, blacklist) if not self.rawurl: self.baseurl = self.url + '%(version)s/%(component)s/%(arch)s/' else: @@ -364,8 +372,10 @@ class APTSource(Source): basegroups = ['debian', 'ubuntu', 'nexenta'] ptype = 'deb' - def __init__(self, basepath, url, version, arches, components, groups, rawurl): - Source.__init__(self, basepath, url, version, arches, components, groups, rawurl) + def __init__(self, basepath, url, version, arches, components, groups, + rawurl, blacklist): + Source.__init__(self, basepath, url, version, arches, components, groups, + rawurl, blacklist) self.cachefile = self.escape_url(self.url + '@' + version) + '.data' self.pkgnames = set() |