Add an option to save downloaded tarballs to local tarballs directory.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 15 17:00:30 2007 +0000 (2007-07-15)
changeset 2654d5beae7cb87
parent 264 97276c2a1a69
child 266 6ca745eb9aaa
Add an option to save downloaded tarballs to local tarballs directory.
Sanitise CT_GetFile.
Change some messages (Copying -> Retrieving).
config/global.in
scripts/build/tools/sstrip.sh
scripts/functions
     1.1 --- a/config/global.in	Sun Jul 15 16:32:14 2007 +0000
     1.2 +++ b/config/global.in	Sun Jul 15 17:00:30 2007 +0000
     1.3 @@ -147,6 +147,15 @@
     1.4        If you have previously downloaded the tarballs, enter the PATH where
     1.5        you stored them here.
     1.6  
     1.7 +config SAVE_TARBALLS
     1.8 +    bool
     1.9 +    prompt "Save new tarballs"
    1.10 +    default n
    1.11 +    depends on LOCAL_TARBALLS_DIR != ""
    1.12 +    help
    1.13 +      If you say 'y' here, new doanloaded tarballs will be saved in the
    1.14 +      directory you entered above.
    1.15 +
    1.16  config PREFIX_DIR
    1.17      string
    1.18      prompt "Prefix directory"
     2.1 --- a/scripts/build/tools/sstrip.sh	Sun Jul 15 16:32:14 2007 +0000
     2.2 +++ b/scripts/build/tools/sstrip.sh	Sun Jul 15 17:00:30 2007 +0000
     2.3 @@ -42,7 +42,7 @@
     2.4                  return 0
     2.5              fi
     2.6              if [ -f "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" ]; then
     2.7 -                CT_DoLog EXTRA "Copying \"sstrip.c\" from local copy"
     2.8 +                CT_DoLog EXTRA "Retrieving \"sstrip.c\" from local copy"
     2.9                  cp -v "${CT_LOCAL_TARBALLS_DIR}/sstrip.c"   \
    2.10                        "${CT_TARBALLS_DIR}/sstrip.c"         2>&1 |CT_DoLog ALL
    2.11                  return 0
     3.1 --- a/scripts/functions	Sun Jul 15 16:32:14 2007 +0000
     3.2 +++ b/scripts/functions	Sun Jul 15 17:00:30 2007 +0000
     3.3 @@ -334,24 +334,31 @@
     3.4      # or, as a failover, a file without extension.
     3.5      # Try local copy first, if it exists
     3.6      for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do
     3.7 +        CT_DoLog DEBUG "Trying \"${CT_LOCAL_TARBALLS_DIR}/${file}${ext}\""
     3.8          if [ -r "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" -a \
     3.9               "${CT_FORCE_DOWNLOAD}" != "y" ]; then
    3.10 -            CT_DoLog EXTRA "Copying \"${file}\" from local copy"
    3.11 +            CT_DoLog EXTRA "Retrieving \"${file}\" from local storage"
    3.12              cp -v "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL
    3.13              return 0
    3.14          fi
    3.15      done
    3.16      # Try to download it
    3.17 -    CT_DoLog EXTRA "Retrieving \"${file}\""
    3.18 +    CT_DoLog EXTRA "Retrieving \"${file}\" from network"
    3.19      for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do
    3.20          # Try all urls in turn
    3.21          for url in "$@"; do
    3.22 -            case "${url}" in
    3.23 -                *)  CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\""
    3.24 -                    CT_DoGetFile "${url}/${file}${ext}"
    3.25 -                    ;;
    3.26 -            esac
    3.27 -            [ -f "${file}${ext}" ] && return 0 || true
    3.28 +            CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\""
    3.29 +            CT_DoGetFile "${url}/${file}${ext}"
    3.30 +            if [ -f "${file}${ext}" ]; then
    3.31 +                # No need to test if the file already exists because
    3.32 +                # it does NOT. If it did exist, we'd have been stopped
    3.33 +                # above, when looking for local copies.
    3.34 +                if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
    3.35 +                    CT_DoLog EXTRA "Saving \"${file}\" to local storage"
    3.36 +                    cp -v "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" |CT_DoLog ALL
    3.37 +                fi
    3.38 +                return 0
    3.39 +            fi
    3.40          done
    3.41      done
    3.42      CT_Popd