Pass a portdbapi instance into portage.digestgen() so that it doesn't have to use...
authorZac Medico <zmedico@gentoo.org>
Wed, 26 Apr 2006 10:56:46 +0000 (10:56 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 26 Apr 2006 10:56:46 +0000 (10:56 -0000)
svn path=/main/trunk/; revision=3244

bin/repoman
pym/portage.py

index 4cc57e2973b2deac14d60222586b75c13a7975da..9cbe8b68ab3b67a54633ab8d0a15d575619334a4 100755 (executable)
@@ -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)
index 0db29a4ff9344b4279c6dfbeae0658b8d5a5a246..c5b5fdccbf0f8eb00079cef08387d8d2a6a8ddf5 100644 (file)
@@ -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),