# HG changeset patch # User "Yann E. MORIN" # Date 1184518830 0 # Node ID 4d5beae7cb872b563086ee0b5b61e24cf4723059 # Parent 97276c2a1a6905fa1d781599055099c6f18064f4 Add an option to save downloaded tarballs to local tarballs directory. Sanitise CT_GetFile. Change some messages (Copying -> Retrieving). diff -r 97276c2a1a69 -r 4d5beae7cb87 config/global.in --- a/config/global.in Sun Jul 15 16:32:14 2007 +0000 +++ b/config/global.in Sun Jul 15 17:00:30 2007 +0000 @@ -147,6 +147,15 @@ If you have previously downloaded the tarballs, enter the PATH where you stored them here. +config SAVE_TARBALLS + bool + prompt "Save new tarballs" + default n + depends on LOCAL_TARBALLS_DIR != "" + help + If you say 'y' here, new doanloaded tarballs will be saved in the + directory you entered above. + config PREFIX_DIR string prompt "Prefix directory" diff -r 97276c2a1a69 -r 4d5beae7cb87 scripts/build/tools/sstrip.sh --- a/scripts/build/tools/sstrip.sh Sun Jul 15 16:32:14 2007 +0000 +++ b/scripts/build/tools/sstrip.sh Sun Jul 15 17:00:30 2007 +0000 @@ -42,7 +42,7 @@ return 0 fi if [ -f "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" ]; then - CT_DoLog EXTRA "Copying \"sstrip.c\" from local copy" + CT_DoLog EXTRA "Retrieving \"sstrip.c\" from local copy" cp -v "${CT_LOCAL_TARBALLS_DIR}/sstrip.c" \ "${CT_TARBALLS_DIR}/sstrip.c" 2>&1 |CT_DoLog ALL return 0 diff -r 97276c2a1a69 -r 4d5beae7cb87 scripts/functions --- a/scripts/functions Sun Jul 15 16:32:14 2007 +0000 +++ b/scripts/functions Sun Jul 15 17:00:30 2007 +0000 @@ -334,24 +334,31 @@ # or, as a failover, a file without extension. # Try local copy first, if it exists for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do + CT_DoLog DEBUG "Trying \"${CT_LOCAL_TARBALLS_DIR}/${file}${ext}\"" if [ -r "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" -a \ "${CT_FORCE_DOWNLOAD}" != "y" ]; then - CT_DoLog EXTRA "Copying \"${file}\" from local copy" + CT_DoLog EXTRA "Retrieving \"${file}\" from local storage" cp -v "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog ALL return 0 fi done # Try to download it - CT_DoLog EXTRA "Retrieving \"${file}\"" + CT_DoLog EXTRA "Retrieving \"${file}\" from network" for ext in ${first_ext} .tar.bz2 .tar.gz .tgz .tar ''; do # Try all urls in turn for url in "$@"; do - case "${url}" in - *) CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\"" - CT_DoGetFile "${url}/${file}${ext}" - ;; - esac - [ -f "${file}${ext}" ] && return 0 || true + CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\"" + CT_DoGetFile "${url}/${file}${ext}" + if [ -f "${file}${ext}" ]; then + # No need to test if the file already exists because + # it does NOT. If it did exist, we'd have been stopped + # above, when looking for local copies. + if [ "${CT_SAVE_TARBALLS}" = "y" ]; then + CT_DoLog EXTRA "Saving \"${file}\" to local storage" + cp -v "${file}${ext}" "${CT_LOCAL_TARBALLS_DIR}" |CT_DoLog ALL + fi + return 0 + fi done done CT_Popd