commit:     ff27e63569297dcd8b459e7ee255d4335e9f9105
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 22 21:13:11 2022 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Fri Apr 22 21:20:32 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ff27e635

MiscFunctionsProcess: use a separate SANDBOX_LOG

This avoids clobbering the main sandbox.log file when
"misc-functions.sh die_hooks" is invoked after an ebuild phase.

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 lib/_emerge/MiscFunctionsProcess.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/_emerge/MiscFunctionsProcess.py 
b/lib/_emerge/MiscFunctionsProcess.py
index 7a7b1f5ac..16fd08222 100644
--- a/lib/_emerge/MiscFunctionsProcess.py
+++ b/lib/_emerge/MiscFunctionsProcess.py
@@ -48,9 +48,20 @@ class MiscFunctionsProcess(AbstractEbuildProcess):
         # Temporarily unset EBUILD_PHASE so that bashrc code doesn't
         # think this is a real phase.
         phase_backup = self.settings.pop("EBUILD_PHASE", None)
+
+        # Use a separate sandbox log file to avoid clobbering the real one.
+        sandbox_log = self.settings.pop("SANDBOX_LOG", None)
+        if sandbox_log is not None:
+            self.settings["SANDBOX_LOG"] = os.path.join(
+                self.settings["T"], "sandbox-misc.log"
+            )
+
         try:
             return spawn(" ".join(args), self.settings, **kwargs)
         finally:
             if phase_backup is not None:
                 self.settings["EBUILD_PHASE"] = phase_backup
             self.settings.pop("PORTAGE_PIPE_FD", None)
+            self.settings.pop("SANDBOX_LOG", None)
+            if sandbox_log is not None:
+                self.settings["SANDBOX_LOG"] = sandbox_log

Reply via email to