[yum-git] yum/yumRepo.py

James Antill james at linux.duke.edu
Mon Mar 17 13:52:45 UTC 2008


 yum/yumRepo.py |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit f2211e9115e9ffe9cd635fd999b7c2a7a108db5f
Author: James Antill <james at and.org>
Date:   Mon Mar 17 09:49:37 2008 -0400

    Don't count on len(self._oldRepoMDData) to mean we have old repo MD

diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index b837328..1ec69ea 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -768,7 +768,7 @@ class YumRepository(Repository, config.RepoConf):
 
         except URLGrabError, e:
             if grab_can_fail is None:
-                grab_can_fail = len(self._oldRepoMDData)
+                grab_can_fail = 'old_repo_XML' in self._oldRepoMDData
             if grab_can_fail:
                 return None
             raise Errors.RepoError, 'Error downloading file %s: %s' % (local, e)
@@ -780,7 +780,7 @@ class YumRepository(Repository, config.RepoConf):
             return repoMDObject.RepoMD(self.id, local)
         except Errors.RepoMDError, e:
             if parse_can_fail is None:
-                parse_can_fail = len(self._oldRepoMDData)
+                parse_can_fail = 'old_repo_XML' in self._oldRepoMDData
             if parse_can_fail:
                 return None
             raise Errors.RepoError, 'Error importing repomd.xml from %s: %s' % (self, e)
@@ -803,7 +803,8 @@ class YumRepository(Repository, config.RepoConf):
 
     def _revertOldRepoXML(self):
         """ If we have older data available, revert to it. """
-        if not len(self._oldRepoMDData):
+        if 'old_repo_XML' not in self._oldRepoMDData:
+            self._oldRepoMDData = {}
             return
 
         # Unique names mean the rename doesn't work anymore.
@@ -862,7 +863,7 @@ class YumRepository(Repository, config.RepoConf):
         """ We check the timestamps, if any of the timestamps for the
             "new" data is older than what we have ... we revert. """
         
-        if not len(self._oldRepoMDData):
+        if 'old_repo_XML' not in self._oldRepoMDData:
             return True
         old_repo_XML = self._oldRepoMDData['old_repo_XML']
         



More information about the Yum-cvs-commits mailing list