summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-10-30 07:23:42 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-10-30 07:23:42 +0000
commit83a88f299ec4fa89eb2cac14960cc89833cf9c12 (patch)
tree816ce03aeaae8383263679615c1522714e7ca528
parent583f01a90ef7d5bd967972e19d4593c0e3e487ea (diff)
downloadportage-83a88f299ec4fa89eb2cac14960cc89833cf9c12.tar.gz
portage-83a88f299ec4fa89eb2cac14960cc89833cf9c12.tar.bz2
portage-83a88f299ec4fa89eb2cac14960cc89833cf9c12.zip
Add treetype instance member to dblink. Add treetype parameters tov2.0.53_rc7
dblink.__init__() and merge(). Adjust all calls to dblink(), merge() and doebuild() to specify what tree should be used for aux_get(). Patch created with the help of Zac Medico (zmedico). svn path=/main/branches/2.0/; revision=2203
-rwxr-xr-xbin/emerge18
-rwxr-xr-xbin/repoman2
-rw-r--r--pym/portage.py37
-rw-r--r--pym/portage_util.py10
4 files changed, 39 insertions, 28 deletions
diff --git a/bin/emerge b/bin/emerge
index 1522b57a7..05b86ad76 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -1848,9 +1848,9 @@ class depgraph:
raise Exception, "Merging a blocker"
elif ("--fetchonly" in myopts) or ("--fetch-all-uri" in myopts):
if ("--fetch-all-uri" in myopts):
- retval=portage.doebuild(y,"fetch",myroot,self.pkgsettings,edebug,("--pretend" in myopts),fetchonly=1,fetchall=1)
+ retval=portage.doebuild(y,"fetch",myroot,self.pkgsettings,edebug,("--pretend" in myopts),fetchonly=1,fetchall=1,tree="porttree")
else:
- retval=portage.doebuild(y,"fetch",myroot,self.pkgsettings,edebug,("--pretend" in myopts),fetchonly=1)
+ retval=portage.doebuild(y,"fetch",myroot,self.pkgsettings,edebug,("--pretend" in myopts),fetchonly=1,tree="porttree")
if (retval == None) or retval:
print
print "!!! Fetch for",y,"failed, continuing..."
@@ -1865,7 +1865,7 @@ class depgraph:
#create pkg, then merge pkg
short_msg = "emerge: ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" Clean"
emergelog(" === ("+str(mergecount)+" of "+str(len(mymergelist))+") Cleaning ("+x[pkgindex]+"::"+y+")", short_msg=short_msg)
- retval=portage.doebuild(y,"clean",myroot,self.pkgsettings,edebug,cleanup=1)
+ retval=portage.doebuild(y,"clean",myroot,self.pkgsettings,edebug,cleanup=1,tree="porttree")
if (retval == None):
portage_util.writemsg("Unable to run required binary.\n")
sys.exit(127)
@@ -1873,7 +1873,7 @@ class depgraph:
sys.exit(retval)
short_msg = "emerge: ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" Compile"
emergelog(" === ("+str(mergecount)+" of "+str(len(mymergelist))+") Compiling/Packaging ("+x[pkgindex]+"::"+y+")", short_msg=short_msg)
- retval=portage.doebuild(y,"package",myroot,self.pkgsettings,edebug)
+ retval=portage.doebuild(y,"package",myroot,self.pkgsettings,edebug,tree="porttree")
if (retval == None):
portage_util.writemsg("Unable to run required binary.\n")
sys.exit(127)
@@ -1895,7 +1895,7 @@ class depgraph:
else:
short_msg = "emerge: ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" Clean"
emergelog(" === ("+str(mergecount)+" of "+str(len(mymergelist))+") Cleaning ("+x[pkgindex]+"::"+y+")", short_msg=short_msg)
- retval=portage.doebuild(y,"clean",myroot,self.pkgsettings,edebug,cleanup=1)
+ retval=portage.doebuild(y,"clean",myroot,self.pkgsettings,edebug,cleanup=1,tree="porttree")
if (retval == None):
portage_util.writemsg("Unable to run required binary.\n")
sys.exit(127)
@@ -1903,7 +1903,7 @@ class depgraph:
sys.exit(retval)
short_msg = "emerge: ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" Compile"
emergelog(" === ("+str(mergecount)+" of "+str(len(mymergelist))+") Compiling/Merging ("+x[pkgindex]+"::"+y+")", short_msg=short_msg)
- retval=portage.doebuild(y,"merge",myroot,self.pkgsettings,edebug)
+ retval=portage.doebuild(y,"merge",myroot,self.pkgsettings,edebug,tree="porttree")
if (retval == None):
portage_util.writemsg("Unable to run required binary.\n")
sys.exit(127)
@@ -1945,7 +1945,7 @@ class depgraph:
if ("noclean" not in portage.features) and (x[0] != "binary"):
short_msg = "emerge: ("+str(mergecount)+" of "+str(len(mymergelist))+") "+x[pkgindex]+" Clean Post"
emergelog(" === ("+str(mergecount)+" of "+str(len(mymergelist))+") Post-Build Cleaning ("+x[pkgindex]+"::"+y+")", short_msg=short_msg)
- retval=portage.doebuild(y,"clean",myroot,self.pkgsettings,edebug,cleanup=1)
+ retval=portage.doebuild(y,"clean",myroot,self.pkgsettings,edebug,cleanup=1,tree="porttree")
if (retval == None):
portage_util.writemsg("Unable to run required binary.\n")
sys.exit(127)
@@ -2845,7 +2845,7 @@ elif "config"==myaction:
print
ebuildpath = portage.db[portage.root]["vartree"].dbapi.findname(pkg)
mysettings = portage.config(clone=portage.settings)
- portage.doebuild(ebuildpath,"config",portage.root,mysettings,debug=("--debug" in myopts),cleanup=True)
+ portage.doebuild(ebuildpath,"config",portage.root,mysettings,debug=("--debug" in myopts),cleanup=True,tree="vartree")
print
# INFO action
@@ -3211,7 +3211,7 @@ else:
if pkgline[0]=="ebuild" and pkgline[3]=="merge":
y=portage.portdb.findname(pkgline[2])
tmpsettings = portage.config(clone=portage.settings)
- retval=portage.doebuild(y,"digest",portage.root,tmpsettings,edebug,("--pretend" in myopts))
+ retval=portage.doebuild(y,"digest",portage.root,tmpsettings,edebug,("--pretend" in myopts),tree="porttree")
if "--fetchonly" in myopts or "--fetch-all-uri" in myopts:
pkglist = []
for pkg in mydepgraph.altlist():
diff --git a/bin/repoman b/bin/repoman
index 17f10a63b..9e4afb231 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -800,7 +800,7 @@ for x in scanlist:
fails["digest.unmatch"].append(y+"::"+myf)
else:
eb_name,eb_location = portage.db["/"]["porttree"].dbapi.findname2(mykey)
- portage.doebuild(eb_name, "digest", "/", uri_settings)
+ portage.doebuild(eb_name, "digest", "/", uri_settings, tree="porttree")
else:
stats["digest.partial"] += 1
fails["digest.partial"].append(y+"::"+myf)
diff --git a/pym/portage.py b/pym/portage.py
index 4e4aec9c4..1e6dadbea 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -89,7 +89,7 @@ try:
import portage_util
from portage_util import grab_multiple, grabdict, grabdict_package, grabfile, grabfile_package, \
grabints, map_dictlist_vals, pickle_read, pickle_write, stack_dictlist, stack_dicts, stack_lists, \
- unique_array, varexpand, writedict, writeints, writemsg, getconfig
+ unique_array, varexpand, writedict, writeints, writemsg, getconfig, dump_traceback
import portage_exception
import portage_gpg
import portage_locks
@@ -2352,9 +2352,13 @@ def eapi_is_supported(eapi):
return str(eapi).strip() == str(portage_const.EAPI).strip()
-def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,dbkey=None,use_cache=1,fetchall=0,tree="porttree"):
+def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,cleanup=0,dbkey=None,use_cache=1,fetchall=0,tree=None):
global db, actionmap_deps
+ if not tree:
+ dump_traceback("tree not specified to doebuild")
+ tree = "porttree"
+
ebuild_path = os.path.abspath(myebuild)
pkg_dir = os.path.dirname(ebuild_path)
@@ -2759,12 +2763,12 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea
print "!!! mydo=qmerge, but install phase hasn't been ran"
sys.exit(1)
#qmerge is specifically not supposed to do a runtime dep check
- return merge(mysettings["CATEGORY"],mysettings["PF"],mysettings["D"],mysettings["BUILDDIR"]+"/build-info",myroot,mysettings,myebuild=mysettings["EBUILD"])
+ return merge(mysettings["CATEGORY"],mysettings["PF"],mysettings["D"],mysettings["BUILDDIR"]+"/build-info",myroot,mysettings,myebuild=mysettings["EBUILD"],mytree=tree)
elif mydo=="merge":
retval=spawnebuild("install",actionmap,mysettings,debug,alwaysdep=1,logfile=logfile)
if retval:
return retval
- return merge(mysettings["CATEGORY"],mysettings["PF"],mysettings["D"],mysettings["BUILDDIR"]+"/build-info",myroot,mysettings,myebuild=mysettings["EBUILD"])
+ return merge(mysettings["CATEGORY"],mysettings["PF"],mysettings["D"],mysettings["BUILDDIR"]+"/build-info",myroot,mysettings,myebuild=mysettings["EBUILD"],mytree=tree)
else:
print "!!! Unknown mydo:",mydo
sys.exit(1)
@@ -2937,12 +2941,12 @@ def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):
return newmtime
-def merge(mycat,mypkg,pkgloc,infloc,myroot,mysettings,myebuild=None):
- mylink=dblink(mycat,mypkg,myroot,mysettings)
+def merge(mycat,mypkg,pkgloc,infloc,myroot,mysettings,myebuild=None,mytree=None):
+ mylink=dblink(mycat,mypkg,myroot,mysettings,treetype=mytree)
return mylink.merge(pkgloc,infloc,myroot,myebuild)
def unmerge(cat,pkg,myroot,mysettings,mytrimworld=1):
- mylink=dblink(cat,pkg,myroot,mysettings)
+ mylink=dblink(cat,pkg,myroot,mysettings,treetype="vartree")
if mylink.exists():
mylink.unmerge(trimworld=mytrimworld,cleanup=1)
mylink.delete()
@@ -5393,7 +5397,7 @@ class portdbapi(dbapi):
writemsg("Uncaught handled exception: %(exception)s\n" % {"exception":str(e)})
raise
- myret=doebuild(myebuild,"depend","/",self.mysettings,dbkey=mydbkey)
+ myret=doebuild(myebuild,"depend","/",self.mysettings,dbkey=mydbkey,tree="porttree")
if myret:
portage_locks.unlockfile(mylock)
self.lock_held = 0
@@ -6027,12 +6031,13 @@ class binarytree(packagetree):
class dblink:
"this class provides an interface to the standard text package database"
- def __init__(self,cat,pkg,myroot,mysettings):
+ def __init__(self,cat,pkg,myroot,mysettings,treetype=None):
"create a dblink object for cat/pkg. This dblink entry may or may not exist"
self.cat = cat
self.pkg = pkg
self.mycpv = self.cat+"/"+self.pkg
self.mysplit = pkgsplit(self.mycpv)
+ self.treetype = treetype
self.dbroot = os.path.normpath(myroot+VDB_PATH)
self.dbcatdir = self.dbroot+"/"+cat
@@ -6213,7 +6218,7 @@ class dblink:
#do prerm script
if myebuildpath and os.path.exists(myebuildpath):
- a=doebuild(myebuildpath,"prerm",self.myroot,self.settings,cleanup=cleanup,use_cache=0,tree="vartree")
+ a=doebuild(myebuildpath,"prerm",self.myroot,self.settings,cleanup=cleanup,use_cache=0,tree=self.treetype)
# XXX: Decide how to handle failures here.
if a != 0:
writemsg("!!! FAILED prerm: "+str(a)+"\n")
@@ -6419,7 +6424,7 @@ class dblink:
if myebuildpath and os.path.exists(myebuildpath):
# XXX: This should be the old config, not the current one.
# XXX: Use vardbapi to load up env vars.
- a=doebuild(myebuildpath,"postrm",self.myroot,self.settings,use_cache=0,tree="vartree")
+ a=doebuild(myebuildpath,"postrm",self.myroot,self.settings,use_cache=0,tree=self.treetype)
# XXX: Decide how to handle failures here.
if a != 0:
writemsg("!!! FAILED postrm: "+str(a)+"\n")
@@ -6541,9 +6546,9 @@ class dblink:
if myebuild:
# if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg
# (if any).
- a=doebuild(myebuild,"preinst",root,self.settings,cleanup=cleanup,use_cache=0)
+ a=doebuild(myebuild,"preinst",root,self.settings,cleanup=cleanup,use_cache=0,tree=self.treetype)
else:
- a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst",root,self.settings,cleanup=cleanup,use_cache=0)
+ a=doebuild(inforoot+"/"+self.pkg+".ebuild","preinst",root,self.settings,cleanup=cleanup,use_cache=0,tree=self.treetype)
# XXX: Decide how to handle failures here.
if a != 0:
@@ -6658,9 +6663,9 @@ class dblink:
if myebuild:
# if we are merging a new ebuild, use *its* pre/postinst rather than using the one in /var/db/pkg
# (if any).
- a=doebuild(myebuild,"postinst",root,self.settings,use_cache=0)
+ a=doebuild(myebuild,"postinst",root,self.settings,use_cache=0,tree=self.treetype)
else:
- a=doebuild(inforoot+"/"+self.pkg+".ebuild","postinst",root,self.settings,use_cache=0)
+ a=doebuild(inforoot+"/"+self.pkg+".ebuild","postinst",root,self.settings,use_cache=0,tree=self.treetype)
# XXX: Decide how to handle failures here.
if a != 0:
@@ -7074,7 +7079,7 @@ def pkgmerge(mytbz2,myroot,mysettings):
# the merge takes care of pre/postinst and old instance
# auto-unmerge, virtual/provides updates, etc.
mysettings.load_infodir(infloc)
- mylink=dblink(mycat,mypkg,myroot,mysettings)
+ mylink=dblink(mycat,mypkg,myroot,mysettings,treetype="bintree")
mylink.merge(pkgloc,infloc,myroot,myebuild,cleanup=1)
if not os.path.exists(infloc+"/RDEPEND"):
diff --git a/pym/portage_util.py b/pym/portage_util.py
index 3584e5fdc..6a0c10155 100644
--- a/pym/portage_util.py
+++ b/pym/portage_util.py
@@ -455,5 +455,11 @@ def unique_array(array):
return mya
-
-
+def dump_traceback(msg):
+ import sys, traceback
+ writemsg("\n====================================\n", noiselevel=1)
+ writemsg("Warning: %s\n" % msg, noiselevel=1)
+ for line in traceback.format_list(traceback.extract_stack()[:-1]):
+ writemsg(line, noiselevel=1)
+ writemsg("Please file a bug for %s\n" % sys.argv[0], noiselevel=1)
+ writemsg("====================================\n\n", noiselevel=1)