scripts/functions: do not abort on failed download

In case of glibc/eglibc, some add-ons that were previously external are
now internal (bundled with the main sources).

So we do not want to fail if an add-on tarball can't be downloaded; we
want to post-pone the check until we can extract the main archive.

So:
 - try to download the tarball
 - if it fails, print a warning instead of calling CT_Abort
 - return 1

So, components that want to catch the error and want to handle it can,
while components that do not will gracefuly fail thanks to our catching
every errors.

Bonus: it works without changing any existing retrieval procedure! :-)

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
Yann E. MORIN" 2011-05-30 23:24:11 +02:00
parent b4620c6640
commit 0c73370023

View File

@ -426,7 +426,7 @@ CT_GetFileExtension() {
# to find the requested URL (think about snapshots, different layouts
# for different gcc versions, etc...).
CT_DoGetFile() {
local dest="${1##*/}"
local dest="${1}"
local tmp="${dest}.tmp-dl"
# OK, just look if we have them...
# We are sure at least one is available, ./configure checked for it.
@ -530,7 +530,6 @@ CT_GetFile() {
# Try to retrieve the file
CT_DoLog EXTRA "Retrieving '${file}'"
CT_Pushd "${CT_TARBALLS_DIR}"
URLS="$@"
@ -558,16 +557,18 @@ CT_GetFile() {
for url in ${URLS}; do
CT_DoLog DEBUG "Trying '${url}/${file}${ext}'"
CT_DoGetFile "${url}/${file}${ext}"
if [ -f "${file}${ext}" ]; then
if [ -f "${CT_TARBALLS_DIR}/${file}${ext}" ]; then
CT_DoLog DEBUG "Got '${file}' from the Internet"
CT_SaveLocal "${CT_TARBALLS_DIR}/${file}${ext}"
return 0
fi
done
done
CT_Popd
CT_Abort "Could not retrieve '${file}'."
# Just warn, someone may want to catch and handle the error
# (eg. glibc/eglibc add-ons can be missing).
CT_DoLog WARN "Could not retrieve '${file}'."
return 1
}
# Checkout from CVS, and build the associated tarball