Fix pkgmerge() to work without dependance on global variables.
authorZac Medico <zmedico@gentoo.org>
Fri, 30 Jun 2006 11:16:08 +0000 (11:16 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 30 Jun 2006 11:16:08 +0000 (11:16 -0000)
svn path=/main/trunk/; revision=3717

bin/emerge
pym/portage.py

index 6bde09bc1c4ca7aafa71883b325a39e448ef84f0..38dce15ce4f64d2ec92ab1c182900b0c836f2663 100755 (executable)
@@ -1937,7 +1937,10 @@ class depgraph:
                                emergelog(xterm_titles, " === ("+str(mergecount)+\
                                        " of "+str(len(mymergelist))+") Merging Binary ("+\
                                        x[pkgindex]+"::"+mytbz2+")", short_msg=short_msg)
-                               retval=portage.pkgmerge(mytbz2,x[1],self.pkgsettings)
+                               retval = portage.pkgmerge(mytbz2, x[1], self.pkgsettings,
+                                       mydbapi=self.trees[self.settings["ROOT"]]["bintree"].dbapi,
+                                       vartree=self.trees[self.settings["ROOT"]]["vartree"],
+                                       prev_mtimes=ldpath_mtimes)
                                if retval is None:
                                        sys.exit(1)
                                #need to check for errors
index f82045fcf939bdc445a6279bdb3580fe5d1519d7..4e3a8903571506bd8a4a5c968b853068f397c587 100644 (file)
@@ -6752,8 +6752,9 @@ class FetchlistDict(UserDict.DictMixin):
                """Returns keys for all packages within pkgdir"""
                return self.portdb.cp_list(self.cp, mytree=self.mytree)
 
-def cleanup_pkgmerge(mypkg,origdir):
-       global settings
+def cleanup_pkgmerge(mypkg, origdir, settings=None):
+       if settings is None:
+               settings = globals()["settings"]
        shutil.rmtree(settings["PORTAGE_TMPDIR"]+"/binpkgs/"+mypkg)
        if os.path.exists(settings["PORTAGE_TMPDIR"]+"/portage/"+mypkg+"/temp/environment"):
                os.unlink(settings["PORTAGE_TMPDIR"]+"/portage/"+mypkg+"/temp/environment")
@@ -6804,14 +6805,16 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes
        notok=spawn("bzip2 -dqc -- '"+mytbz2+"' | tar xpf -",mysettings,free=1)
        if notok:
                print "!!! Error Extracting",mytbz2
-               cleanup_pkgmerge(mypkg,origdir)
+               cleanup_pkgmerge(mypkg, origdir, settings=mysettings)
                return None
 
        # 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,treetype="bintree")
-       mylink.merge(pkgloc, infloc, myroot, myebuild, cleanup=1, prev_mtimes=prev_mtimes)
+       mylink = dblink(mycat, mypkg, myroot, mysettings, vartree=vartree,
+               treetype="bintree")
+       mylink.merge(pkgloc, infloc, myroot, myebuild, cleanup=1, mydbapi=mydbapi,
+               prev_mtimes=prev_mtimes)
 
        if not os.path.exists(infloc+"/RDEPEND"):
                returnme=""
@@ -6820,7 +6823,7 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes
                a=open(infloc+"/RDEPEND","r")
                returnme=string.join(string.split(a.read())," ")
                a.close()
-       cleanup_pkgmerge(mypkg,origdir)
+       cleanup_pkgmerge(mypkg, origdir, settings=mysettings)
        return returnme
 
 def deprecated_profile_check():