[PATCH 5 of 7] scripts/functions: always prefer the mirror
Yann E. MORIN
yann.morin.1998@anciens.enib.fr
Tue Aug 2 23:01:00 GMT 2011
config/global/download.in | 11 +----------
scripts/functions | 18 ++++--------------
2 files changed, 5 insertions(+), 24 deletions(-)
# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
# Date 1312319485 -7200
# Node ID 3738af3d8a081863eebf49299c329dd58acbcca7
# Parent 8dd5af369141b2590279bfc6ed1fa8d0b4e6cca5
scripts/functions: always prefer the mirror
Currently, the mirror can be used either:
- as a fallback in case upstream is unavailable (default behavior)
- as the preferred source for downloads
But the most common use-case seems to provide a truely-LAN mirror
to speed up downloads in big corpos', and/or provide a 'trusted'
source for the tarballs.
So, make the following changes;
- if a mirror is specified, always try that before trying upstream
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
diff --git a/config/global/download.in b/config/global/download.in
--- a/config/global/download.in
+++ b/config/global/download.in
@@ -37,17 +37,10 @@
*not* on your LAN, for example on another subnet of your company's
network, or a mirror on the Internet.
-if USE_MIRROR
-
-config PREFER_MIRROR
- bool
- prompt "Prefer the mirror"
- help
- Say 'Y' here if you prefer the LAN mirror over the upstream sources.
-
config MIRROR_BASE_URL
string
prompt "Base URL"
+ depends on USE_MIRROR
default "http://ymorin.is-a-geek.org/mirrors/"
help
This is the base URL searched in for tarballs.
@@ -63,8 +56,6 @@
The mirror is available at:
http://ymorin.is-a-geek.org/mirrors/
-endif # USE_MIRROR
-
config CONNECT_TIMEOUT
int
prompt "Connection timeout"
diff --git a/scripts/functions b/scripts/functions
--- a/scripts/functions
+++ b/scripts/functions
@@ -513,7 +513,7 @@
# Usage: CT_GetFile <basename> [.extension] <url> [url ...]
CT_GetFile() {
local ext
- local url URLS LAN_URLS
+ local url URLS
local file="$1"
local first_ext
shift
@@ -532,23 +532,13 @@
# Try to retrieve the file
CT_DoLog EXTRA "Retrieving '${file}'"
- URLS="$@"
-
# Add URLs on the LAN mirror
- LAN_URLS=
if [ "${CT_USE_MIRROR}" = "y" ]; then
CT_TestOrAbort "Please set the mirror base URL" -n "${CT_MIRROR_BASE_URL}"
- LAN_URLS="${LAN_URLS} ${CT_MIRROR_BASE_URL}/${file%-*}"
- LAN_URLS="${LAN_URLS} ${CT_MIRROR_BASE_URL}"
+ URLS="${CT_MIRROR_BASE_URL}/${file%-*} ${CT_MIRROR_BASE_URL}"
+ fi
- if [ "${CT_PREFER_MIRROR}" = "y" ]; then
- CT_DoLog DEBUG "Pre-pending LAN mirror URLs"
- URLS="${LAN_URLS} ${URLS}"
- else
- CT_DoLog DEBUG "Appending LAN mirror URLs"
- URLS="${URLS} ${LAN_URLS}"
- fi
- fi
+ URLS+="${URLS:+ }${*}"
# Scan all URLs in turn, and try to grab a tarball from there
# Do *not* try git trees (ext=/.git), this is handled in a specific
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list