James Antill wrote:
On Mon, 2008-02-11 at 20:01 -0500, seth vidal wrote:
On Mon, 2008-02-11 at 19:42 -0500, James Bowes wrote:
Hi all:
The attached patch adds skip-broken output to the yum cli's summary bit,
like so:
=============================================================================
Package Arch Version Repository Size
=============================================================================
Updating:
openbox-libs x86_64 3.4.5-1.fc8 updates 45 k
Skipped:
frobnitz x86_64 0.0.1 badrepo 165 k
frobnitz-libs x86_64 0.0.1 badrepo 100 k
libdc1394 x86_64 2.0.1-3.fc8 updates 111 k
Transaction Summary
=============================================================================
Install 0 Package(s)
Update 1 Package(s)
Remove 0 Package(s)
So, I didn't add a count of skipped packages at the end, but that might be nice
to show when some packages are actually skipped, or if skip-broken is enabled
(rather than all the time).
The code itself puts the skipped packages into the transaction info in a new
'skipped' array. While not used by rpm proper, this feels like a good place for
it to be.
What does everyone think?
Does it play hell if I do something like:
my = yum.YumBase()
my.install(foo)
... magic-here ...
if len(my.tsInfo) > 0:
No because a txmbr isn't created and nothing is added to the pkgdict,
but the bigger picture here is that IMO this shouldn't be part of the
"Transaction Data" class.
Although it'd be nice to see the above output, and data available for
other API users ... so I'm not sure where to put it, maybe as part of
the Depsolve class?
I agree the skipped packages don't fit nicely into tsInfo.
I have created a patch to do it in another way.
Tim
>From 93d6e50123372ef0dd11897f79d330f5a2a52451 Mon Sep 17 00:00:00 2001
From: Tim Lauridsen <[EMAIL PROTECTED]>
Date: Tue, 12 Feb 2008 12:54:52 +0100
Subject: [PATCH] Added skipped packages to Transaction Summary
---
output.py | 22 ++++++++++++++++++++--
yum/__init__.py | 12 +++++++-----
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/output.py b/output.py
index 187a16c..ac3d681 100644
--- a/output.py
+++ b/output.py
@@ -482,6 +482,7 @@ class YumOutput:
""" % (_('Package'), _('Arch'), _('Version'), _('Repository'), _('Size'))
else:
out = u""
+
for (action, pkglist) in [(_('Installing'), self.tsInfo.installed),
(_('Updating'), self.tsInfo.updated),
@@ -489,6 +490,7 @@ class YumOutput:
(_('Installing for dependencies'), self.tsInfo.depinstalled),
(_('Updating for dependencies'), self.tsInfo.depupdated),
(_('Removing for dependencies'), self.tsInfo.depremoved)]:
+
if pkglist:
totalmsg = u"%s:\n" % action
for txmbr in pkglist:
@@ -507,16 +509,32 @@ class YumOutput:
if pkglist:
out = out + totalmsg
+
+ if self.skipped_packages:
+ totalmsg = u"%s:\n" % _('Skipped')
+ for po in self.skipped_packages:
+ (n,a,e,v,r) = po.pkgtup
+ evr = po.printVer()
+ repoid = po.repoid
+ pkgsize = float(po.size)
+ size = self.format_number(pkgsize)
+ msg = u" %-22s %-9s %-15s %-16s %5s\n" % (n, a,
+ evr, repoid, size)
+ totalmsg = totalmsg + msg
+ out = out + totalmsg
summary = _("""
Transaction Summary
=============================================================================
Install %5.5s Package(s)
Update %5.5s Package(s)
-Remove %5.5s Package(s)
+Remove %5.5s Package(s)
+Skipped %5.5s Package(s)
""") % (len(self.tsInfo.installed + self.tsInfo.depinstalled),
len(self.tsInfo.updated + self.tsInfo.depupdated),
- len(self.tsInfo.removed + self.tsInfo.depremoved))
+ len(self.tsInfo.removed + self.tsInfo.depremoved),
+ len(self.skipped_packages)
+ )
out = out + summary
return out
diff --git a/yum/__init__.py b/yum/__init__.py
index 2b88c9c..f9faeea 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -94,6 +94,8 @@ class YumBase(depsolve.Depsolve):
self.localPackages = [] # for local package handling
self.mediagrabber = None
+
+ self.skipped_packages = [] # Set to store pkgs skipped from the transaction
def __del__(self):
self.close()
@@ -618,6 +620,7 @@ class YumBase(depsolve.Depsolve):
def buildTransaction(self):
"""go through the packages in the transaction set, find them in the
packageSack or rpmdb, and pack up the ts accordingly"""
+ self.skipped_packages = []
self.plugins.run('preresolve')
(rescode, restring) = self.resolveDeps()
self.plugins.run('postresolve', rescode=rescode, restring=restring)
@@ -639,7 +642,6 @@ class YumBase(depsolve.Depsolve):
# Keep removing packages & Depsolve until all errors is gone
# or the transaction is empty
count = 0
- skipped_po = set()
orig_restring = restring # Keep the old error messages
while len(self.po_with_problems) > 0 and rescode == 1:
count += 1
@@ -661,7 +663,8 @@ class YumBase(depsolve.Depsolve):
for po in toRemove:
skipped = self._skipFromTransaction(po)
for skip in skipped:
- skipped_po.add(skip)
+ if not skip in self.skipped_packages:
+ self.skipped_packages.append(skip)
if not toRemove: # Nothing was removed, so we still got a problem
break # Bail out
rescode, restring = self.resolveDeps()
@@ -673,9 +676,8 @@ class YumBase(depsolve.Depsolve):
if rescode != 1:
self.verbose_logger.debug(_("Skip-broken took %i rounds "), count)
self.verbose_logger.info(_('\nPackages skipped because of dependency problems:'))
- skipped_list = [p for p in skipped_po]
- skipped_list.sort()
- for po in skipped_list:
+ self.skipped_packages.sort(misc.sortPkgObj)
+ for po in self.skipped_packages:
msg = _(" %s from %s") % (str(po),po.repo.id)
self.verbose_logger.info(msg)
else:
--
1.5.4
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel