From 553c12294d16a652109d14a43ce4fdf7bc73ebea Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 14 Aug 2010 08:25:45 -0700 Subject: [PATCH] Fix EbuildSpawnProcess to use self.settings.environ() for the spawn environment, so all AbstractEbuildProcess subclasses are consistent in this way. --- pym/_emerge/AbstractEbuildProcess.py | 9 ++------- pym/_emerge/EbuildSpawnProcess.py | 2 +- pym/portage/package/ebuild/doebuild.py | 23 +++++++++-------------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py index 138430670..416babcfb 100644 --- a/pym/_emerge/AbstractEbuildProcess.py +++ b/pym/_emerge/AbstractEbuildProcess.py @@ -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) diff --git a/pym/_emerge/EbuildSpawnProcess.py b/pym/_emerge/EbuildSpawnProcess.py index d8087576a..dd12b74e9 100644 --- a/pym/_emerge/EbuildSpawnProcess.py +++ b/pym/_emerge/EbuildSpawnProcess.py @@ -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) diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 7405b6f12..e85785528 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -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) -- 2.26.2