Blame SOURCES/BZ-1428210-fastestmirror-use-prereposetup.patch

5b4f08
commit f62ca0e78ff5b087c0cb49d858e040a5c5284eeb
5b4f08
Author: Michal Domonkos <mdomonko@redhat.com>
5b4f08
Date:   Mon Jun 5 20:29:10 2017 +0200
5b4f08
5b4f08
    fastestmirror: move the logic before MD retrieval. BZ 1428210
5b4f08
    
5b4f08
    This plugin has had no effect on metadata downloads since commit a522869
5b4f08
    in yum where we put a RepoStorage.retrieveAllMD() call before
5b4f08
    postreposetup_hook used by this plugin.  Let's change to using
5b4f08
    prereposetup_hook instead so that retrieveAllMD() can make use of the
5b4f08
    sorted urls.
5b4f08
    
5b4f08
    In practice, though, mirrors would still be benchmarked and sorted
5b4f08
    because of a similar mechanism present in urlgrabber (the timedhosts
5b4f08
    option, always enabled in yum) with one exception:  If the yum cache is
5b4f08
    empty (no timedhosts file yet), the original order received from the
5b4f08
    server would be retained (a property of stable sorting [1]) for the
5b4f08
    repomd.xml download, which is still a bad situation that wouldn't happen
5b4f08
    before a522869; this is fixed with this commit as it allows the plugin
5b4f08
    to do its work beforehand.
5b4f08
    
5b4f08
    Note that the stuff we do in yum/repos.py in between prereposetup_hook
5b4f08
    and postreposetup_hook has nothing to do with our plugin anyway, so we
5b4f08
    won't "miss" or break any configuration steps when we move our logic
5b4f08
    from the latter to the former location.
5b4f08
    
5b4f08
    [1] urlgrabber/mirror.py:275
5b4f08
5b4f08
diff --git a/plugins/fastestmirror/fastestmirror.py b/plugins/fastestmirror/fastestmirror.py
5b4f08
index fe79629..5887e32 100644
5b4f08
--- a/plugins/fastestmirror/fastestmirror.py
5b4f08
+++ b/plugins/fastestmirror/fastestmirror.py
5b4f08
@@ -146,7 +146,7 @@ def _len_non_ftp(urls):
5b4f08
         num += 1
5b4f08
     return num
5b4f08
 
5b4f08
-def postreposetup_hook(conduit):
5b4f08
+def prereposetup_hook(conduit):
5b4f08
     """
5b4f08
     This function is called after Yum has initiliazed all the repository information.
5b4f08
 
5b4f08
@@ -255,7 +255,7 @@ def read_timedhosts():
5b4f08
     communicate with other functions.
5b4f08
 
5b4f08
     This function is referred by:
5b4f08
-        - L{postreposetup_hook()}
5b4f08
+        - L{prereposetup_hook()}
5b4f08
 
5b4f08
     @param timedhosts : A list of time intervals to reach different hosts
5b4f08
     corresponding to the mirrors. The index of the list are hostnames.
5b4f08
@@ -281,7 +281,7 @@ def write_timedhosts():
5b4f08
     communicate with other functions.
5b4f08
 
5b4f08
     This function is referred by:
5b4f08
-        - L{postreposetup_hook()}
5b4f08
+        - L{prereposetup_hook()}
5b4f08
 
5b4f08
     @param timedhosts : A list of time intervals to reach different hosts
5b4f08
     corresponding to the mirrors. The index of the list are hostnames.
5b4f08
@@ -359,7 +359,7 @@ class FastestMirror:
5b4f08
             - L{FastestMirror._poll_mirrors()}
5b4f08
 
5b4f08
         This function is referred by:
5b4f08
-            - L{postreposetup_hook()}
5b4f08
+            - L{prereposetup_hook()}
5b4f08
             - L{main()}
5b4f08
 
5b4f08
         @rtype: List