[yum-commits] Branch 'yum-3_2_X' - 3 commits - cli.py output.py yum/config.py yum/__init__.py
James Antill
james at osuosl.org
Thu Apr 29 21:19:25 UTC 2010
cli.py | 10 +++++++++-
output.py | 20 ++++++++++++++++++++
yum/__init__.py | 42 ++++++++++++++++++++++++++++++++++++------
yum/config.py | 3 +++
4 files changed, 68 insertions(+), 7 deletions(-)
New commits:
commit 8af3344f865f6af9a2d9293c513f7c936066eb58
Author: James Antill <james at and.org>
Date: Thu Apr 29 14:43:24 2010 -0400
Ignore problems about packages being removed, BZ 566820
diff --git a/yum/__init__.py b/yum/__init__.py
index 99b0bc1..0a39365 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1178,7 +1178,8 @@ class YumBase(depsolve.Depsolve):
toRemove.add(dep)
self._getDepsToRemove(dep, deptree, toRemove)
- def _rpmdb_warn_checks(self, out=None, warn=True, chkcmd=None, header=None):
+ def _rpmdb_warn_checks(self, out=None, warn=True, chkcmd=None, header=None,
+ ignore_pkgs=[]):
if out is None:
out = self.logger.warning
if chkcmd is None:
@@ -1196,22 +1197,48 @@ class YumBase(depsolve.Depsolve):
else:
chkcmd = set([chkcmd])
+ ignore_pkgtups = set((pkg.pkgtup for pkg in ignore_pkgs))
+
rc = 0
probs = []
if chkcmd.intersection(set(('all', 'dependencies'))):
prob2ui = {'requires' : _('missing requires'),
'conflicts' : _('installed conflict')}
- probs.extend(self.rpmdb.check_dependencies())
+ for prob in self.rpmdb.check_dependencies():
+ if prob.pkg.pkgtup in ignore_pkgtups:
+ continue
+ if prob.problem == 'conflicts':
+ found = True # all the conflicting pkgs have to be ignored
+ for res in prob.res:
+ if res.pkgtup not in ignore_pkgtups:
+ found = False
+ break
+ if found:
+ continue
+ probs.append(prob)
if chkcmd.intersection(set(('all', 'duplicates'))):
iopkgs = set(self.conf.installonlypkgs)
- probs.extend(self.rpmdb.check_duplicates(iopkgs))
+ for prob in self.rpmdb.check_duplicates(iopkgs):
+ if prob.pkg.pkgtup in ignore_pkgtups:
+ continue
+ if prob.duplicate.pkgtup in ignore_pkgtups:
+ continue
+ probs.append(prob)
if chkcmd.intersection(set(('all', 'obsoleted'))):
- probs.extend(self.rpmdb.check_obsoleted())
+ for prob in self.rpmdb.check_obsoleted():
+ if prob.pkg.pkgtup in ignore_pkgtups:
+ continue
+ probs.append(prob)
if chkcmd.intersection(set(('all', 'provides'))):
- probs.extend(self.rpmdb.check_provides())
+ for prob in self.rpmdb.check_provides():
+ if prob.pkg.pkgtup in ignore_pkgtups:
+ continue
+ if prob.obsoleter.pkgtup in ignore_pkgtups:
+ continue
+ probs.append(prob)
header(len(probs))
for prob in sorted(probs):
@@ -1238,7 +1265,10 @@ class YumBase(depsolve.Depsolve):
if lastdbv is not None:
lastdbv = lastdbv.end_rpmdbversion
if lastdbv is None or rpmdbv != lastdbv:
- self._rpmdb_warn_checks(warn=lastdbv is not None)
+ txmbrs = self.tsInfo.getMembersWithState(None, TS_REMOVE_STATES)
+ ignore_pkgs = [txmbr.po for txmbr in txmbrs]
+ self._rpmdb_warn_checks(warn=lastdbv is not None,
+ ignore_pkgs=ignore_pkgs)
if self.conf.history_record:
self.history.beg(rpmdbv, using_pkgs, list(self.tsInfo))
commit aa29fc5a8c80eb23023b7f09a92793fe3fcf0bd3
Author: James Antill <james at and.org>
Date: Thu Apr 29 11:55:48 2010 -0400
Add total removal size, when just doing removes. BZ 495595
diff --git a/cli.py b/cli.py
index 2977ca8..fc91de2 100644
--- a/cli.py
+++ b/cli.py
@@ -416,12 +416,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
# Check which packages have to be downloaded
downloadpkgs = []
+ rmpkgs = []
stuff_to_download = False
install_only = True
+ remove_only = True
for txmbr in self.tsInfo.getMembers():
if txmbr.ts_state not in ('i', 'u'):
install_only = False
+ po = txmbr.po
+ if po:
+ rmpkgs.append(po)
else:
+ remove_only = False
stuff_to_download = True
po = txmbr.po
if po:
@@ -434,7 +440,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
# Report the total download size to the user, so he/she can base
# the answer on this info
- if stuff_to_download:
+ if not stuff_to_download:
+ self.reportRemoveSize(rmpkgs)
+ else:
self.reportDownloadSize(downloadpkgs, install_only)
# confirm with user
diff --git a/output.py b/output.py
index 452f8a2..95564e1 100755
--- a/output.py
+++ b/output.py
@@ -927,6 +927,26 @@ class YumOutput:
self.verbose_logger.log(logginglevels.INFO_1,
_("Installed size: %s"),
self.format_number(insize))
+
+ def reportRemoveSize(self, packages):
+ """Report the total size of packages being removed. """
+ totsize = 0
+ error = False
+ for pkg in packages:
+ # Just to be on the safe side, if for some reason getting
+ # the package size fails, log the error and don't report download
+ # size
+ try:
+ size = int(pkg.size)
+ totsize += size
+ except:
+ error = True
+ self.logger.error(_('There was an error calculating installed size'))
+ break
+ if (not error):
+ self.verbose_logger.log(logginglevels.INFO_1,
+ _("Installed size: %s"),
+ self.format_number(totsize))
def listTransaction(self):
"""returns a string rep of the transaction in an easy-to-read way."""
commit c5648243705d1fcc96274eaed554a9895d52fa47
Author: James Antill <james at and.org>
Date: Thu Apr 29 12:14:32 2010 -0400
Add the new, 4.8.0, error class for "cannot open DB", BZ 567709
diff --git a/yum/config.py b/yum/config.py
index 1b78fcd..3610b91 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -1000,6 +1000,9 @@ def _getsysver(installroot, distroverpkg):
else:
raise Errors.YumBaseError("Error: " + str(e))
raise Errors.YumBaseError("Error: " + str(e))
+ except rpm.error, e:
+ # This is the "new" code for "cannot open rpmdb", 4.8.0 ish
+ raise Errors.YumBaseError("Error: " + str(e))
# we're going to take the first one - if there is more than one of these
# then the user needs a beating
if idx.count() == 0:
More information about the Yum-commits
mailing list