Gentoo Archives: gentoo-portage-dev

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