aboutsummaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0008-Revert-Improving-robustness-of-repo-mirror-selection.patch
blob: 358d814d41195a04c6a06e81c78eb0afd2b6f21c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Sun, 9 Oct 2016 22:02:14 +0200
Subject: [PATCH] Revert "Improving robustness of repo mirror selection"

We recently removed blacklists for a few mirrors, on account
of upstream Fuel@OPNFV fixing mirror selection in [1].

Although the mechanism will be polished a little, it works very
nicely; pointing us to [2], where we seem to trigger some flood
protection at sync, leading to dropped connections and failed builds.

Keep using the official Ubuntu Archive mirror [3] until we sort this out.

Fixes: ARMBAND-136

[1] https://gerrit.opnfv.org/gerrit/#/c/22195
[2] http://mirrors.se.eu.kernel.org/ubuntu/
[3] http://archive.ubuntu.com/ubuntu/

This reverts commit 4d4faf44dc1380b1ca731c49be9705635b840738.

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 build/f_isoroot/f_repobuild/select_ubuntu_repo.sh | 120 +++++++---------------
 1 file changed, 39 insertions(+), 81 deletions(-)

diff --git a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
index 10a8411..20b3485 100755
--- a/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
+++ b/build/f_isoroot/f_repobuild/select_ubuntu_repo.sh
@@ -1,82 +1,40 @@
 #!/bin/bash
-cleanup() {
-    rm -f $TMPFILE
-}
-
-debugmsg() {
-    test -n "$DEBUG" && echo "$@" >&2
-}
-
-# Check mirror's integrity
-check_mirror () {
-    mirror=$1
-    status=0
-    for packdir in dists/trusty-updates/main/binary-amd64 \
-        dists/trusty-updates/restricted/binary-amd64 \
-        dists/trusty-updates/universe/binary-amd64 \
-        dists/trusty-updates/multiverse/binary-amd64 \
-        dists/trusty-security/main/binary-amd64 \
-        dists/trusty-security/restricted/binary-amd64 \
-        dists/trusty-security/universe/binary-amd64 \
-        dists/trusty-security/multiverse/binary-amd64 \
-        dists/trusty-proposed/main/binary-amd64 \
-        dists/trusty-proposed/restricted/binary-amd64 \
-        dists/trusty-proposed/universe/binary-amd64 \
-        dists/trusty-proposed/multiverse/binary-amd64 \
-        dists/trusty/main/binary-amd64 \
-        dists/trusty/restricted/binary-amd64 \
-        dists/trusty/universe/binary-amd64 \
-        dists/trusty/multiverse/binary-amd64 \
-        dists/trusty-backports/main/binary-amd64 \
-        dists/trusty-backports/restricted/binary-amd64 \
-        dists/trusty-backports/universe/binary-amd64 \
-        dists/trusty-backports/multiverse/binary-amd64
-    do
-        for packfile in Release Packages.gz
-        do
-            if [ $status -ne 1 ]; then
-                curl --output /dev/null --silent --head --fail \
-                    $mirror/$packdir/$packfile
-                if [ $? -ne 0 ]; then
-                    debugmsg "$mirror: Faulty (at least missing $packdir/$packfile)"
-                    status=1
-                fi
-            fi
-        done
-    done
-    return $status
-}
-
-if [ "$1" == "-d" ]; then
-    DEBUG=1
-fi
-
-# Hardcode for testing purposes
-DEBUG=1
-
-TMPFILE=$(mktemp /tmp/mirrorsXXXXX)A
-trap cleanup exit
-
-# Generated a list of mirrors considered as "up"
-curl -s  https://launchpad.net/ubuntu/+archivemirrors | \
-    grep -P -B8 "statusUP|statusSIX" | \
-    grep -o -P "(f|ht)tp.*\""  | \
-    sed 's/"$//' | sort | uniq > $TMPFILE
-
-# Iterate over "close" mirror, check that they are considered up
-# and sane.
-for url in $(curl -s http://mirrors.ubuntu.com/mirrors.txt)
-do
-    grep -q $url $TMPFILE || debugmsg "$url Faulty (detected by Ubuntu)"
-    if [ -z $BESTURL ]; then
-        if grep -q $url $TMPFILE && check_mirror $url; then
-            debugmsg "$url: OK (setting as primary URL)"
-            BESTURL=$url
-            test -z "$DEBUG" && break
-        fi
-    else
-        grep -q $url $TMPFILE && check_mirror $url && debugmsg "$url: OK"
-    fi
-done
-
-echo "$BESTURL"
+##############################################################################
+# Copyright (c) 2015,2016 Ericsson AB and others.
+# mskalski@mirantis.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# Try to choose close ubuntu mirror from mirrors.txt, but "whitewash" this
+# against the full repo list to removed mirrors not up-to-date.
+
+# Some Ubuntu mirrors seem less reliable for this type of mirroring -
+# as they are discoved they can be added to the blacklist below in order
+# for them not to be considered.
+BLACKLIST="mirror.clibre.uqam.ca"
+
+#NOTE: For now the mirror selection is disabled due to issues not yet
+#      understood/resolved.
+#for url in $((curl -s  https://launchpad.net/ubuntu/+archivemirrors | \
+#              grep -P -B8 "statusUP|statusSIX" | \
+#              grep -o -P "(f|ht)tp.*\""  | \
+#              sed 's/"$//' | sort | uniq; \
+#              curl -s http://mirrors.ubuntu.com/mirrors.txt | sort | uniq) | \
+#              sort | uniq -d)
+#do
+#    host=$(echo $url | cut -d'/' -f3)
+#    echo ${BLACKLIST} | grep -q ${host} && continue
+#    if curl -s -o /dev/null --head --fail "$url"; then
+#      echo $url
+#      exit 0
+#    else
+#      continue
+#    fi
+#done
+
+# If no suitable local mirror can be found,
+# the default archive is returned instead.
+echo "http://archive.ubuntu.com/ubuntu/"