[yum-commits] Branch 'yum-3_2_X' - 2 commits - yum/__init__.py yum/metalink.py

James Antill james at osuosl.org
Tue Feb 24 04:26:11 UTC 2009


 yum/__init__.py |    2 +-
 yum/metalink.py |   18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

New commits:
commit 0fbde1b0946456086f87febe4e71d051014eaf2f
Author: James Antill <james at and.org>
Date:   Mon Feb 23 00:21:45 2009 -0500

    Skip ftp URLs for hosts we have http URLs for, in "simple" mode

diff --git a/yum/metalink.py b/yum/metalink.py
index ff36393..1f406bb 100755
--- a/yum/metalink.py
+++ b/yum/metalink.py
@@ -221,12 +221,26 @@ class MetaLinkRepoMD:
 
     def urls(self):
         """ Iterate plain urls for the mirrors, like the old mirrorlist. """
+
+        # Get the hostname from a url, stripping away any usernames/passwords
+        # Borrowd from fastestmirror
+        url2host = lambda url: url.split('/')[2].split('@')[-1]
+        hosts = set() # Don't want multiple urls for one host in plain mode
+                      # The list of URLs is sorted, so http is before ftp
+
         for mirror in self.mirrors:
             url = mirror.url
 
             # This is what yum supports atm. ... no rsync etc.
-            if not (url.startswith("http:") or url.startswith("ftp:") or
-                    url.startswith("file:") or url.startswith("https:")):
+            if url.startswith("file:"):
+                pass
+            elif (url.startswith("http:") or url.startswith("ftp:") or
+                  url.startswith("https:")):
+                host = url2host(url)
+                if host in hosts:
+                    continue
+                hosts.add(host)
+            else:
                 continue
 
             #  The mirror urls in the metalink file are for repomd.xml so it
commit bd6fcaf29a0523bc6072f48a5559510f1f21975a
Author: James Antill <james at and.org>
Date:   Wed Feb 18 09:45:09 2009 -0500

    Move rpmUtils.updates.debug out of verbose and into debug

diff --git a/yum/__init__.py b/yum/__init__.py
index e31ced8..f2d2488 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -524,7 +524,7 @@ class YumBase(depsolve.Depsolve):
         up_st = time.time()
 
         self._up = rpmUtils.updates.Updates(self.rpmdb.simplePkgList(), self.pkgSack.simplePkgList())
-        if self.conf.debuglevel >= 6:
+        if self.conf.debuglevel >= 7:
             self._up.debug = 1
         
         if self.conf.obsoletes:


More information about the Yum-commits mailing list