diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2012-11-01 00:08:00 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-30 01:22:51 +0100 |
commit | be0714757cbd4dc4748855e72bcec4476fd07e38 (patch) | |
tree | ae7701cd7e5021148fe8d67be4ed4ca8addfc3ab /src/lib/Server/Plugins/Packages/Collection.py | |
parent | 782b72a67360882c7637ab3be4b5e7f62e01cbe6 (diff) | |
download | bcfg2-be0714757cbd4dc4748855e72bcec4476fd07e38.tar.gz bcfg2-be0714757cbd4dc4748855e72bcec4476fd07e38.tar.bz2 bcfg2-be0714757cbd4dc4748855e72bcec4476fd07e38.zip |
Packages: add src attribute to package definition
using the src attribute, you could pin a package to a named source
Diffstat (limited to 'src/lib/Server/Plugins/Packages/Collection.py')
-rw-r--r-- | src/lib/Server/Plugins/Packages/Collection.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/Server/Plugins/Packages/Collection.py b/src/lib/Server/Plugins/Packages/Collection.py index 32eeda1ec..e0c7e338f 100644 --- a/src/lib/Server/Plugins/Packages/Collection.py +++ b/src/lib/Server/Plugins/Packages/Collection.py @@ -91,10 +91,24 @@ class Collection(Bcfg2.Server.Plugin.Debuggable): return True return False - def get_deps(self, package): + def get_deps(self, package, pinnings=None): + pin_found = False + + pin_source = None + if pinnings and package in pinnings: + pin_source = pinnings[package] + for source in self.sources: + if pin_source and pin_source != source.name: + continue + pin_found = True + if source.is_package(self.metadata, package): return source.get_deps(self.metadata, package) + + if not pin_found: + self.logger.error("Packages: Source '%s' for package '%s' not found" % + (pin_source, package)) return [] def get_provides(self, package): @@ -138,11 +152,12 @@ class Collection(Bcfg2.Server.Plugin.Debuggable): """ do any collection-level data setup tasks """ pass - def complete(self, packagelist): + def complete(self, packagelist, pinnings=None): '''Build the transitive closure of all package dependencies Arguments: packageslist - set of package names + pinnings - mapping from package names to source names returns => (set(packages), set(unsatisfied requirements)) ''' @@ -198,7 +213,7 @@ class Collection(Bcfg2.Server.Plugin.Debuggable): self.debug_log("Packages: handling package requirement %s" % current) packages.add(current) - deps = self.get_deps(current) + deps = self.get_deps(current, pinnings) newdeps = set(deps).difference(examined) if newdeps: self.debug_log("Packages: Package %s added requirements %s" |