Reset DISTDIR to it's original value before returning from doebuild() in order to...
authorZac Medico <zmedico@gentoo.org>
Fri, 26 May 2006 01:59:13 +0000 (01:59 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 26 May 2006 01:59:13 +0000 (01:59 -0000)
svn path=/main/trunk/; revision=3415

pym/portage.py

index e46e3b62df7b2d7e5a45e042efa8a3d838b7bdbc..d604c9baed401f2d0390d32301b8870d37f1a1a5 100644 (file)
@@ -2907,7 +2907,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                if not os.path.exists(mysettings["PKGDIR"]+x):
                                        os.makedirs(mysettings["PKGDIR"]+x)
                # REBUILD CODE FOR TBZ2 --- XXXX
-               return spawnebuild(mydo,actionmap,mysettings,debug,logfile=logfile)
+               retval = spawnebuild(mydo, actionmap, mysettings, debug, logfile=logfile)
        elif mydo=="qmerge":
                #check to ensure install was run.  this *only* pops up when users forget it and are using ebuild
                if not os.path.exists(mysettings["PORTAGE_BUILDDIR"]+"/.installed"):
@@ -2917,22 +2917,30 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                if "noclean" not in mysettings.features:
                        mysettings.features.append("noclean")
                #qmerge is specifically not supposed to do a runtime dep check
-               return merge(mysettings["CATEGORY"], mysettings["PF"], mysettings["D"],
+               retval = merge(mysettings["CATEGORY"], mysettings["PF"], mysettings["D"],
                        os.path.join(mysettings["PORTAGE_BUILDDIR"], "build-info"), myroot,
                        mysettings, myebuild=mysettings["EBUILD"], mytree=tree,
                        mydbapi=mydbapi, vartree=vartree, prev_mtimes=prev_mtimes)
        elif mydo=="merge":
-               retval=spawnebuild("install",actionmap,mysettings,debug,alwaysdep=1,logfile=logfile)
-               if retval:
-                       return retval
-               return merge(mysettings["CATEGORY"], mysettings["PF"], mysettings["D"],
-                       os.path.join(mysettings["PORTAGE_BUILDDIR"], "build-info"), myroot,
-                       mysettings, myebuild=mysettings["EBUILD"], mytree=tree,
-                       mydbapi=mydbapi, vartree=vartree, prev_mtimes=prev_mtimes)
+               retval = spawnebuild("install", actionmap, mysettings, debug,
+                       alwaysdep=1, logfile=logfile)
+               if retval == os.EX_OK:
+                       retval = merge(mysettings["CATEGORY"], mysettings["PF"],
+                               mysettings["D"], os.path.join(mysettings["PORTAGE_BUILDDIR"],
+                               "build-info"), myroot, mysettings,
+                               myebuild=mysettings["EBUILD"], mytree=tree, mydbapi=mydbapi,
+                               vartree=vartree, prev_mtimes=prev_mtimes)
        else:
                print "!!! Unknown mydo:",mydo
                sys.exit(1)
 
+       # Make sure that DISTDIR is restored to it's normal value before we return!
+       if "PORTAGE_ACTUAL_DISTDIR" in mysettings:
+               mysettings["DISTDIR"] = mysettings["PORTAGE_ACTUAL_DISTDIR"]
+               del mysettings["PORTAGE_ACTUAL_DISTDIR"]
+
+       return retval
+
 expandcache={}
 
 def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):