[Yum-devel] [PATCH 2/2] Make ts.check() unconditional + adjust related messages
Panu Matilainen
pmatilai at laiskiainen.org
Wed Feb 9 13:59:00 UTC 2011
ts.check() is not really an optional call, as there are dependencies
which yum does not check for (notably rpmlib() dependencies). Always
call ts.check(), looking at the return values.
---
cli.py | 41 ++++++++++++++++++++---------------------
yum/__init__.py | 37 ++++++++++++++++++-------------------
yum/config.py | 1 -
yummain.py | 2 +-
4 files changed, 39 insertions(+), 42 deletions(-)
diff --git a/cli.py b/cli.py
index 9cee6a6..7237f6c 100644
--- a/cli.py
+++ b/cli.py
@@ -510,30 +510,29 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
self.dsCallback = None # dumb, dumb dumb dumb!
self.populateTs(keepold=0) # sigh
- if self.conf.rpm_check_debug:
- rcd_st = time.time()
- self.verbose_logger.log(yum.logginglevels.INFO_2,
- _('Running rpm_check_debug'))
- msgs = self.ts.check()
- if msgs:
- rpmlib_only = True
- for msg in msgs:
- if msg.startswith('rpmlib('):
- continue
- rpmlib_only = False
- if rpmlib_only:
- print _("ERROR You need to update rpm to handle:")
- else:
- print _('ERROR with rpm_check_debug vs depsolve:')
+ rcd_st = time.time()
+ self.verbose_logger.log(yum.logginglevels.INFO_2,
+ _('Running Transaction Check'))
+ msgs = self.ts.check()
+ if msgs:
+ rpmlib_only = True
+ for msg in msgs:
+ if msg.startswith('rpmlib('):
+ continue
+ rpmlib_only = False
+ if rpmlib_only:
+ print _("ERROR You need to update rpm to handle:")
+ else:
+ print _('ERROR with transaction check vs depsolve:')
- for msg in msgs:
- print to_utf8(msg)
+ for msg in msgs:
+ print to_utf8(msg)
- if rpmlib_only:
- return 1, [_('RPM needs to be updated')]
- return 1, [_('Please report this error in %s') % self.conf.bugtracker_url]
+ if rpmlib_only:
+ return 1, [_('RPM needs to be updated')]
+ return 1, [_('Please report this error in %s') % self.conf.bugtracker_url]
- self.verbose_logger.debug('rpm_check_debug time: %0.3f' % (time.time() - rcd_st))
+ self.verbose_logger.debug('Transaction Check time: %0.3f' % (time.time() - rcd_st))
tt_st = time.time()
self.verbose_logger.log(yum.logginglevels.INFO_2,
diff --git a/yum/__init__.py b/yum/__init__.py
index 02b4780..c160201 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -4811,25 +4811,24 @@ class YumBase(depsolve.Depsolve):
self.populateTs( keepold=0 ) # sigh
# This can be overloaded by a subclass.
- if self.conf.rpm_check_debug:
- self.verbose_logger.log(logginglevels.INFO_2,
- _('Running rpm_check_debug'))
- msgs = self.ts.check()
- if msgs:
- rpmlib_only = True
- for msg in msgs:
- if msg.startswith('rpmlib('):
- continue
- rpmlib_only = False
- if rpmlib_only:
- retmsgs = [_("ERROR You need to update rpm to handle:")]
- retmsgs.extend(msgs)
- raise Errors.YumRPMCheckError, retmsgs
- retmsgs = [_('ERROR with rpm_check_debug vs depsolve:')]
- retmsgs.extend(msgs)
- retmsgs.append(_('Please report this error at %s')
- % self.conf.bugtracker_url)
- raise Errors.YumRPMCheckError,retmsgs
+ self.verbose_logger.log(logginglevels.INFO_2,
+ _('Running Transaction Check'))
+ msgs = self.ts.check()
+ if msgs:
+ rpmlib_only = True
+ for msg in msgs:
+ if msg.startswith('rpmlib('):
+ continue
+ rpmlib_only = False
+ if rpmlib_only:
+ retmsgs = [_("ERROR You need to update rpm to handle:")]
+ retmsgs.extend(msgs)
+ raise Errors.YumRPMCheckError, retmsgs
+ retmsgs = [_('ERROR with transaction check vs depsolve:')]
+ retmsgs.extend(msgs)
+ retmsgs.append(_('Please report this error at %s')
+ % self.conf.bugtracker_url)
+ raise Errors.YumRPMCheckError,retmsgs
tsConf = {}
for feature in ['diskspacecheck']: # more to come, I'm sure
diff --git a/yum/config.py b/yum/config.py
index 97e5e3d..cb27bd4 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -691,7 +691,6 @@ class YumConf(StartupConf):
metadata_expire = SecondsOption(60 * 60 * 6) # Time in seconds (6h).
# Time in seconds (1 day). NOTE: This isn't used when using metalinks
mirrorlist_expire = SecondsOption(60 * 60 * 24)
- rpm_check_debug = BoolOption(True)
disable_excludes = ListOption()
skip_broken = BoolOption(False)
# Note that "instant" is the old behaviour, but group:primary is very
diff --git a/yummain.py b/yummain.py
index 9f9b7d4..32c65aa 100755
--- a/yummain.py
+++ b/yummain.py
@@ -210,7 +210,7 @@ def main(args):
except IOError, e:
return exIOError(e)
- # rpm_check_debug failed.
+ # rpm ts.check() failed.
if type(return_code) == type((0,)) and len(return_code) == 2:
(result, resultmsgs) = return_code
for msg in resultmsgs:
--
1.7.4
More information about the Yum-devel
mailing list