* [gentoo-portage-dev] [PATCH] elog mod_echo: Print log path if PORT_LOGDIR is used
@ 2017-08-16 10:10 Michał Górny
2017-08-16 16:12 ` Brian Dolbec
0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2017-08-16 10:10 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
Include the path to the log file if PORT_LOGDIR is being used
(and therefore the log is going to be preserved past the build). This is
useful when elog messages contain QA warnings or other errors that
require reporting a bug. In such case, having a path to the log is
handy.
After this commit, the mod_echo output becomes:
* Messages for package dev-foo/bar-1:
* Log file: /var/log/portage/dev-foo:bar-1:20170816-100533.log
* test
---
pym/portage/elog/mod_echo.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/pym/portage/elog/mod_echo.py b/pym/portage/elog/mod_echo.py
index f9cc53788..bb34a1e44 100644
--- a/pym/portage/elog/mod_echo.py
+++ b/pym/portage/elog/mod_echo.py
@@ -1,5 +1,5 @@
# elog/mod_echo.py - elog dispatch module
-# Copyright 2007-2014 Gentoo Foundation
+# Copyright 2007-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
@@ -16,7 +16,12 @@ if sys.hexversion >= 0x3000000:
_items = []
def process(mysettings, key, logentries, fulltext):
global _items
- _items.append((mysettings["ROOT"], key, logentries))
+ logfile = None
+ # output logfile explicitly only if it isn't in tempdir, otherwise
+ # it will be removed anyway
+ if "PORT_LOGDIR" in mysettings:
+ logfile = mysettings["PORTAGE_LOG_FILE"]
+ _items.append((mysettings["ROOT"], key, logentries, logfile))
def finalize():
# For consistency, send all message types to stdout.
@@ -34,7 +39,7 @@ def finalize():
def _finalize():
global _items
printer = EOutput()
- for root, key, logentries in _items:
+ for root, key, logentries, logfile in _items:
print()
if root == "/":
printer.einfo(_("Messages for package %s:") %
@@ -42,6 +47,8 @@ def _finalize():
else:
printer.einfo(_("Messages for package %(pkg)s merged to %(root)s:") %
{"pkg": colorize("INFORM", key), "root": root})
+ if logfile is not None:
+ printer.einfo(_("Log file: %s") % colorize("INFORM", logfile))
print()
for phase in EBUILD_PHASES:
if phase not in logentries:
--
2.14.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] elog mod_echo: Print log path if PORT_LOGDIR is used
2017-08-16 10:10 [gentoo-portage-dev] [PATCH] elog mod_echo: Print log path if PORT_LOGDIR is used Michał Górny
@ 2017-08-16 16:12 ` Brian Dolbec
2017-08-17 7:30 ` Michał Górny
0 siblings, 1 reply; 3+ messages in thread
From: Brian Dolbec @ 2017-08-16 16:12 UTC (permalink / raw
To: gentoo-portage-dev
On Wed, 16 Aug 2017 12:10:52 +0200
Michał Górny <mgorny@gentoo.org> wrote:
> Include the path to the log file if PORT_LOGDIR is being used
> (and therefore the log is going to be preserved past the build). This
> is useful when elog messages contain QA warnings or other errors that
> require reporting a bug. In such case, having a path to the log is
> handy.
>
> After this commit, the mod_echo output becomes:
>
> * Messages for package dev-foo/bar-1:
> * Log file: /var/log/portage/dev-foo:bar-1:20170816-100533.log
>
> * test
> ---
> pym/portage/elog/mod_echo.py | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/pym/portage/elog/mod_echo.py
> b/pym/portage/elog/mod_echo.py index f9cc53788..bb34a1e44 100644
> --- a/pym/portage/elog/mod_echo.py
> +++ b/pym/portage/elog/mod_echo.py
> @@ -1,5 +1,5 @@
> # elog/mod_echo.py - elog dispatch module
> -# Copyright 2007-2014 Gentoo Foundation
> +# Copyright 2007-2017 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
>
> from __future__ import print_function
> @@ -16,7 +16,12 @@ if sys.hexversion >= 0x3000000:
> _items = []
> def process(mysettings, key, logentries, fulltext):
> global _items
> - _items.append((mysettings["ROOT"], key, logentries))
> + logfile = None
> + # output logfile explicitly only if it isn't in tempdir,
> otherwise
> + # it will be removed anyway
> + if "PORT_LOGDIR" in mysettings:
> + logfile = mysettings["PORTAGE_LOG_FILE"]
> + _items.append((mysettings["ROOT"], key, logentries, logfile))
>
> def finalize():
> # For consistency, send all message types to stdout.
> @@ -34,7 +39,7 @@ def finalize():
> def _finalize():
> global _items
> printer = EOutput()
> - for root, key, logentries in _items:
> + for root, key, logentries, logfile in _items:
> print()
> if root == "/":
> printer.einfo(_("Messages for package %s:") %
> @@ -42,6 +47,8 @@ def _finalize():
> else:
> printer.einfo(_("Messages for package
> %(pkg)s merged to %(root)s:") % {"pkg": colorize("INFORM", key),
> "root": root})
> + if logfile is not None:
> + printer.einfo(_("Log file: %s") %
> colorize("INFORM", logfile)) print()
> for phase in EBUILD_PHASES:
> if phase not in logentries:
Looks good to me :)
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] elog mod_echo: Print log path if PORT_LOGDIR is used
2017-08-16 16:12 ` Brian Dolbec
@ 2017-08-17 7:30 ` Michał Górny
0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2017-08-17 7:30 UTC (permalink / raw
To: gentoo-portage-dev
W dniu śro, 16.08.2017 o godzinie 09∶12 -0700, użytkownik Brian Dolbec
napisał:
> On Wed, 16 Aug 2017 12:10:52 +0200
> Michał Górny <mgorny@gentoo.org> wrote:
>
> > Include the path to the log file if PORT_LOGDIR is being used
> > (and therefore the log is going to be preserved past the build). This
> > is useful when elog messages contain QA warnings or other errors that
> > require reporting a bug. In such case, having a path to the log is
> > handy.
> >
> > After this commit, the mod_echo output becomes:
> >
> > * Messages for package dev-foo/bar-1:
> > * Log file: /var/log/portage/dev-foo:bar-1:20170816-100533.log
> >
> > * test
> > ---
> > pym/portage/elog/mod_echo.py | 13 ++++++++++---
> > 1 file changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/pym/portage/elog/mod_echo.py
> > b/pym/portage/elog/mod_echo.py index f9cc53788..bb34a1e44 100644
> > --- a/pym/portage/elog/mod_echo.py
> > +++ b/pym/portage/elog/mod_echo.py
> > @@ -1,5 +1,5 @@
> > # elog/mod_echo.py - elog dispatch module
> > -# Copyright 2007-2014 Gentoo Foundation
> > +# Copyright 2007-2017 Gentoo Foundation
> > # Distributed under the terms of the GNU General Public License v2
> >
> > from __future__ import print_function
> > @@ -16,7 +16,12 @@ if sys.hexversion >= 0x3000000:
> > _items = []
> > def process(mysettings, key, logentries, fulltext):
> > global _items
> > - _items.append((mysettings["ROOT"], key, logentries))
> > + logfile = None
> > + # output logfile explicitly only if it isn't in tempdir,
> > otherwise
> > + # it will be removed anyway
> > + if "PORT_LOGDIR" in mysettings:
> > + logfile = mysettings["PORTAGE_LOG_FILE"]
> > + _items.append((mysettings["ROOT"], key, logentries, logfile))
> >
> > def finalize():
> > # For consistency, send all message types to stdout.
> > @@ -34,7 +39,7 @@ def finalize():
> > def _finalize():
> > global _items
> > printer = EOutput()
> > - for root, key, logentries in _items:
> > + for root, key, logentries, logfile in _items:
> > print()
> > if root == "/":
> > printer.einfo(_("Messages for package %s:") %
> > @@ -42,6 +47,8 @@ def _finalize():
> > else:
> > printer.einfo(_("Messages for package
> > %(pkg)s merged to %(root)s:") % {"pkg": colorize("INFORM", key),
> > "root": root})
> > + if logfile is not None:
> > + printer.einfo(_("Log file: %s") %
> > colorize("INFORM", logfile)) print()
> > for phase in EBUILD_PHASES:
> > if phase not in logentries:
>
>
> Looks good to me :)
>
Merged.
--
Best regards,
Michał Górny
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-17 7:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-16 10:10 [gentoo-portage-dev] [PATCH] elog mod_echo: Print log path if PORT_LOGDIR is used Michał Górny
2017-08-16 16:12 ` Brian Dolbec
2017-08-17 7:30 ` Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox