Fix _spawn_phase() to spawn phases without sandbox when necessary.
authorZac Medico <zmedico@gentoo.org>
Tue, 17 Aug 2010 08:22:58 +0000 (01:22 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 17 Aug 2010 08:22:58 +0000 (01:22 -0700)
pym/_emerge/EbuildProcess.py
pym/portage/package/ebuild/doebuild.py

index 50edaa16d45249bfd97a9a1776aec1f9746f2751..70c724314ab2362d9ff9e571656a67f4f8641f39 100644 (file)
@@ -5,7 +5,7 @@ from _emerge.AbstractEbuildProcess import AbstractEbuildProcess
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
        'portage.package.ebuild.doebuild:_post_phase_userpriv_perms,' + \
-               '_spawn_actionmap,spawn@doebuild_spawn'
+               '_spawn_actionmap,_unsandboxed_phases,spawn@doebuild_spawn'
 )
 from portage import _shell_quote
 from portage import os
@@ -15,12 +15,6 @@ class EbuildProcess(AbstractEbuildProcess):
 
        __slots__ = ('actionmap',)
 
-       _unsandboxed_phases = frozenset([
-               "clean", "cleanrm", "config",
-               "help", "info", "postinst",
-               "preinst", "pretend", "postrm",
-               "prerm", "setup"])
-
        def _start(self):
                # Don't open the log file during the clean phase since the
                # open file can result in an nfs lock on $T/build.log which
@@ -31,7 +25,7 @@ class EbuildProcess(AbstractEbuildProcess):
 
        def _spawn(self, args, **kwargs):
                self.settings["EBUILD_PHASE"] = self.phase
-               if self.phase in self._unsandboxed_phases:
+               if self.phase in _unsandboxed_phases:
                        kwargs['free'] = True
                if self.phase == 'depend':
                        kwargs['droppriv'] = 'userpriv' in self.settings.features
index 195bfdd4f848ba0a465c5f6ed5fdd60090c27006..355088036aa643bba5f7d0eafb873ce932aaa9e3 100644 (file)
@@ -55,6 +55,13 @@ from _emerge.EbuildPhase import EbuildPhase
 from _emerge.EbuildSpawnProcess import EbuildSpawnProcess
 from _emerge.TaskScheduler import TaskScheduler
 
+_unsandboxed_phases = frozenset([
+       "clean", "cleanrm", "config",
+       "help", "info", "postinst",
+       "preinst", "pretend", "postrm",
+       "prerm", "setup"
+])
+
 def doebuild_environment(myebuild, mydo, myroot, mysettings,
        debug, use_cache, mydbapi):
 
@@ -1074,6 +1081,8 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
 
 def _spawn_phase(phase, settings, **kwargs):
        if kwargs.get('returnpid'):
+               if phase in _unsandboxed_phases:
+                       kwargs['free'] = True
                portage_bin_path = settings["PORTAGE_BIN_PATH"]
                ebuild_sh_binary = os.path.join(portage_bin_path,
                        os.path.basename(EBUILD_SH_BINARY))