scripts/functions: do not abort on failed download
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon May 30 23:24:11 2011 +0200 (2011-05-30)
changeset 2492b6495ef0193c
parent 2491 667054325aab
child 2493 b0eac0056942
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>
scripts/functions
     1.1 --- a/scripts/functions	Tue May 31 01:30:54 2011 +0200
     1.2 +++ b/scripts/functions	Mon May 30 23:24:11 2011 +0200
     1.3 @@ -426,7 +426,7 @@
     1.4  # to find the requested URL (think about snapshots, different layouts
     1.5  # for different gcc versions, etc...).
     1.6  CT_DoGetFile() {
     1.7 -    local dest="${1##*/}"
     1.8 +    local dest="${1}"
     1.9      local tmp="${dest}.tmp-dl"
    1.10      # OK, just look if we have them...
    1.11      # We are sure at least one is available, ./configure checked for it.
    1.12 @@ -530,7 +530,6 @@
    1.13  
    1.14      # Try to retrieve the file
    1.15      CT_DoLog EXTRA "Retrieving '${file}'"
    1.16 -    CT_Pushd "${CT_TARBALLS_DIR}"
    1.17  
    1.18      URLS="$@"
    1.19  
    1.20 @@ -558,16 +557,18 @@
    1.21          for url in ${URLS}; do
    1.22              CT_DoLog DEBUG "Trying '${url}/${file}${ext}'"
    1.23              CT_DoGetFile "${url}/${file}${ext}"
    1.24 -            if [ -f "${file}${ext}" ]; then
    1.25 +            if [ -f "${CT_TARBALLS_DIR}/${file}${ext}" ]; then
    1.26                  CT_DoLog DEBUG "Got '${file}' from the Internet"
    1.27                  CT_SaveLocal "${CT_TARBALLS_DIR}/${file}${ext}"
    1.28                  return 0
    1.29              fi
    1.30          done
    1.31      done
    1.32 -    CT_Popd
    1.33  
    1.34 -    CT_Abort "Could not retrieve '${file}'."
    1.35 +    # Just warn, someone may want to catch and handle the error
    1.36 +    # (eg. glibc/eglibc add-ons can be missing).
    1.37 +    CT_DoLog WARN "Could not retrieve '${file}'."
    1.38 +    return 1
    1.39  }
    1.40  
    1.41  # Checkout from CVS, and build the associated tarball