From 24469ce8987d3f1ed5f1cef1b248f45fc59569f5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 30 Jun 2006 11:16:08 +0000 Subject: [PATCH] Fix pkgmerge() to work without dependance on global variables. svn path=/main/trunk/; revision=3717 --- bin/emerge | 5 ++++- pym/portage.py | 15 +++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/bin/emerge b/bin/emerge index 6bde09bc1..38dce15ce 100755 --- a/bin/emerge +++ b/bin/emerge @@ -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 diff --git a/pym/portage.py b/pym/portage.py index f82045fcf..4e3a89035 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -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(): -- 2.26.2