[yum-cvs] yum/yum __init__.py,1.249,1.250
Menno Smits
mjs at linux.duke.edu
Mon Sep 11 09:56:21 UTC 2006
Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv6003/yum
Modified Files:
__init__.py
Log Message:
Prevent a KeyError that was occur during the disk space check because errors
wasn't always initialised correctly. Added adderror() to avoid initialisation
problems like this and minimise clutter.
Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.249
retrieving revision 1.250
diff -u -r1.249 -r1.250
--- __init__.py 8 Sep 2006 21:05:16 -0000 1.249
+++ __init__.py 11 Sep 2006 09:56:19 -0000 1.250
@@ -612,6 +612,9 @@
callback, raise yum.Errors.YumBaseError on problems"""
errors = {}
+ def adderror(po, msg):
+ errors.setdefault(po, []).append(msg)
+
self.plugins.run('predownload', pkglist=pkglist)
repo_cached = False
remote_pkgs = []
@@ -626,9 +629,8 @@
if not po.verifyLocalPkg():
if po.repo.cache:
repo_cached = True
- msg = 'package fails checksum but caching is enabled for %s' % po.repo.id
- if not errors.has_key(po): errors[po] = []
- errors[po].append(msg)
+ adderror(po, 'package fails checksum but caching is '
+ 'enabled for %s' % po.repo.id)
if cursize >= totsize: # otherwise keep it around for regetting
os.unlink(local)
@@ -648,8 +650,8 @@
checkfunc = (self.verifyPkg, (po, 1), {})
stvfs = os.statvfs(po.repo.pkgdir)
if stvfs[4] * stvfs[0] <= po.size:
- msg = "Insufficient space in download directory %s to download" % po.repo.pkgdir
- errors[po].append(msg)
+ adderror(po, 'Insufficient space in download directory %s '
+ 'to download' % po.repo.pkgdir)
continue
try:
@@ -661,9 +663,7 @@
cache=po.repo.http_caching != 'none',
)
except Errors.RepoError, e:
- if not errors.has_key(po):
- errors[po] = []
- errors[po].append(str(e))
+ adderror(po, str(e))
else:
po.localpath = mylocal
if errors.has_key(po):
More information about the Yum-cvs-commits
mailing list