[yum-cvs] yum output.py,1.53,1.54
Seth Vidal
skvidal at login.linux.duke.edu
Mon Mar 28 07:42:37 UTC 2005
Update of /home/groups/yum/cvs/yum
In directory login:/tmp/cvs-serv32221
Modified Files:
output.py
Log Message:
make listTransaction() output similar to michael favia's design at:
http://michael.insitesinc.com/mediawiki/index.php?title=Yum
slight modification to transactionInfo obsoleted pkg data to do that.
Index: output.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/output.py,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- output.py 27 Mar 2005 08:46:28 -0000 1.53
+++ output.py 28 Mar 2005 07:42:35 -0000 1.54
@@ -196,7 +196,7 @@
for item in values:
self.log(2, '%s' % item)
- def reportDownloadSize(self,packages):
+ def reportDownloadSize(self, packages):
"""Report the total download size for a set of packages"""
totsize = 0
error = False
@@ -216,58 +216,76 @@
self.log(1, "Total download size: %s" % (self.format_number(totsize)))
def listTransaction(self):
- """displays the transaction in an easy-to-read way."""
-
- out = ''
- userout = ''
- depout = ''
- otherout = ''
+ """returns a string rep of the transaction in an easy-to-read way."""
updated, installed, removed, obsoleted, depup, depinst, deprem = self.tsInfo.makelists()
+ if len(updated+installed+removed+obsoleted+depup+depinst+deprem) > 0:
+ out = """
+=============================================================================
+ %-22.22s %-9.9s %-15.15s %-16.16s %-5.5s
+=============================================================================
+""" % ('Package', 'Arch', 'Version', 'Repository', 'Size')
+ else:
+ out = ""
- for (action, pkglist) in [('Install', installed), ('Update', updated)]:
-
- for txmbr in pkglist:
- (n,a,e,v,r) = txmbr.pkgtup
- msg = " %s: %s.%s %s:%s-%s - %s\n" % (action, n,a,e,v,r, txmbr.repoid)
- userout = userout + msg
-
- for (action, pkglist) in [('Remove', removed)]:
- for txmbr in pkglist:
- (n,a,e,v,r) = txmbr.pkgtup
- msg = " %s: %s.%s %s:%s-%s\n" % (action, n,a,e,v,r)
- userout = userout + msg
-
- for (action, pkglist) in [('Install', depinst), ('Update', depup)]:
-
- for txmbr in pkglist:
- (n,a,e,v,r) = txmbr.pkgtup
- msg = " %s: %s.%s %s:%s-%s - %s\n" % (action, n,a,e,v,r, txmbr.repoid)
- depout = depout + msg
-
- for (action, pkglist) in [('Remove', deprem)]:
+ for (action, pkglist) in [('Installing', installed),
+ ('Updating', updated),
+ ('Removing', removed),
+ ('Installing for dependencies', depinst),
+ ('Updating for dependencies', depup),
+ ('Removing for dependencies', deprem)]:
+ if pkglist:
+ totalmsg = "%s:\n" % action
for txmbr in pkglist:
(n,a,e,v,r) = txmbr.pkgtup
- msg = " %s: %s.%s %s:%s-%s\n" % (action, n,a,e,v,r)
- depout = depout + msg
-
+ evr = txmbr.po.printVer()
+ repoid = txmbr.repoid
+ pkgsize = float(txmbr.po.size())
+ size = self.format_number(pkgsize)
+ msg = " %-22.22s %-9.9s %-15.15s %-16.16s %5.5s\n" % (n, a,
+ evr, repoid, size)
+ totalmsg = totalmsg + msg
+
+ if pkglist:
+ out = out + totalmsg
+
+ obs = """
+Other Actions:
+=============================================================================
+Obsoletes:
+"""
for txmbr in obsoleted:
(n,a,e,v,r) = txmbr.pkgtup
obspkg = None
- for (pkg, relationship) in txmbr.relatedto:
+ evr = txmbr.po.printVer()
+ for (obspo, relationship) in txmbr.relatedto:
if relationship == 'obsoletedby':
- obspkg = '%s.%s %s:%s-%s' % pkg
+ obspkg = 1
+ obs_evr = obspo.printVer()
if obspkg is not None:
- otherout = otherout + " Obsoleting: %s.%s %s:%s-%s with %s\n" % (n, a, e, v, r, obspkg)
-
- out = "Transaction Listing:\n%s" % userout
- if depout != '':
- out = out + "\nPerforming the following to resolve dependencies:\n%s" % depout
- if otherout != '':
- out = out + "\nOther Transactions:\n%s\n" % otherout
-
+ msg1 = " %-22.22s %-9.9s %-15.15s %-16.16s\n" % (n, a, evr,
+ 'installed')
+ msg2 = " obsoleted by\n"
+ msg3 = " %-22.22s %-9.9s %-15.15s %-16.16s\n\n" % (obspo.name,
+ obspo.arch, obs_evr, obspo.repoid)
+ obs = obs + msg1 + msg2 + msg3
+
+ if obsoleted:
+ out = out + obs
+
+ summary = """
+Transaction Summary
+=============================================================================
+Install %5.5s Package(s)
+Update %5.5s Package(s)
+Remove %5.5s Package(s)
+Obsolete %5.5s Packages(s)
+""" % (len(installed + depinst), len(updated + depup), len(removed + deprem),
+ len(obsoleted))
+ out = out + summary
+
return out
-
+
def postTransactionOutput(self):
out = ''
More information about the Yum-cvs-commits
mailing list