From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/_emerge/
Date: Fri, 25 Mar 2011 04:34:33 +0000 (UTC) [thread overview]
Message-ID: <3081e651fc3cd3a0729bb1fbe2e93fbc58dcef0d.zmedico@gentoo> (raw)
commit: 3081e651fc3cd3a0729bb1fbe2e93fbc58dcef0d
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 25 04:32:38 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 25 04:32:38 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3081e651
MergeProcess: Fix PORTAGE_BACKGROUND/LOG_FILE use
In this subprocess we don't want PORTAGE_BACKGROUND to suppress
stdout/stderr output since they are pipes. We also don't want to open
PORTAGE_LOG_FILE, since it will already be opened by the parent
process, so we set the PORTAGE_BACKGROUND="subprocess" value for use
in conditional logging code involving PORTAGE_LOG_FILE.
---
pym/_emerge/AbstractEbuildProcess.py | 6 ++++--
pym/_emerge/EbuildPhase.py | 29 ++++++++++++++++++-----------
pym/_emerge/MiscFunctionsProcess.py | 3 ++-
pym/portage/dbapi/_MergeProcess.py | 9 +++++++++
4 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
index d7f31be..39c613b 100644
--- a/pym/_emerge/AbstractEbuildProcess.py
+++ b/pym/_emerge/AbstractEbuildProcess.py
@@ -225,8 +225,10 @@ class AbstractEbuildProcess(SpawnProcess):
msg = _unicode_decode(out.getvalue(),
encoding=_encodings['content'], errors='replace')
if msg:
- self.scheduler.output(msg,
- log_path=self.settings.get("PORTAGE_LOG_FILE"))
+ log_path = None
+ if self.settings.get("PORTAGE_BACKGROUND") != "subprocess":
+ log_path = self.settings.get("PORTAGE_LOG_FILE")
+ self.scheduler.output(msg, log_path=log_path)
def _log_poll_exception(self, event):
self._elog("eerror",
diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py
index e3270c8..a24608b 100644
--- a/pym/_emerge/EbuildPhase.py
+++ b/pym/_emerge/EbuildPhase.py
@@ -121,9 +121,10 @@ class EbuildPhase(CompositeTask):
# 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
# prevents the clean phase from removing $T.
- logfile = self.settings.get("PORTAGE_LOG_FILE")
- if self.phase in ("clean", "cleanrm"):
- logfile = None
+ logfile = None
+ if self.phase not in ("clean", "cleanrm") and \
+ self.settings.get("PORTAGE_BACKGROUND") != "subprocess":
+ logfile = self.settings.get("PORTAGE_LOG_FILE")
fd_pipes = None
if not self.background and self.phase == 'nofetch':
@@ -151,13 +152,16 @@ class EbuildPhase(CompositeTask):
if not fail:
self.returncode = None
+ logfile = None
+ if self.settings.get("PORTAGE_BACKGROUND") != "subprocess":
+ logfile = self.settings.get("PORTAGE_LOG_FILE")
+
if self.phase == "install":
out = portage.StringIO()
_check_build_log(self.settings, out=out)
msg = _unicode_decode(out.getvalue(),
encoding=_encodings['content'], errors='replace')
- self.scheduler.output(msg,
- log_path=self.settings.get("PORTAGE_LOG_FILE"))
+ self.scheduler.output(msg, log_path=logfile)
if fail:
self._die_hooks()
@@ -173,12 +177,10 @@ class EbuildPhase(CompositeTask):
msg = _unicode_decode(out.getvalue(),
encoding=_encodings['content'], errors='replace')
if msg:
- self.scheduler.output(msg,
- log_path=self.settings.get("PORTAGE_LOG_FILE"))
+ self.scheduler.output(msg, log_path=logfile)
post_phase_cmds = _post_phase_cmds.get(self.phase)
if post_phase_cmds is not None:
- logfile = settings.get("PORTAGE_LOG_FILE")
if logfile is not None and self.phase in ("install",):
# Log to a temporary file, since the code we are running
# reads PORTAGE_LOG_FILE for QA checks, and we want to
@@ -204,7 +206,10 @@ class EbuildPhase(CompositeTask):
self._assert_current(post_phase)
- log_path = self.settings.get("PORTAGE_LOG_FILE")
+ log_path = None
+ if self.settings.get("PORTAGE_BACKGROUND") != "subprocess":
+ log_path = self.settings.get("PORTAGE_LOG_FILE")
+
if post_phase.logfile is not None and \
post_phase.logfile != log_path:
# We were logging to a temp file (see above), so append
@@ -293,5 +298,7 @@ class EbuildPhase(CompositeTask):
msg = _unicode_decode(out.getvalue(),
encoding=_encodings['content'], errors='replace')
if msg:
- self.scheduler.output(msg,
- log_path=self.settings.get("PORTAGE_LOG_FILE"))
+ log_path = None
+ if self.settings.get("PORTAGE_BACKGROUND") != "subprocess":
+ log_path = self.settings.get("PORTAGE_LOG_FILE")
+ self.scheduler.output(msg, log_path=log_path)
diff --git a/pym/_emerge/MiscFunctionsProcess.py b/pym/_emerge/MiscFunctionsProcess.py
index ad8cefc..e6bb103 100644
--- a/pym/_emerge/MiscFunctionsProcess.py
+++ b/pym/_emerge/MiscFunctionsProcess.py
@@ -22,7 +22,8 @@ class MiscFunctionsProcess(AbstractEbuildProcess):
os.path.basename(portage.const.MISC_SH_BINARY))
self.args = [portage._shell_quote(misc_sh_binary)] + self.commands
- if self.logfile is None:
+ if self.logfile is None and \
+ self.settings.get("PORTAGE_BACKGROUND") != "subprocess":
self.logfile = settings.get("PORTAGE_LOG_FILE")
AbstractEbuildProcess._start(self)
diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py
index 6e63f84..a8c3c9d 100644
--- a/pym/portage/dbapi/_MergeProcess.py
+++ b/pym/portage/dbapi/_MergeProcess.py
@@ -85,6 +85,15 @@ class MergeProcess(SpawnProcess):
# is triggered when mylink._scheduler is None.
mylink._scheduler = None
+ # In this subprocess we don't want PORTAGE_BACKGROUND to
+ # suppress stdout/stderr output since they are pipes. We
+ # also don't want to open PORTAGE_LOG_FILE, since it will
+ # already be opened by the parent process, so we set the
+ # "subprocess" value for use in conditional logging code
+ # involving PORTAGE_LOG_FILE.
+ self.settings["PORTAGE_BACKGROUND"] = "subprocess"
+ self.settings.backup_changes("PORTAGE_BACKGROUND")
+
rval = 1
try:
rval = mylink.merge(self.pkgloc, self.infloc,
next reply other threads:[~2011-03-25 4:34 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 4:34 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-04-03 20:03 [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/_emerge/ Zac Medico
2015-08-30 23:44 Zac Medico
2014-11-20 4:08 Zac Medico
2014-02-24 9:23 Alexander Berntsen
2013-03-13 5:56 Zac Medico
2013-01-23 16:19 Zac Medico
2013-01-05 15:20 Zac Medico
2012-12-23 5:33 Arfrever Frehtes Taifersar Arahesis
2012-11-24 21:57 Zac Medico
2012-04-22 18:57 Zac Medico
2012-04-21 6:51 Zac Medico
2012-02-17 22:19 Zac Medico
2012-02-16 0:33 Zac Medico
2012-02-14 23:40 Zac Medico
2012-02-10 1:28 Zac Medico
2012-02-08 1:16 Zac Medico
2012-02-08 0:36 Zac Medico
2011-10-28 2:34 Zac Medico
2011-10-16 20:26 Zac Medico
2011-10-15 5:10 Zac Medico
2011-06-03 10:16 Zac Medico
2011-05-24 5:31 Zac Medico
2011-05-24 0:33 Zac Medico
2011-05-09 5:16 Zac Medico
2011-03-26 7:39 Zac Medico
2011-03-26 3:24 Zac Medico
2011-03-25 4:34 Zac Medico
2011-03-25 4:34 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3081e651fc3cd3a0729bb1fbe2e93fbc58dcef0d.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox