Bug 533832

Summary: [RFE] --machine-log option or equivalent
Product: [Fedora] Fedora Reporter: Denys Vlasenko <dvlasenk>
Component: yumAssignee: Seth Vidal <skvidal>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: ffesti, james.antill, maxamillion, pmatilai, tim.lauridsen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-11-09 14:41:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Denys Vlasenko 2009-11-09 13:35:52 UTC
I run yum and analyze its output by a script.

Its output currently is mostly intended for humans. --quiet suppresses some messages, but remaining ones are not changed (IOW, if they were machine-unfriendly, they stay machine-unfriendly).

Example:

# yum provides /bin/sleep
coreutils-7.2-1.fc11.x86_64 : A set of basic GNU tools commonly used in shell scripts
Repo        : distro1
Matched from:
Filename    : /bin/sleep



coreutils-7.2-4.fc11.x86_64 : A set of basic GNU tools commonly used in shell scripts
Repo        : updates
Matched from:
Filename    : /bin/sleep



...
...

The above is not too bad, if yum guarantees that the format is stable (e.g. that I can always find package name followed by exactly " : "). Does it? If not, then I'd prefer an option where yum uses machine-oriented and stable format. Perhaps:

package: coreutils-7.2-4.fc11.x86_64
description: A set of basic GNU tools commonly used in shell scripts
(^^^^ say, with newlines encoded as %0D or something)
repo: updates
...


Next example.

# yum clean all
# yum provides /bin/sleep
Loaded plugins: refresh-packagekit
fedora/metalink                                         |  17 kB     00:00     
fedora                                                  | 3.8 kB     00:00     
fedora/primary_db             4% [==-        ] 159 kB/s | 440 kB     01:04 ETA 
...

This is rather bad. Progress bar output is nearly impossible to parse. Ok, this can be suppressed by giving yum a non-tty stdout for output:

# yum clean all
# yum provides /bin/sleep | cat
Loaded plugins: refresh-packagekit
    (nothing happens for a long time)
coreutils-7.2-1.fc11.x86_64 : A set of basic GNU tools commonly used in shell
                            : scripts
Repo        : distro1
Matched from:
Filename    : /bin/sleep
....

This is better. I'd like some sort of progress report in order to pipe it to my users (otherwise users are complaining that "installation hung"), I just need it in the line-by-line update suitable for machine consumption. Something like:

fedora/metalink 100% 17 kB
fedora 100% 3 kB
fedora/primary_db 3% 440 kB
fedora/primary_db 6% 440 kB <-- new line every few seconds
...

One can observe similar behavior of yumdownloader. Try:
# yumdownloader coreutils-7.2-4.fc11.x86_64
 and
# yumdownloader coreutils-7.2-4.fc11.x86_64 | cat


Is it possible to add a --machine-log option to yum and yumdownloader to improve this situation?

Comment 1 James Antill 2009-11-09 14:41:25 UTC
Seth recently created:

http://skvidal.fedorapeople.org/misc/yumpipes.py

...not sure if he's planning on getting that into a package or not.

Comment 2 seth vidal 2009-11-09 14:46:52 UTC
I'm debating it. It would be handy for various odd situations.


I think it may end up in yum-utils.

Comment 3 Denys Vlasenko 2010-01-05 10:40:24 UTC
bug 548148 is nearly impossible to close without such feature. Failure scenario:

"yum --enablerepo=*debuginfo* --quiet provides
/usr/lib/debug/.build-id/60/e56607981d360f5b92a876477ce224f4125529.debug ..." is stuck for 10+ minutes with no way to know why, what to do?