Bug 1327509

Summary: [rfe] colorize output (e.g., to better distinguish between standard "dnf update" content and lines spewed in the scriptlets)
Product: [Fedora] Fedora Reporter: Jan Pokorný [poki] <jpokorny>
Component: dnfAssignee: Martin Hatina <mhatina>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: rawhideCC: mhatina, mluscon, packaging-team-maint, pnemade, vmukhame
Target Milestone: ---Keywords: FutureFeature, Triaged, UserExperience
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-14 06:24:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jan Pokorný [poki] 2016-04-15 09:28:03 UTC
The lines emitted from %post et al. scriptlets may require attention
of the administrator.

Real world example (with admittedly not so important messages burried
in the surrounding lines):

# dnf update -y
> [...]
>   Cleanup     : java-1.8.0-openjdk-headless-1:1.8.0.72-1.b15.fc22.x86_64                                                                                              422/543 
> warning: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-1.b15.fc22.x86_64/jre/lib/security/local_policy.jar saved as /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-1.b15.fc22.x86_64/jre/lib/security/local_policy.jar.rpmsave
> warning: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-1.b15.fc22.x86_64/jre/lib/security/US_export_policy.jar saved as /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-1.b15.fc22.x86_64/jre/lib/security/US_export_policy.jar.rpmsave
> [...]
>   Cleanup     : acpid-2.0.23-4.fc22.x86_64                                                                                                                            543/543 
> Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]_EARLY!=y
>   Verifying   : kernel-core-4.4.6-201.fc22.x86_64                                                                                                                       1/543 
>   Verifying   : kernel-4.4.6-201.fc22.x86_64      
> [...]

Would be nice if the type of information on the line would be indicated
by different colors (or default vs. colorized) if attached to a terminal,
so a quick scan through scroll-back buffer would make it clear what may
require further investigation/intervention.

Note that parametrizing the colors for the output does not necessarily
have to be in proper dnf configuration files, there is at least a single
alternative schema (utilized by linux-utils that also introduced that):
https://github.com/karelzak/util-linux/blob/master/lib/terminal-colors.d.5
and it might be actually a good idea to standardize on that as such
settings are merely non-functional.

(for that java-1.8.0-openjdk-headless output, there's [1142153]
 ... as a reminder that packaging bugs do happen and the more blatant
 the possible signs of that are, the better)

Comment 1 Honza Silhan 2016-04-18 11:52:15 UTC
Thanks for the report

Comment 2 Fedora Admin XMLRPC Client 2016-07-08 09:26:40 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Jan Pokorný [poki] 2016-07-28 17:00:55 UTC
To follow up on this, I think I am going to write some easy parser of
files per TERMINAL_COLORS.D(5) convention for clufter[1].  But indeed,
it would be nice if there was some common library for that so if anyone
wants to beat me in this effort, I'd happily use that (if not too
bloaty and GPLv2+ license compatible).  Conversely, I'll try to write
it in a way it could be separated from clufter project if desirable.

[1] https://pagure.io/clufter (in fact, there is some colors handling
    already implemented in utils_prog.py, but in another context)

Comment 4 Martin Hatina 2017-08-14 06:24:45 UTC
Fixed by https://github.com/rpm-software-management/dnf/pull/858