diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-09-21 11:00:29 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-09-21 11:01:14 -0700 |
commit | d1ea4ac22b9b972b684c379434d2a1b8e5f9d933 (patch) | |
tree | 815bdb118c07c2baeefeba98d3b946873935d60a | |
parent | c42ed0f97224091c33edeb79a3719de0b283fa1f (diff) | |
download | portage-d1ea4ac22b9b972b684c379434d2a1b8e5f9d933.tar.gz portage-d1ea4ac22b9b972b684c379434d2a1b8e5f9d933.tar.bz2 portage-d1ea4ac22b9b972b684c379434d2a1b8e5f9d933.zip |
primaryuri: prefer thirdpartymirrors in SRC_URI
This will fix bug #435720.
-rw-r--r-- | pym/portage/package/ebuild/fetch.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/pym/portage/package/ebuild/fetch.py b/pym/portage/package/ebuild/fetch.py index 260bf10bb..63b4c0a29 100644 --- a/pym/portage/package/ebuild/fetch.py +++ b/pym/portage/package/ebuild/fetch.py @@ -429,10 +429,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, # now try the official mirrors if mirrorname in thirdpartymirrors: - random.shuffle(thirdpartymirrors[mirrorname]) - uris = [locmirr.rstrip("/") + "/" + path \ for locmirr in thirdpartymirrors[mirrorname]] + random.shuffle(uris) filedict[myfile].extend(uris) thirdpartymirror_uris.setdefault(myfile, []).extend(uris) @@ -445,15 +444,6 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, if restrict_fetch or force_mirror: # Only fetch from specific mirrors is allowed. continue - if "primaryuri" in restrict: - # Use the source site first. - if myfile in primaryuri_indexes: - primaryuri_indexes[myfile] += 1 - else: - primaryuri_indexes[myfile] = 0 - filedict[myfile].insert(primaryuri_indexes[myfile], myuri) - else: - filedict[myfile].append(myuri) primaryuris = primaryuri_dict.get(myfile) if primaryuris is None: primaryuris = [] @@ -465,6 +455,15 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, for myfile, uris in thirdpartymirror_uris.items(): primaryuri_dict.setdefault(myfile, []).extend(uris) + # Now merge primaryuri values into filedict (includes mirrors + # explicitly referenced in SRC_URI). + if "primaryuri" in restrict: + for myfile, uris in filedict.items(): + filedict[myfile] = primaryuri_dict.get(myfile, []) + uris + else: + for myfile in filedict: + filedict[myfile] += primaryuri_dict.get(myfile, []) + can_fetch=True if listonly: |