[Yum-devel] [PATCH] Use comps.xml instead of comps.xml.gz, if available. BZ 758574.

Zdeněk Pavlas zpavlas at redhat.com
Wed Nov 30 12:36:35 UTC 2011


YumRepository.getGroups() should return the unpacked file,
if exists.  This allows '-C' to work again, and saves unnecessary
file decompression otherwise.
---
 yum/yumRepo.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 91b7dde..ca35f08 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -1572,7 +1572,7 @@ Insufficient space in download directory %s
            mdtype can be 'primary', 'filelists', 'other' or 'group'."""
         return self._retrieveMD(mdtype)
 
-    def _retrieveMD(self, mdtype, retrieve_can_fail=False):
+    def _retrieveMD(self, mdtype, retrieve_can_fail=False, check_only=False):
         """ Internal function, use .retrieveMD() from outside yum. """
         #  Note that this can raise Errors.RepoMDError if mdtype doesn't exist
         # for this repo.
@@ -1608,6 +1608,8 @@ Insufficient space in download directory %s
             if self._checkMD(local, mdtype, check_can_fail=True):
                 self.retrieved[mdtype] = 1
                 return local # it's the same return the local one
+        if check_only:
+            return None
 
         try:
             checkfunc = (self.checkMD, (mdtype,), {})
@@ -1660,6 +1662,9 @@ Insufficient space in download directory %s
     def getGroups(self):
         """gets groups and returns group file path for the repository, if there
            is none it returns None"""
+        local = self._retrieveMD('group', check_only=True)
+        if local:
+            return local
         if 'group_gz' in self.repoXML.fileTypes():
             return self._retrieveMD('group_gz', retrieve_can_fail=True)
         return self._retrieveMD('group', retrieve_can_fail=True)
-- 
1.7.4.4



More information about the Yum-devel mailing list