1 |
From 46696a844b7590c6698e4369bb2824f1c8bd3d7e Mon Sep 17 00:00:00 2001 |
2 |
From: Shad L. Lords <slords@mail.com> |
3 |
Date: Mon, 26 Oct 2009 19:02:53 -0600 |
4 |
Subject: [PATCH] Display NEVRA when installing/upgrading packages |
5 |
|
6 |
--- |
7 |
packages.py | 34 +++++++++++++++++----------------- |
8 |
1 files changed, 17 insertions(+), 17 deletions(-) |
9 |
|
10 |
diff --git a/packages.py b/packages.py |
11 |
index 398d6c0..629b04b 100644 |
12 |
--- a/packages.py |
13 |
+++ b/packages.py |
14 |
@@ -19,6 +19,7 @@ |
15 |
import iutil |
16 |
import isys |
17 |
import rpm |
18 |
+import hdrlist |
19 |
import os |
20 |
import timer |
21 |
import time |
22 |
@@ -400,10 +401,7 @@ class InstallCallback: |
23 |
|
24 |
self.progress.setPackage(h) |
25 |
self.progress.setPackageScale(0, 1) |
26 |
- self.instLog.write (self.modeText % (h[rpm.RPMTAG_NAME], |
27 |
- h[rpm.RPMTAG_VERSION], |
28 |
- h[rpm.RPMTAG_RELEASE], |
29 |
- h[rpm.RPMTAG_ARCH])) |
30 |
+ self.instLog.write (self.modeText % (hdrlist.nevra(h))) |
31 |
self.instLog.flush () |
32 |
|
33 |
self.rpmFD = -1 |
34 |
@@ -1002,9 +1000,9 @@ def doInstall(method, id, intf, instPath): |
35 |
# dup'd when we go out of scope |
36 |
|
37 |
if upgrade: |
38 |
- modeText = _("Upgrading %s-%s-%s.%s.\n") |
39 |
+ modeText = _("Upgrading %s.\n") |
40 |
else: |
41 |
- modeText = _("Installing %s-%s-%s.%s.\n") |
42 |
+ modeText = _("Installing %s.\n") |
43 |
|
44 |
log ("getting rpm error class") |
45 |
errors = rpmErrorClass(instLog) |
46 |
@@ -1304,13 +1302,10 @@ def doPostInstall(method, id, intf, instPath): |
47 |
h = ts.hdrFromFdno(fd) |
48 |
os.close(fd) |
49 |
if upgrade: |
50 |
- text = _("Upgrading %s-%s-%s.%s.\n") |
51 |
+ text = _("Upgrading %s.\n") |
52 |
else: |
53 |
- text = _("Installing %s-%s-%s.%s.\n") |
54 |
- instLog.write(text % (h['name'], |
55 |
- h['version'], |
56 |
- h['release'], |
57 |
- h['arch'])) |
58 |
+ text = _("Installing %s.\n") |
59 |
+ instLog.write(text % (hdrlist.nevra(h))) |
60 |
os.unlink(id.compspkg) |
61 |
del ts |
62 |
|
63 |
@@ -1336,14 +1331,19 @@ def doPostInstall(method, id, intf, instPath): |
64 |
instLog.write(_("\n\nThe following packages were available in " |
65 |
"this version but NOT installed:\n")) |
66 |
|
67 |
+ ts = rpm.TransactionSet(instPath) |
68 |
+ ts.setVSFlags(~(rpm.RPMVSF_NORSA|rpm.RPMVSF_NODSA)) |
69 |
+ |
70 |
lines = [] |
71 |
for p in id.grpset.hdrlist.values(): |
72 |
if not p.isSelected(): |
73 |
- lines.append("%s-%s-%s.%s.rpm\n" % |
74 |
- (p.hdr[rpm.RPMTAG_NAME], |
75 |
- p.hdr[rpm.RPMTAG_VERSION], |
76 |
- p.hdr[rpm.RPMTAG_RELEASE], |
77 |
- p.hdr[rpm.RPMTAG_ARCH])) |
78 |
+ text = "%s" % (hdrlist.nevra(p)) |
79 |
+ for f in ts.dbMatch('name', p.hdr[rpm.RPMTAG_NAME]): |
80 |
+ if hdrlist.nevra(p) == hdrlist.nevra(f): |
81 |
+ text = "%s (already installed)" % (text) |
82 |
+ else: |
83 |
+ text = "%s (%s installed)" % (text, hdrlist.nevra(f)) |
84 |
+ lines.append("%s\n" % text) |
85 |
lines.sort() |
86 |
for line in lines: |
87 |
instLog.write(line) |
88 |
-- |
89 |
1.5.5.6 |
90 |
|