Fix EbuildSpawnProcess to use self.settings.environ() for the spawn
authorZac Medico <zmedico@gentoo.org>
Sat, 14 Aug 2010 15:25:45 +0000 (08:25 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 14 Aug 2010 15:25:45 +0000 (08:25 -0700)
environment, so all AbstractEbuildProcess subclasses are consistent
in this way.

pym/_emerge/AbstractEbuildProcess.py
pym/_emerge/EbuildSpawnProcess.py
pym/portage/package/ebuild/doebuild.py

index 138430670572f313ff591c75767532e803013bf4..416babcfbc7259886372fe71e837206405ee12b8 100644 (file)
@@ -33,12 +33,8 @@ class AbstractEbuildProcess(SpawnProcess):
 
        def _start(self):
 
-               envs = [self.settings]
-               if self.env is not None:
-                       envs.append(self.env)
                if self._get_phase() not in self._phases_without_builddir:
-                       for env in envs:
-                               env['PORTAGE_IPC_DAEMON'] = "1"
+                       self.settings['PORTAGE_IPC_DAEMON'] = "1"
                        self._exit_command = ExitCommand()
                        self._exit_command.reply_hook = self._exit_command_callback
                        input_fifo = os.path.join(
@@ -57,8 +53,7 @@ class AbstractEbuildProcess(SpawnProcess):
                                scheduler=self.scheduler)
                        self._ipc_daemon.start()
                else:
-                       for env in envs:
-                               env.pop('PORTAGE_IPC_DAEMON', None)
+                       self.settings.pop('PORTAGE_IPC_DAEMON', None)
 
                SpawnProcess._start(self)
 
index d8087576ad49989c6639dbf89ae85fe3d9ac2fdc..dd12b74e98f1417fd30269de1d49540a545bc62f 100644 (file)
@@ -15,4 +15,4 @@ class EbuildSpawnProcess(AbstractEbuildProcess):
        __slots__ = ('fakeroot_state', 'spawn_func')
 
        def _spawn(self, args, **kwargs):
-               return self.spawn_func(args, **kwargs)
+               return self.spawn_func(args, env=self.settings.environ(), **kwargs)
index 7405b6f1256156595ddcde3b2f37ac4df56a4e1b..e85785528d7cc6ce2e413f57f0fc6031be97a71b 100644 (file)
@@ -1053,17 +1053,7 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
        1. The return code of the spawned process.
        """
 
-       if isinstance(mysettings, dict):
-               env=mysettings
-               keywords["opt_name"]="[ %s ]" % "portage"
-       else:
-               check_config_instance(mysettings)
-               env=mysettings.environ()
-               if mysettings.mycpv is not None:
-                       keywords["opt_name"] = "[%s]" % mysettings.mycpv
-               else:
-                       keywords["opt_name"] = "[%s/%s]" % \
-                               (mysettings.get("CATEGORY",""), mysettings.get("PF",""))
+       check_config_instance(mysettings)
 
        fd_pipes = keywords.get("fd_pipes")
        if fd_pipes is None:
@@ -1098,6 +1088,12 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
        if not free and not (fakeroot or portage.process.sandbox_capable):
                free = True
 
+       if mysettings.mycpv is not None:
+               keywords["opt_name"] = "[%s]" % mysettings.mycpv
+       else:
+               keywords["opt_name"] = "[%s/%s]" % \
+                       (mysettings.get("CATEGORY",""), mysettings.get("PF",""))
+
        if free or "SANDBOX_ACTIVE" in os.environ:
                keywords["opt_name"] += " bash"
                spawn_func = portage.process.spawn_bash
@@ -1114,12 +1110,11 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
                        mysettings["PORTAGE_SANDBOX_T"])
 
        if keywords.get("returnpid"):
-               return spawn_func(mystring, env=env, **keywords)
+               return spawn_func(mystring, env=mysettings.environ(), **keywords)
 
        sched = TaskScheduler()
        proc = EbuildSpawnProcess(
-               background=False,
-               args=mystring, env=env,
+               background=False, args=mystring,
                scheduler=sched.sched_iface, spawn_func=spawn_func,
                settings=mysettings, **keywords)