summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-04-29 04:47:14 +0000
committerZac Medico <zmedico@gentoo.org>2006-04-29 04:47:14 +0000
commitffe58c875fb0113e2649e214feecc237a191734a (patch)
treef969959a8b148b54c932692d3c86cafd1c52d944
parentEnable portage.env_update() to work without globals. (diff)
downloadportage-ffe58c875fb0113e2649e214feecc237a191734a.tar.gz
portage-ffe58c875fb0113e2649e214feecc237a191734a.tar.bz2
portage-ffe58c875fb0113e2649e214feecc237a191734a.zip
Enable portage.dep_zapdeps() to work without globals.
svn path=/main/trunk/; revision=3266
-rw-r--r--pym/portage.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 02457d779..4821e2a92 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -3110,10 +3110,12 @@ def dep_eval(deplist):
return 0
return 1
-def dep_zapdeps(unreduced,reduced,myroot,use_binaries=0):
+def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
"""Takes an unreduced and reduced deplist and removes satisfied dependencies.
Returned deplist contains steps that must be taken to satisfy dependencies."""
- global db
+ if trees is None:
+ global db
+ trees = db
writemsg("ZapDeps -- %s\n" % (use_binaries), 2)
if not reduced or unreduced == ["||"] or dep_eval(reduced):
return []
@@ -3137,7 +3139,7 @@ def dep_zapdeps(unreduced,reduced,myroot,use_binaries=0):
atoms = dep_zapdeps(dep, satisfied, myroot, use_binaries=use_binaries)
else:
atoms = [dep]
- missing_atoms = [atom for atom in atoms if not db[myroot]["vartree"].dbapi.match(atom)]
+ missing_atoms = [atom for atom in atoms if not trees[myroot]["vartree"].dbapi.match(atom)]
if not missing_atoms:
if isinstance(dep, list):
@@ -3148,9 +3150,9 @@ def dep_zapdeps(unreduced,reduced,myroot,use_binaries=0):
if not target:
if use_binaries:
- missing_atoms = [atom for atom in atoms if not db[myroot]["bintree"].dbapi.match(atom)]
+ missing_atoms = [atom for atom in atoms if not trees[myroot]["bintree"].dbapi.match(atom)]
else:
- missing_atoms = [atom for atom in atoms if not db[myroot]["porttree"].dbapi.xmatch("match-visible", atom)]
+ missing_atoms = [atom for atom in atoms if not trees[myroot]["porttree"].dbapi.xmatch("match-visible", atom)]
if not missing_atoms:
target = (dep, satisfied)
@@ -3171,9 +3173,9 @@ def dep_zapdeps(unreduced,reduced,myroot,use_binaries=0):
available_pkgs = {}
for atom in relevant_atoms:
if use_binaries:
- pkg_list = db["/"]["bintree"].dbapi.match(atom)
+ pkg_list = trees["/"]["bintree"].dbapi.match(atom)
else:
- pkg_list = db["/"]["porttree"].dbapi.xmatch("match-visible", atom)
+ pkg_list = trees["/"]["porttree"].dbapi.xmatch("match-visible", atom)
if not pkg_list:
continue
pkg = best(pkg_list)