diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-01-26 12:36:21 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-01-26 12:36:21 -0500 |
commit | 1ef9f2ce0af301cda6f21653def563450eaaf327 (patch) | |
tree | 74c8704216a92045f70eb2471305641c9a8c8dae /src/sbin/bcfg2-yum-helper | |
parent | 334904cb7408f5723590a4494f12284ef872513f (diff) | |
download | bcfg2-1ef9f2ce0af301cda6f21653def563450eaaf327.tar.gz bcfg2-1ef9f2ce0af301cda6f21653def563450eaaf327.tar.bz2 bcfg2-1ef9f2ce0af301cda6f21653def563450eaaf327.zip |
fixed bug with setting arch groups properly (reported by esrax in #bcfg2)
Diffstat (limited to 'src/sbin/bcfg2-yum-helper')
-rwxr-xr-x | src/sbin/bcfg2-yum-helper | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/sbin/bcfg2-yum-helper b/src/sbin/bcfg2-yum-helper index 78a5a479b..dc46bb81a 100755 --- a/src/sbin/bcfg2-yum-helper +++ b/src/sbin/bcfg2-yum-helper @@ -59,7 +59,7 @@ class DepSolver(object): return ["noarch"] def set_groups(self, groups): - self._groups = set(groups).add("noarch") + self._groups = set(groups).union(["noarch"]) groups = property(get_groups, set_groups) @@ -179,12 +179,21 @@ class DepSolver(object): found = self.get_package_object(pkg.name) if found == pkg or found.pkgtup == pkg.pkgtup: rv.append(pkg) + else: + self.logger.debug("Skipping %s, not newest (%s)" % + (pkg, found)) else: rv = providers return [p.name for p in rv] def _filter_arch(self, packages): - matching = [pkg for pkg in packages if pkg.arch in self.groups] + matching = [] + for pkg in packages: + if pkg.arch in self.groups: + matching.append(pkg) + else: + self.logger.debug("%s has non-matching architecture (%s)" % + (pkg, pkg.arch)) if matching: return matching else: @@ -201,10 +210,7 @@ class DepSolver(object): else: return str(package) - def complete(self, packagelist, groups=None): - if groups is None: - groups = [] - + def complete(self, packagelist): packages = set() pkgs = set(packagelist) requires = set() @@ -344,8 +350,8 @@ def main(): print json.dumps(True) elif cmd == "complete": data = json.loads(sys.stdin.read()) - (packages, unknown) = depsolver.complete(data['packages'], - groups=data['groups']) + depsolver.groups = data['groups'] + (packages, unknown) = depsolver.complete(data['packages']) print json.dumps(dict(packages=list(packages), unknown=list(unknown))) elif cmd == "is_virtual_package": |