Bug 728049

Summary: Add a way to set column width in yum
Product: [Fedora] Fedora Reporter: G. Michael Carter <mikey>
Component: yumAssignee: Seth Vidal <skvidal>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: ffesti, james.antill, maxamillion, pmatilai, tim.lauridsen, zpavlas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-04 19:18:36 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 G. Michael Carter 2011-08-04 02:17:06 UTC
Can we add:

import os

def _term_width():
    """ Simple terminal width, limit to 20 chars. and make 0 == 80. """
    if not hasattr(urlgrabber.progress, 'terminal_width_cached'):
        return 80
    ret = urlgrabber.progress.terminal_width_cached()
    if ret == 0:
        return 80
    if ret < 20:
        return 20
+    if os.environ.get("YUM_WIDTH") > 0:
+        return int(os.environ.get("YUM_WIDTH"))
    return ret


To the /usr/share/yum-cli/output.py file.

When I do yum list > /tmp/yum_mylist.list  the column width goes to 80.  I want to be able to set it.

I'm not a python programmer so the above was just a quick hack.

Comment 1 James Antill 2011-08-04 19:18:36 UTC
 You almost certainly want to use:

repoquery --installed -a --qf '%{ui_nevra} %{ui_from_repo}'

...instead of grepping yum output.