[Yum-devel] [PATCH] Do the same no statvfs check when using relative paths.

James Antill james at and.org
Fri Aug 31 19:58:21 UTC 2012


---
 yum/yumRepo.py |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 7f1f1db..a7c51c0 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -844,6 +844,16 @@ class YumRepository(Repository, config.RepoConf):
                                                               value),
                              fdel=lambda self: setattr(self, "_metalink", None))
 
+    def _all_urls_are_files(self, url):
+        if url:
+            return url.startswith("/") or url.startswith("file:")
+
+        # Not an explicit url ... so make sure all mirrors/etc. are file://
+        for url in self.urls:
+            if not self._all_urls_are_files(url):
+                return False
+        return True
+
     def _getFile(self, url=None, relative=None, local=None, start=None, end=None,
             copy_local=None, checkfunc=None, text=None, reget='simple', 
             cache=True, size=None, **kwargs):
@@ -891,8 +901,7 @@ class YumRepository(Repository, config.RepoConf):
             except Errors.MediaError, e:
                 verbose_logger.log(logginglevels.DEBUG_2, "Error getting package from media; falling back to url %s" %(e,))
 
-        if size and (copy_local or not url or
-                     not (url.startswith("/") or url.startswith("file:"))):
+        if size and (copy_local or not _all_urls_are_files(url)):
             dirstat = os.statvfs(os.path.dirname(local))
             avail = dirstat.f_bavail * dirstat.f_bsize
             if avail < long(size):
-- 
1.7.6.5



More information about the Yum-devel mailing list