scripts/functions
changeset 102 ce80474df80e
parent 97 63a30dd47eb8
child 107 06d3636f6611
     1.1 --- a/scripts/functions	Thu May 17 22:10:48 2007 +0000
     1.2 +++ b/scripts/functions	Fri May 18 15:54:42 2007 +0000
     1.3 @@ -299,30 +299,29 @@
     1.4      # File not yet downloaded, try to get it
     1.5      got_it=0
     1.6      # We'd rather have a bzip2'ed tarball, then gzipped, and finally plain tar.
     1.7 +    # Try local copy first, if it exists
     1.8      for ext in .tar.bz2 .tar.gz .tgz .tar; do
     1.9 -        if [ ${got_it} -ne 1 ]; then
    1.10 -            # Try local copy first, if it exists
    1.11 -            if [ -r "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" -a \
    1.12 -                 "${CT_FORCE_DOWNLOAD}" != "y" ]; then
    1.13 -                cp -v "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog DEBUG
    1.14 -                got_it=1
    1.15 -                break 1
    1.16 -            else
    1.17 -                # Try all urls in turn
    1.18 -                for url in "$@"; do
    1.19 -                    case "${url}" in
    1.20 -                        *)  CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\""
    1.21 -                            CT_DoGetFile "${url}/${file}${ext}"
    1.22 -                            ;;
    1.23 -                    esac
    1.24 -                    [ -f "${file}${ext}" ] && got_it=1 && break 2 || true
    1.25 -                done
    1.26 -            fi
    1.27 +        if [ -r "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" -a \
    1.28 +             "${CT_FORCE_DOWNLOAD}" != "y" ]; then
    1.29 +            cp -v "${CT_LOCAL_TARBALLS_DIR}/${file}${ext}" "${file}${ext}" |CT_DoLog DEBUG
    1.30 +            return 0
    1.31          fi
    1.32      done
    1.33 +    # Try to download it
    1.34 +    for ext in .tar.bz2 .tar.gz .tgz .tar; do
    1.35 +        # Try all urls in turn
    1.36 +        for url in "$@"; do
    1.37 +            case "${url}" in
    1.38 +                *)  CT_DoLog DEBUG "Trying \"${url}/${file}${ext}\""
    1.39 +                    CT_DoGetFile "${url}/${file}${ext}"
    1.40 +                    ;;
    1.41 +            esac
    1.42 +            [ -f "${file}${ext}" ] && return 0 || true
    1.43 +        done
    1.44 +    done
    1.45      CT_Popd
    1.46  
    1.47 -    CT_TestAndAbort "Could not download \"${file}\", and not present in \"${CT_LOCAL_TARBALLS_DIR}\"" ${got_it} -eq 0
    1.48 +    CT_Abort "Could not download \"${file}\", and not present in \"${CT_LOCAL_TARBALLS_DIR}\""
    1.49  }
    1.50  
    1.51  # Extract a tarball and patch the resulting sources if necessary.