From 690c890596cf646b1bc7b05ce276e0d6aabea7fc Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 26 Apr 2006 10:56:46 +0000 Subject: [PATCH] Pass a portdbapi instance into portage.digestgen() so that it doesn't have to use any globals. svn path=/main/trunk/; revision=3244 --- bin/repoman | 8 ++++---- pym/portage.py | 20 ++++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bin/repoman b/bin/repoman index 4cc57e297..9cbe8b68a 100755 --- a/bin/repoman +++ b/bin/repoman @@ -797,7 +797,7 @@ for x in scanlist: if mymode == "commit": repoman_settings["O"] = checkdir - portage.digestgen([], repoman_settings, manifestonly=1) + portage.digestgen([], repoman_settings, manifestonly=1, myportdb=portage.portdb) mf = Manifest(checkdir, portage.FetchlistDict(checkdir, repoman_settings, portage.portdb), @@ -1610,7 +1610,7 @@ else: mydone=[] if repolevel==3: # In a package dir repoman_settings["O"]=os.getcwd() - portage.digestgen([],repoman_settings,manifestonly=1) + portage.digestgen([], repoman_settings, manifestonly=1, myportdb=portage.portdb) elif repolevel==2: # In a category dir for x in myfiles: xs=string.split(x,"/") @@ -1620,7 +1620,7 @@ else: continue mydone.append(xs[0]) repoman_settings["O"]=os.path.join(os.getcwd(), xs[0]) - portage.digestgen([],repoman_settings,manifestonly=1) + portage.digestgen([], repoman_settings, manifestonly=1, myportdb=portage.portdb) elif repolevel==1: # repo-cvsroot print green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n" for x in myfiles: @@ -1631,7 +1631,7 @@ else: continue mydone.append(string.join(xs[:2],"/")) repoman_settings["O"]=os.path.join(os.getcwd(), x[0], x[1]) - portage.digestgen([],repoman_settings,manifestonly=1) + portage.digestgen([], repoman_settings, manifestonly=1, myportdb=portage.portdb) else: print red("I'm confused... I don't know where I am!") sys.exit(1) diff --git a/pym/portage.py b/pym/portage.py index 0db29a4ff..c5b5fdccb 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -2140,14 +2140,17 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", return 0 return 1 -def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0): +def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None): """Generates a digest file if missing. Assumes all files are available. DEPRECATED: this now only is a compability wrapper for portage_manifest.Manifest() NOTE: manifestonly and overwrite are useless with manifest2 and are therefore ignored.""" - global portdb - mf = Manifest(mysettings["O"], FetchlistDict(mysettings["O"], mysettings, portdb), mysettings["DISTDIR"]) + if myportdb is None: + writemsg("Warning: myportdb not specified to digestgen\n") + global portdb + myportdb = portdb + mf = Manifest(mysettings["O"], FetchlistDict(mysettings["O"], mysettings, myportdb), mysettings["DISTDIR"]) writemsg(">>> Creating Manifest for %s\n" % mysettings["O"]) try: mf.create(assumeDistfileHashes=True, requiredDistfiles=myarchives) @@ -2572,7 +2575,8 @@ def prepare_build_dirs(myroot, mysettings, cleanup): 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, actionmap_deps + global db, portdb, actionmap_deps + myportdb = portdb features = mysettings.features if not tree: dump_traceback("Warning: tree not specified to doebuild") @@ -2709,14 +2713,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)) + return (not digestgen(aalist, mysettings, overwrite=1, myportdb=myportdb)) else: - digestgen(aalist,mysettings,overwrite=0) + digestgen(aalist, mysettings, overwrite=0, myportdb=myportdb) elif mydo=="digest": #since we are calling "digest" directly, recreate the digest even if it already exists - return (not digestgen(aalist,mysettings,overwrite=1)) + return (not digestgen(aalist, mysettings, overwrite=1, myportdb=myportdb)) if mydo=="manifest": - return (not digestgen(aalist,mysettings,overwrite=1,manifestonly=1)) + return (not digestgen(aalist,mysettings,overwrite=1,manifestonly=1, myportdb=myportdb)) # See above comment about fetching only when needed if not digestcheck(checkme, mysettings, ("strict" in features), -- 2.26.2