1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Sun, 9 Oct 2016 22:02:14 +0200
3 Subject: [PATCH] Revert "Improving robustness of repo mirror selection"
5 We recently removed blacklists for a few mirrors, on account
6 of upstream Fuel@OPNFV fixing mirror selection in [1].
8 Although the mechanism will be polished a little, it works very
9 nicely; pointing us to [2], where we seem to trigger some flood
10 protection at sync, leading to dropped connections and failed builds.
12 Keep using the official Ubuntu Archive mirror [3] until we sort this out.
16 [1] https://gerrit.opnfv.org/gerrit/#/c/22195
17 [2] http://mirrors.se.eu.kernel.org/ubuntu/
18 [3] http://archive.ubuntu.com/ubuntu/
20 This reverts commit 4d4faf44dc1380b1ca731c49be9705635b840738.
22 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
24 build/f_isoroot/f_repobuild/select_ubuntu_repo.sh | 120 +++++++---------------
25 1 file changed, 39 insertions(+), 81 deletions(-)
27 diff --git a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
28 index 10a8411..20b3485 100755
29 --- a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
30 +++ b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
38 - test -n "$DEBUG" && echo "$@" >&2
41 -# Check mirror's integrity
45 - for packdir in dists/trusty-updates/main/binary-amd64 \
46 - dists/trusty-updates/restricted/binary-amd64 \
47 - dists/trusty-updates/universe/binary-amd64 \
48 - dists/trusty-updates/multiverse/binary-amd64 \
49 - dists/trusty-security/main/binary-amd64 \
50 - dists/trusty-security/restricted/binary-amd64 \
51 - dists/trusty-security/universe/binary-amd64 \
52 - dists/trusty-security/multiverse/binary-amd64 \
53 - dists/trusty-proposed/main/binary-amd64 \
54 - dists/trusty-proposed/restricted/binary-amd64 \
55 - dists/trusty-proposed/universe/binary-amd64 \
56 - dists/trusty-proposed/multiverse/binary-amd64 \
57 - dists/trusty/main/binary-amd64 \
58 - dists/trusty/restricted/binary-amd64 \
59 - dists/trusty/universe/binary-amd64 \
60 - dists/trusty/multiverse/binary-amd64 \
61 - dists/trusty-backports/main/binary-amd64 \
62 - dists/trusty-backports/restricted/binary-amd64 \
63 - dists/trusty-backports/universe/binary-amd64 \
64 - dists/trusty-backports/multiverse/binary-amd64
66 - for packfile in Release Packages.gz
68 - if [ $status -ne 1 ]; then
69 - curl --output /dev/null --silent --head --fail \
70 - $mirror/$packdir/$packfile
71 - if [ $? -ne 0 ]; then
72 - debugmsg "$mirror: Faulty (at least missing $packdir/$packfile)"
81 -if [ "$1" == "-d" ]; then
85 -# Hardcode for testing purposes
88 -TMPFILE=$(mktemp /tmp/mirrorsXXXXX)A
91 -# Generated a list of mirrors considered as "up"
92 -curl -s https://launchpad.net/ubuntu/+archivemirrors | \
93 - grep -P -B8 "statusUP|statusSIX" | \
94 - grep -o -P "(f|ht)tp.*\"" | \
95 - sed 's/"$//' | sort | uniq > $TMPFILE
97 -# Iterate over "close" mirror, check that they are considered up
99 -for url in $(curl -s http://mirrors.ubuntu.com/mirrors.txt)
101 - grep -q $url $TMPFILE || debugmsg "$url Faulty (detected by Ubuntu)"
102 - if [ -z $BESTURL ]; then
103 - if grep -q $url $TMPFILE && check_mirror $url; then
104 - debugmsg "$url: OK (setting as primary URL)"
106 - test -z "$DEBUG" && break
109 - grep -q $url $TMPFILE && check_mirror $url && debugmsg "$url: OK"
114 +##############################################################################
115 +# Copyright (c) 2015,2016 Ericsson AB and others.
116 +# mskalski@mirantis.com
117 +# All rights reserved. This program and the accompanying materials
118 +# are made available under the terms of the Apache License, Version 2.0
119 +# which accompanies this distribution, and is available at
120 +# http://www.apache.org/licenses/LICENSE-2.0
121 +##############################################################################
123 +# Try to choose close ubuntu mirror from mirrors.txt, but "whitewash" this
124 +# against the full repo list to removed mirrors not up-to-date.
126 +# Some Ubuntu mirrors seem less reliable for this type of mirroring -
127 +# as they are discoved they can be added to the blacklist below in order
128 +# for them not to be considered.
129 +BLACKLIST="mirror.clibre.uqam.ca"
131 +#NOTE: For now the mirror selection is disabled due to issues not yet
132 +# understood/resolved.
133 +#for url in $((curl -s https://launchpad.net/ubuntu/+archivemirrors | \
134 +# grep -P -B8 "statusUP|statusSIX" | \
135 +# grep -o -P "(f|ht)tp.*\"" | \
136 +# sed 's/"$//' | sort | uniq; \
137 +# curl -s http://mirrors.ubuntu.com/mirrors.txt | sort | uniq) | \
140 +# host=$(echo $url | cut -d'/' -f3)
141 +# echo ${BLACKLIST} | grep -q ${host} && continue
142 +# if curl -s -o /dev/null --head --fail "$url"; then
150 +# If no suitable local mirror can be found,
151 +# the default archive is returned instead.
152 +echo "http://archive.ubuntu.com/ubuntu/"