diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2010-02-14 19:48:23 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2010-02-14 19:48:23 +0000 |
commit | 4b84fa15c231c5ad72d261fdb27c470a386de4b3 (patch) | |
tree | 680b5fef55e1f1d15ec18ee728fba55584017d6b /src/lib | |
parent | f14d32e1e370ce47a9ef5a2b8dad8ae5ee630eb1 (diff) | |
download | bcfg2-4b84fa15c231c5ad72d261fdb27c470a386de4b3.tar.gz bcfg2-4b84fa15c231c5ad72d261fdb27c470a386de4b3.tar.bz2 bcfg2-4b84fa15c231c5ad72d261fdb27c470a386de4b3.zip |
Packages: [bugfix]
- fix cache file name creation
- process dependencies for packages that have the same name as a multi-choice dependency (Resolves Ticket #847)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5722 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Plugins/Packages.py | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/src/lib/Server/Plugins/Packages.py b/src/lib/Server/Plugins/Packages.py index d24b875db..97b665e13 100644 --- a/src/lib/Server/Plugins/Packages.py +++ b/src/lib/Server/Plugins/Packages.py @@ -180,46 +180,33 @@ class Source(object): logger.debug("Requirement %s provided by %s" \ % (requirement, provset)) + satisfiers = provset.intersection(packages) if len(provset) == 1: # single choice for requirement - deps = set() - pname = list(provset)[0] - if debug: - logger.debug("Adding Package %s for %s" % (pname, requirement)) - try: - deps = self.get_deps(metadata, pname) - if debug: - logger.debug("Package %s: adding new deps %s" \ - % (pname, deps)) - except: - pass - return (set([pname]), deps) + pkg_to_add = list(provset)[0] + elif satisfiers: + if item_is_pkg and requirement in satisfiers: + # still need to add requirement prereqs + pkg_to_add = requirement + else: + pkg_to_add = list(satisfiers)[0] + elif item_is_pkg: + pkg_to_add = requirement + else: + # choice data is here, but not forced by currently resolved requirements + raise SomeData - satisfiers = provset.intersection(packages) - if satisfiers: - # requirement already satisfied - if debug: - logger.debug("Requirement %s satisfied by %s" \ - % (requirement, satisfiers)) - return (set(), set()) + if debug: + logger.debug("Adding Package %s for %s" % (pkg_to_add, requirement)) - if item_is_pkg: - # fall back to package with name of requirement - deps = set() + try: + deps = self.get_deps(metadata, pkg_to_add) if debug: - logger.debug("Adding Package %s for %s" \ - % (requirement, requirement)) - try: - deps = self.get_deps(metadata, requirement) - if debug: - logger.debug("Package %s: adding new deps %s" \ - % (requirement, deps)) - except: - pass - return (set([requirement]), deps) - - # choice data is here, but not forced by currently resolved requirements - raise SomeData + logger.debug("Package %s: adding new deps %s" \ + % (pkg_to_add, deps)) + except: + pass + return (set([pkg_to_add]), deps) class YUMSource(Source): xp = '{http://linux.duke.edu/metadata/common}' @@ -236,7 +223,7 @@ class YUMSource(Source): self.baseurl = self.url + '%(version)s/%(component)s/%(arch)s/' else: self.baseurl = self.rawurl - self.cachefile = self.escape_url(self.baseurl) + '.data' + self.cachefile = self.escape_url(self.baseurl + '@' + version) + '.data' self.packages = dict() self.deps = dict([('global', dict())]) self.provides = dict([('global', dict())]) @@ -379,7 +366,7 @@ class APTSource(Source): def __init__(self, basepath, url, version, arches, components, groups, rawurl): Source.__init__(self, basepath, url, version, arches, components, groups, rawurl) - self.cachefile = self.escape_url(self.url) + '.data' + self.cachefile = self.escape_url(self.url + '@' + version) + '.data' self.pkgnames = set() def save_state(self): |