Bug #264291 - Fix inappropriate build dir creation for emerge --fetchonly.
authorZac Medico <zmedico@gentoo.org>
Thu, 30 Apr 2009 06:48:59 +0000 (06:48 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 30 Apr 2009 06:48:59 +0000 (06:48 -0000)
(trunk r13252)

svn path=/main/branches/2.1.6/; revision=13431

pym/_emerge/__init__.py
pym/portage/__init__.py

index 64638d9be5733d65dffde06aeeca3154f198ed48..7062480fe7833270afc621992b5b48c69ee92bfd 100644 (file)
@@ -1769,8 +1769,6 @@ class EbuildFetchonly(SlotObject):
                portdb = root_config.trees["porttree"].dbapi
                ebuild_path = portdb.findname(pkg.cpv)
                debug = settings.get("PORTAGE_DEBUG") == "1"
-               portage.prepare_build_dirs(self.pkg.root, self.settings, 0)
-
                retval = portage.doebuild(ebuild_path, "fetch",
                        self.settings["ROOT"], self.settings, debug=debug,
                        listonly=self.pretend, fetchonly=1, fetchall=self.fetch_all,
index 5df90ab7ec95a43c8d90fe3b1686332670bafb16..1b11fd06fe23950f887ab16ba158d6fbcacd8a29 100644 (file)
@@ -5831,6 +5831,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                logfile=None, returnpid=returnpid)
                        return retval
 
+               restrict = set(mysettings.get('PORTAGE_RESTRICT', '').split())
                # get possible slot information from the deps file
                if mydo == "depend":
                        writemsg("!!! DEBUG: dbkey: %s\n" % str(dbkey), 2)
@@ -5939,8 +5940,13 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                                mysettings["PF"], myroot, mysettings, vartree=vartree)
 
                # Build directory creation isn't required for any of these.
+               # In the fetch phase, the directory is needed only for RESTRICT=fetch
+               # in order to satisfy the sane $PWD requirement (from bug #239560)
+               # when pkg_nofetch is spawned.
                have_build_dirs = False
-               if not parallel_fetchonly and mydo not in ("digest", "help", "manifest"):
+               if not parallel_fetchonly and \
+                       mydo not in ('digest', 'help', 'manifest') and \
+                       not (mydo == 'fetch' and 'fetch' not in restrict):
                        mystatus = prepare_build_dirs(myroot, mysettings, cleanup)
                        if mystatus:
                                return mystatus