summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-07-09 18:43:02 +0000
committerZac Medico <zmedico@gentoo.org>2006-07-09 18:43:02 +0000
commit73318907b69c05acd5e1e43278fa33bf781e829d (patch)
treedc174749e0cd2feb51029163e899185c65a0079d
parent79a388986fc33b0989c931d314fb210057c0725f (diff)
downloadportage-73318907b69c05acd5e1e43278fa33bf781e829d.tar.gz
portage-73318907b69c05acd5e1e43278fa33bf781e829d.tar.bz2
portage-73318907b69c05acd5e1e43278fa33bf781e829d.zip
Use the abstract dbapi.aux_get() interface to unify retrieval of dependency strings in depgraph.create().
svn path=/main/trunk/; revision=3818
-rwxr-xr-xbin/emerge51
1 files changed, 19 insertions, 32 deletions
diff --git a/bin/emerge b/bin/emerge
index 06f09ddf4..3924d29fe 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -603,6 +603,11 @@ def genericdict(mylist):
class depgraph:
+ pkg_tree_map = {
+ "ebuild":"porttree",
+ "binary":"bintree",
+ "installed":"vartree"}
+
def __init__(self, settings, trees, myopts, myparams, spinner):
self.settings = settings
self.target_root = settings["ROOT"]
@@ -683,6 +688,8 @@ class depgraph:
mybigkey.append(myparent.split()[2])
self.digraph.addnode(" ".join(mybigkey), myparent)
return 1
+ else:
+ mydbapi = self.trees[myroot][self.pkg_tree_map[mytype]].dbapi
if myuse is None:
self.pkgsettings[myroot].setcpv(mykey)
@@ -745,38 +752,18 @@ class depgraph:
Binpkg's can be either remote or local. """
edepend={}
- if mytype=="binary":
- mypkgparts=portage.catpkgsplit(mykey)
- tbz2name = string.split(mykey, "/")[1]+".tbz2"
- """ This sucks, look at querying the bintree anyhow and throwing an exception """
- if tbz2name in self.trees[myroot]["bintree"].invalids:
- sys.stderr.write("\nINVALID PACKAGE (is required to continue): "+str(mykey)+"\n")
- sys.exit(1)
- if self.trees[myroot]["bintree"].isremote(mykey):
- edepend = self.trees[myroot]["bintree"].remotepkgs[tbz2name]
- edepend["DEPEND"] =""
- edepend["RDEPEND"]=string.join(string.split(edepend["RDEPEND"])," ")
- edepend["PDEPEND"]=string.join(string.split(edepend["PDEPEND"])," ")
- edepend["SLOT"] =string.strip(edepend["SLOT"])
- else:
- mytbz2 = xpak.tbz2(self.trees[myroot]["bintree"].getname(mykey))
- edepend["DEPEND"] =""
- edepend["RDEPEND"]=string.join(mytbz2.getelements("RDEPEND")," ")
- edepend["PDEPEND"]=string.join(mytbz2.getelements("PDEPEND")," ")
- edepend["SLOT"] =mytbz2.getfile("SLOT",mypkgparts[2])
- elif mytype=="ebuild":
- try:
- mymeta = ["DEPEND","RDEPEND","PDEPEND"]
- myfoo = portdb.aux_get(mykey, mymeta)
- for index in range(0,len(mymeta)):
- edepend[mymeta[index]] = myfoo[index]
- if "--buildpkgonly" in self.myopts:
- edepend["RDEPEND"] = ""
- edepend["PDEPEND"] = ""
- except (KeyError,IOError):
- print "emerge: create(): aux_get() error on",mykey+"; aborting..."
- sys.exit(1)
-
+ depkeys = ["DEPEND","RDEPEND","PDEPEND"]
+ depvalues = mydbapi.aux_get(mykey, depkeys)
+ for i in xrange(len(depkeys)):
+ edepend[depkeys[i]] = depvalues[i]
+
+ if mytype == "binary":
+ edepend["DEPEND"] = ""
+ elif mytype == "ebuild":
+ if "--buildpkgonly" in self.myopts:
+ edepend["RDEPEND"] = ""
+ edepend["PDEPEND"] = ""
+
""" We have retrieve the dependency information, now we need to recursively
process them. DEPEND gets processed for root = "/", {R,P}DEPEND in myroot. """