diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-04-27 04:23:12 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-04-27 04:23:12 +0000 |
commit | ab28eec2f5d2361238a5491a2be0dc8111266a50 (patch) | |
tree | 51cb5c34ff5a863f241dc8566d4f8a4d7ee14819 | |
parent | f621e9c5e7f685956da4e4cf8f69f880ed5df0ee (diff) | |
download | portage-ab28eec2f5d2361238a5491a2be0dc8111266a50.tar.gz portage-ab28eec2f5d2361238a5491a2be0dc8111266a50.tar.bz2 portage-ab28eec2f5d2361238a5491a2be0dc8111266a50.zip |
Add optional mydbapi parameter to doebuild() so that it doesn't have to use any globals.
svn path=/main/trunk/; revision=3246
-rw-r--r-- | pym/portage.py | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/pym/portage.py b/pym/portage.py index 334a8f58c..a85afda9b 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -2572,9 +2572,13 @@ def prepare_build_dirs(myroot, mysettings, cleanup): writemsg("!!! Disabling logging.\n") mysettings["PORT_LOGDIR"]="" -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, portdb, actionmap_deps - myportdb = portdb +def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, + fetchonly=0, cleanup=0, dbkey=None, use_cache=1, fetchall=0, tree=None, + mydbapi=None): + global actionmap_deps + if mydbapi is None: + global db + mydbapi = db[myroot][tree].dbapi features = mysettings.features if not tree: dump_traceback("Warning: tree not specified to doebuild") @@ -2599,7 +2603,8 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea writemsg("!!! doebuild: "+str(myebuild)+" not found for "+str(mydo)+"\n") return 1 - mystatus = doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, db[myroot][tree].dbapi) + mystatus = doebuild_environment(myebuild, mydo, myroot, mysettings, debug, + use_cache, mydbapi) if mystatus: return mystatus @@ -2669,13 +2674,15 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea mycpv = "/".join((mysettings["CATEGORY"], mysettings["PF"])) try: - mysettings["SLOT"],mysettings["RESTRICT"] = db["/"]["porttree"].dbapi.aux_get(mycpv,["SLOT","RESTRICT"]) + mysettings["SLOT"], mysettings["RESTRICT"] = \ + mydbapi.aux_get(mycpv, ["SLOT", "RESTRICT"]) except (IOError,KeyError): print red("doebuild():")+" aux_get() error reading "+mycpv+"; aborting." sys.exit(1) - newuris, alist = db["/"]["porttree"].dbapi.getfetchlist(mycpv,mysettings=mysettings) - alluris, aalist = db["/"]["porttree"].dbapi.getfetchlist(mycpv,mysettings=mysettings,all=1) + newuris, alist = mydbapi.getfetchlist(mycpv, mysettings=mysettings) + alluris, aalist = mydbapi.getfetchlist( + mycpv, mysettings=mysettings, all=True) mysettings["A"]=string.join(alist," ") mysettings["AA"]=string.join(aalist," ") if ("mirror" in features) or fetchall: @@ -2711,14 +2718,14 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea if "digest" in features: #generate digest if it doesn't exist. if mydo=="digest": - return (not digestgen(aalist, mysettings, overwrite=1, myportdb=myportdb)) + return (not digestgen(aalist, mysettings, overwrite=1, myportdb=mydbapi)) else: - digestgen(aalist, mysettings, overwrite=0, myportdb=myportdb) + digestgen(aalist, mysettings, overwrite=0, myportdb=mydbapi) elif mydo=="digest": #since we are calling "digest" directly, recreate the digest even if it already exists - return (not digestgen(aalist, mysettings, overwrite=1, myportdb=myportdb)) + return (not digestgen(aalist, mysettings, overwrite=1, myportdb=mydbapi)) if mydo=="manifest": - return (not digestgen(aalist,mysettings,overwrite=1,manifestonly=1, myportdb=myportdb)) + return (not digestgen(aalist,mysettings,overwrite=1,manifestonly=1, myportdb=mydbapi)) # See above comment about fetching only when needed if not digestcheck(checkme, mysettings, ("strict" in features), |