diff options
author | 2009-08-01 11:18:48 +0200 | |
---|---|---|
committer | 2009-08-01 11:18:48 +0200 | |
commit | 41c4f8151f0f1b83a3cc34d1c547f2c605cc8421 (patch) | |
tree | f19e2ac03024b17fa5a5a2904d23fb6ef8b9d63f | |
parent | Remove "strict" from FEATURES (diff) | |
download | collagen-41c4f8151f0f1b83a3cc34d1c547f2c605cc8421.tar.gz collagen-41c4f8151f0f1b83a3cc34d1c547f2c605cc8421.tar.bz2 collagen-41c4f8151f0f1b83a3cc34d1c547f2c605cc8421.zip |
Fixed normalize_dependencies
should be final fix for bug #15
-rw-r--r-- | src/tinderbox/__init__.py | 4 | ||||
-rw-r--r-- | src/tinderbox/test/TinderboxTest.py | 19 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/tinderbox/__init__.py b/src/tinderbox/__init__.py index 2ae13cc..4358897 100644 --- a/src/tinderbox/__init__.py +++ b/src/tinderbox/__init__.py @@ -340,10 +340,12 @@ class Tinderbox(object): log.debug("normalize_dependencies called with deps: %s" % deps) new_deps = [] for i in range(len(deps)): - if deps[i] == '||': + if '||' == deps[i]: next = deps[i+1] if type(next) is list and len(next) > i: deps[i+1] = next[0] + elif type(deps[i]) == list: + new_deps.extend(self._normalize_dependencies(deps[i])) else: new_deps.append(deps[i]) return new_deps diff --git a/src/tinderbox/test/TinderboxTest.py b/src/tinderbox/test/TinderboxTest.py index 11b26f9..d06b8c1 100644 --- a/src/tinderbox/test/TinderboxTest.py +++ b/src/tinderbox/test/TinderboxTest.py @@ -13,7 +13,7 @@ class TinderboxTest(unittest.TestCase): self.trees = portage.create_trees() self.portapi = self.trees[portage.root]["porttree"].dbapi self.portset = portage.config(clone=portage.settings) - self.pkgs = ['dev-db/hsqldb-1.8.0.9-r1','app-shells/bash-3.2_p39','sys-apps/portage-2.1.4.5'] + self.pkgs = ['dev-db/hsqldb-1.8.0.10','app-shells/bash-3.2_p39','sys-apps/portage-2.1.4.5'] def testCreateDepGroups(self): settings = self.portset @@ -27,9 +27,22 @@ class TinderboxTest(unittest.TestCase): use_deps = portage.dep.use_reduce(deps, list(use_enabled & iuse)) use_deps = self.tb._normalize_dependencies(use_deps) - use_deps = flatten_deps(use_deps) - print self.tb.create_dep_groups(use_deps) + self.tb.create_dep_groups(use_deps) + + def testNormalizeDeps(self): + settings = self.portset + portapi = self.portapi + for pkg in self.pkgs: + deps = portapi.aux_get(pkg, ["DEPEND"]) + deps = portage.dep.paren_reduce(deps[0]) + settings.setcpv(pkg, mydb=self.portapi) + use_enabled = set(settings["PORTAGE_USE"].split()) + iuse = set(settings["IUSE"].split()) + use_deps = portage.dep.use_reduce(deps, list(use_enabled & iuse)) + use_deps = self.tb._normalize_dependencies(use_deps) + for dep in use_deps: + self.assertTrue(portage.dep.isvalidatom(dep)) |