[yum-cvs] yum/yum __init__.py,1.132,1.133 repos.py,1.81,1.82
Seth Vidal
skvidal at login.linux.duke.edu
Thu Jul 28 06:53:39 UTC 2005
Update of /home/groups/yum/cvs/yum/yum
In directory login:/tmp/cvs-serv15674/yum
Modified Files:
__init__.py repos.py
Log Message:
if caching is enabled and the package in the cache is
damaged/incomplete/corrupted. Make sure we exit out rather than trying
to install/update the package anyway. Closes rh bug: 164394
need to backport to 2.2.X
Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- __init__.py 14 Jul 2005 08:28:58 -0000 1.132
+++ __init__.py 28 Jul 2005 06:53:37 -0000 1.133
@@ -545,8 +545,9 @@
"""download list of package objects handed to you, output based on
callback, raise yum.Errors.YumBaseError on problems"""
+ errors = {}
self.plugins.run('predownload', pkglist=pkglist)
-
+ repo_cached = False
remote_pkgs = []
for po in pkglist:
if hasattr(po, 'pkgtype') and po.pkgtype == 'local':
@@ -558,9 +559,18 @@
totsize = int(po.size())
try:
result = self.verifyPkg(local, po, raiseError=1)
- except URLGrabError, e:
+ except URLGrabError, e: # fails the check
+
+ repo = self.repos.getRepo(po.repoid)
+ if repo.cache:
+ repo_cached = True
+ msg = 'package fails checksum but caching is enabled for %s' % repo.id
+ if not errors.has_key(po): errors[po] = []
+ errors[po].append(msg)
+
if cursize >= totsize: # keep it around for regetting
os.unlink(local)
+
else:
if result:
continue
@@ -568,8 +578,15 @@
if cursize >= totsize: # keep it around for regetting
os.unlink(local)
remote_pkgs.append(po)
+
+ # caching is enabled and the package
+ # just failed to check out there's no
+ # way to save this, report the error and return
+ if (self.conf.cache or repo_cached) and errors:
+ return errors
+
+
- errors = {}
i = 0
for po in remote_pkgs:
i += 1
Index: repos.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/repos.py,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- repos.py 22 Jul 2005 16:09:46 -0000 1.81
+++ repos.py 28 Jul 2005 06:53:37 -0000 1.82
@@ -571,8 +571,9 @@
self.failure_obj = (f_func, f_args, f_kwargs)
if self.cache == 1:
- if os.path.exists(local):
- return local
+ if os.path.exists(local): # FIXME - we should figure out a way
+ return local # to run the checkfunc from here
+
else: # ain't there - raise
raise Errors.RepoError, \
"Caching enabled but no local cache of %s from %s" % (local,
More information about the Yum-cvs-commits
mailing list