From 46696a844b7590c6698e4369bb2824f1c8bd3d7e Mon Sep 17 00:00:00 2001 From: Shad L. Lords Date: Mon, 26 Oct 2009 19:02:53 -0600 Subject: [PATCH] Display NEVRA when installing/upgrading packages --- packages.py | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages.py b/packages.py index 398d6c0..629b04b 100644 --- a/packages.py +++ b/packages.py @@ -19,6 +19,7 @@ import iutil import isys import rpm +import hdrlist import os import timer import time @@ -400,10 +401,7 @@ class InstallCallback: self.progress.setPackage(h) self.progress.setPackageScale(0, 1) - self.instLog.write (self.modeText % (h[rpm.RPMTAG_NAME], - h[rpm.RPMTAG_VERSION], - h[rpm.RPMTAG_RELEASE], - h[rpm.RPMTAG_ARCH])) + self.instLog.write (self.modeText % (hdrlist.nevra(h))) self.instLog.flush () self.rpmFD = -1 @@ -1002,9 +1000,9 @@ def doInstall(method, id, intf, instPath): # dup'd when we go out of scope if upgrade: - modeText = _("Upgrading %s-%s-%s.%s.\n") + modeText = _("Upgrading %s.\n") else: - modeText = _("Installing %s-%s-%s.%s.\n") + modeText = _("Installing %s.\n") log ("getting rpm error class") errors = rpmErrorClass(instLog) @@ -1304,13 +1302,10 @@ def doPostInstall(method, id, intf, instPath): h = ts.hdrFromFdno(fd) os.close(fd) if upgrade: - text = _("Upgrading %s-%s-%s.%s.\n") + text = _("Upgrading %s.\n") else: - text = _("Installing %s-%s-%s.%s.\n") - instLog.write(text % (h['name'], - h['version'], - h['release'], - h['arch'])) + text = _("Installing %s.\n") + instLog.write(text % (hdrlist.nevra(h))) os.unlink(id.compspkg) del ts @@ -1336,14 +1331,19 @@ def doPostInstall(method, id, intf, instPath): instLog.write(_("\n\nThe following packages were available in " "this version but NOT installed:\n")) + ts = rpm.TransactionSet(instPath) + ts.setVSFlags(~(rpm.RPMVSF_NORSA|rpm.RPMVSF_NODSA)) + lines = [] for p in id.grpset.hdrlist.values(): if not p.isSelected(): - lines.append("%s-%s-%s.%s.rpm\n" % - (p.hdr[rpm.RPMTAG_NAME], - p.hdr[rpm.RPMTAG_VERSION], - p.hdr[rpm.RPMTAG_RELEASE], - p.hdr[rpm.RPMTAG_ARCH])) + text = "%s" % (hdrlist.nevra(p)) + for f in ts.dbMatch('name', p.hdr[rpm.RPMTAG_NAME]): + if hdrlist.nevra(p) == hdrlist.nevra(f): + text = "%s (already installed)" % (text) + else: + text = "%s (%s installed)" % (text, hdrlist.nevra(f)) + lines.append("%s\n" % text) lines.sort() for line in lines: instLog.write(line) -- 1.5.5.6