commit:     fc69af818c5208ef153ca0c41ac8784afba7e30e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  9 18:57:02 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct  9 19:05:38 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fc69af81

elog mod_echo: fix PORTAGE_LOG_FILE KeyError (bug 633842)

In some cases such as Scheduler._calc_resume_list, the
elog_process function can be called when mysettings is
not in a suitable state to use the PORTAGE_LOG_FILE
variable.

Fixes: a62ebb4a2f75 ("elog mod_echo: Print log path if PORT_LOGDIR is used")
Bug: https://bugs.gentoo.org/show_bug.cgi?id=633842

 pym/portage/elog/mod_echo.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/portage/elog/mod_echo.py b/pym/portage/elog/mod_echo.py
index bb34a1e44..fb86547a4 100644
--- a/pym/portage/elog/mod_echo.py
+++ b/pym/portage/elog/mod_echo.py
@@ -19,7 +19,9 @@ def process(mysettings, key, logentries, fulltext):
        logfile = None
        # output logfile explicitly only if it isn't in tempdir, otherwise
        # it will be removed anyway
-       if "PORT_LOGDIR" in mysettings:
+       if (key == mysettings.mycpv and
+               "PORT_LOGDIR" in mysettings and
+               "PORTAGE_LOG_FILE" in mysettings):
                logfile = mysettings["PORTAGE_LOG_FILE"]
        _items.append((mysettings["ROOT"], key, logentries, logfile))
 

Reply via email to