Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] elog mod_echo: Print log path if PORT_LOGDIR is used
Date: Wed, 16 Aug 2017 16:30:43
Message-Id: 20170816091131.505cfbd8@professor-x
In Reply to: [gentoo-portage-dev] [PATCH] elog mod_echo: Print log path if PORT_LOGDIR is used by "Michał Górny"
1 On Wed, 16 Aug 2017 12:10:52 +0200
2 Michał Górny <mgorny@g.o> wrote:
3
4 > Include the path to the log file if PORT_LOGDIR is being used
5 > (and therefore the log is going to be preserved past the build). This
6 > is useful when elog messages contain QA warnings or other errors that
7 > require reporting a bug. In such case, having a path to the log is
8 > handy.
9 >
10 > After this commit, the mod_echo output becomes:
11 >
12 > * Messages for package dev-foo/bar-1:
13 > * Log file: /var/log/portage/dev-foo:bar-1:20170816-100533.log
14 >
15 > * test
16 > ---
17 > pym/portage/elog/mod_echo.py | 13 ++++++++++---
18 > 1 file changed, 10 insertions(+), 3 deletions(-)
19 >
20 > diff --git a/pym/portage/elog/mod_echo.py
21 > b/pym/portage/elog/mod_echo.py index f9cc53788..bb34a1e44 100644
22 > --- a/pym/portage/elog/mod_echo.py
23 > +++ b/pym/portage/elog/mod_echo.py
24 > @@ -1,5 +1,5 @@
25 > # elog/mod_echo.py - elog dispatch module
26 > -# Copyright 2007-2014 Gentoo Foundation
27 > +# Copyright 2007-2017 Gentoo Foundation
28 > # Distributed under the terms of the GNU General Public License v2
29 >
30 > from __future__ import print_function
31 > @@ -16,7 +16,12 @@ if sys.hexversion >= 0x3000000:
32 > _items = []
33 > def process(mysettings, key, logentries, fulltext):
34 > global _items
35 > - _items.append((mysettings["ROOT"], key, logentries))
36 > + logfile = None
37 > + # output logfile explicitly only if it isn't in tempdir,
38 > otherwise
39 > + # it will be removed anyway
40 > + if "PORT_LOGDIR" in mysettings:
41 > + logfile = mysettings["PORTAGE_LOG_FILE"]
42 > + _items.append((mysettings["ROOT"], key, logentries, logfile))
43 >
44 > def finalize():
45 > # For consistency, send all message types to stdout.
46 > @@ -34,7 +39,7 @@ def finalize():
47 > def _finalize():
48 > global _items
49 > printer = EOutput()
50 > - for root, key, logentries in _items:
51 > + for root, key, logentries, logfile in _items:
52 > print()
53 > if root == "/":
54 > printer.einfo(_("Messages for package %s:") %
55 > @@ -42,6 +47,8 @@ def _finalize():
56 > else:
57 > printer.einfo(_("Messages for package
58 > %(pkg)s merged to %(root)s:") % {"pkg": colorize("INFORM", key),
59 > "root": root})
60 > + if logfile is not None:
61 > + printer.einfo(_("Log file: %s") %
62 > colorize("INFORM", logfile)) print()
63 > for phase in EBUILD_PHASES:
64 > if phase not in logentries:
65
66
67 Looks good to me :)
68
69 --
70 Brian Dolbec <dolsen>

Replies