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

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