Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 455096

Summary: add %{INSTALLTIME:date} to the --qf flags when collecting installed-rpms
Product: Red Hat Enterprise Linux 5 Reporter: Chris Marcantonio <cmarcant>
Component: sosAssignee: Adam Stokes <astokes>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.2CC: agk, azelinka, bmr, syeghiay
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-20 21:42:23 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:
Bug Depends On:    
Bug Blocks: 455280, 455920    

Description Chris Marcantonio 2008-07-11 22:16:05 UTC
Description of problem:

Sosreport currently collects installed-rpms using --qf to collect full
information about package name, version, release, and arch.  It would seem
useful in certain cases to be able to see the install date for each package and
is a minimally invasive change to simply include %{INSTALLTIME:date} in the list
of flags to collect.

The only unfortunate outcome of adding this is that it makes the raw output from
the rpm command a bit ugly, so piping to awk to clean up the output seems to be
the best solution.

Sample output looks like this:

termcap-5.5-1.20060701.1-noarch                             Mon 31 Mar 2008
05:23:37 PM EDT
libjpeg-6b-37-x86_64                                        Mon 31 Mar 2008
05:23:54 PM EDT
gawk-3.1.5-14.el5-x86_64                                    Mon 31 Mar 2008
05:24:02 PM EDT
libgpg-error-1.4-2-x86_64                                   Mon 31 Mar 2008
05:24:06 PM EDT
libcap-1.10-26-x86_64                                       Mon 31 Mar 2008
05:24:07 PM EDT
gdbm-1.8.0-26.2.1-x86_64                                    Mon 31 Mar 2008
05:24:24 PM EDT
libieee1284-0.2.9-4.el5-x86_64                              Mon 31 Mar 2008
05:24:30 PM EDT
gamin-0.1.7-8.el5-x86_64                                    Mon 31 Mar 2008
05:24:31 PM EDT
mkisofs-2.01-10-x86_64                                      Mon 31 Mar 2008
05:24:32 PM EDT
libmng-1.0.9-5.1-x86_64                                     Mon 31 Mar 2008
05:24:36 PM EDT
less-394-5.el5-x86_64                                       Mon 31 Mar 2008
05:24:37 PM EDT
libsysfs-2.0.0-6-x86_64                                     Mon 31 Mar 2008
05:24:40 PM EDT
cdparanoia-alpha9.8-27.2-x86_64                             Mon 31 Mar 2008
05:24:41 PM EDT

...and so on.


My change (on sos-1.7-9.2.el5) looks something like this:

--- /usr/lib/python2.4/site-packages/sos/plugins/rpm.py.ORIG    2008-07-10
18:01:07.000000000 -0400
+++ /usr/lib/python2.4/site-packages/sos/plugins/rpm.py 2008-07-11
18:09:52.000000000 -0400
@@ -24,7 +24,7 @@
         self.addCopySpec("/var/log/rpmpkgs")

         if self.isOptionEnabled("rpmq"):
-          self.collectExtOutput("/bin/rpm -qa --qf
\"%{NAME}-%{VERSION}-%{RELEASE}-%{ARCH}\n\"", root_symlink = "installed-rpms")
+          self.collectExtOutput("/bin/rpm -qa
--qf=\"%{NAME}-%{VERSION}-%{RELEASE}-%{ARCH}~~%{INSTALLTIME:date}\n\"|/bin/awk
-F ~~ '{printf \"%-60s%s\\n\",$1,$2}'", root_symlink = "installed-rpms")

         if self.isOptionEnabled("rpmva"):
           self.eta_weight += 800 # this plugins takes 200x longer (for ETA)

Comment 1 Chris Marcantonio 2008-07-11 22:24:13 UTC
Of course, the line wrap in the comment above makes the output look a bit ugly,
which is the only downside I see to the proposed change.  With a sufficiently
wide display, the output cleans up nicely.  In its current form, output is about
91 characters wide...we can certainly adjust the field widths in the awk to make
it fit smaller screens a bit better, if need be. (with the only risk being
collisions of the first field into the second with a sufficiently long rpm name)

Comment 2 RHEL Program Management 2008-07-14 17:02:42 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 9 errata-xmlrpc 2009-01-20 21:42:23 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0171.html