Changeset 1157 in svn


Ignore:
Timestamp:
2012-10-29T12:42:35Z (3 years ago)
Author:
Xuefer
Message:

use simple and stupid rules to download files

Location:
autobuild
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • autobuild/.config

    r970 r1157  
    1616scriptsDir="$topdir/scripts"
    1717
    18 mirror="cn.php.net"
     18mirror="cn2.php.net"
     19phpFiles_foreach() {
     20    local version
    1921
    20 phpVersions=(5.1.6 5.2.17 5.3.14 5.4.4)
     22    for version in 5.4.8 5.3.18; do
     23        $1 php-$version.tar.bz2 \
     24            http://$mirror/get/php-$version.tar.bz2/from/$mirror/mirror \
     25            "http://museum.php.net/php5/php-$version.tar.bz2"
     26        $1 php-$version-nts-Win32-VC9-x86.zip http://windows.php.net/downloads/releases/php-$version-nts-Win32-VC9-x86.zip
     27        $1 php-$version-Win32-VC9-x86.zip     http://windows.php.net/downloads/releases/php-$version-Win32-VC9-x86.zip
     28    done
     29
     30    version=5.2.17
     31    $1 php-$version.tar.bz2 \
     32        http://$mirror/get/php-$version.tar.bz2/from/$mirror/mirror \
     33        "http://museum.php.net/php5/php-$version.tar.bz2"
     34    $1 php-$version-nts-Win32-VC6-x86.zip http://windows.php.net/downloads/releases/php-$version-nts-Win32-VC6-x86.zip
     35    $1 php-$version-Win32-VC6-x86.zip     http://windows.php.net/downloads/releases/php-$version-Win32-VC6-x86.zip
     36
     37    version=5.1.6
     38    $1 php-$version.tar.bz2 \
     39        http://$mirror/get/php-$version.tar.bz2/from/$mirror/mirror \
     40        "http://museum.php.net/php5/php-$version.tar.bz2"
     41    $1 php-$version-Win32-VC6-x86.zip http://museum.php.net/php5/php-$version-Win32.zip
     42}
     43
     44phpVersions=(5.1.6 5.2.17 5.3.18 5.4.8)
    2145arches=(x86 x64)
    2246compilers=(VC6 VC9)
  • autobuild/scripts/download

    r913 r1157  
    99        return 0
    1010    fi
    11     begin "Downloading $url to $file"; {
     11    begin "from $url"; {
    1212        if type aria2c >/dev/null 2>/dev/null; then
    1313            (
     
    2525        rm -f "$file.tmp"
    2626    };
    27     [[ -z $ret ]] && end || end "not found"
     27    [[ $ret -eq 0 ]] && end || end "not found"
    2828   
    2929    return $ret
     
    4040}
    4141
    42 downloadPhp() {
    43     local filename
    44     local arch
    45     local compiler
    46     local nts
    47     local downloaded
    48     local type
    49     local snapVersion
     42download_x() {
     43    local filename=$1
     44    shift
    5045
    51     case "$phpVersion" in
    52     *-dev-*)
    53         type="snaps"
    54         snapVersion=-${phpVersion##*-}
    55         phpVersion=${phpVersion%-*}
    56         filename="php$phpVersion$snapVersion.tar.bz2"
    57         filename=${filename/0.-dev-/-}
    58         download "$sourceDir/php-$phpVersion$snapVersion.tar.bz2" "http://snaps.php.net/$filename"
    59         ;;
    60     *)
    61         type="releases"
    62         filename="php-$phpVersion.tar.bz2"
    63         target="$sourceDir/$filename"
    64         download "$target" "http://$mirror/get/$filename/from/$mirror/mirror" \
    65         || download "$target" "http://museum.php.net/php5/$filename"
    66         ;;
    67     esac
    68 
    69     downloaded=
    70     for nts in '' '-nts'; do
    71         case "$phpVersion" in
    72         4.*|5.0.*|5.1.*)
    73             ;;
    74         *)
    75             for compiler in "${compilers[@]}"; do
    76                 for arch in "${arches[@]}"; do
    77                     filename=php-$phpVersion$nts-Win32-$compiler-$arch$snapVersion.zip
    78                     download "$sourceDir/$filename" "http://windows.php.net/downloads/$type/$filename"
    79                     if [[ -s "$sourceDir/$filename" ]]; then
    80                         downloaded=1
    81                     fi
    82                 done
    83             done
    84         esac
    85     done
    86     if [[ -z $downloaded ]]; then
    87         filename=php-$phpVersion-Win32.zip
    88         target="$sourceDir/$filename"
    89         download "$target" "http://$mirror/get/$filename/from/$mirror/mirror" \
    90         || download "$target" "http://museum.php.net/php5/$filename"
    91     fi
     46    local url
     47    local ret=1
     48    begin "Downloading $filename"; {
     49        while [ $# -gt 0 ]; do
     50            url=$1
     51            shift
     52            if download "$sourceDir/$filename" $url; then
     53                ret=0
     54                break
     55            fi
     56        done
     57    };
     58    [[ $ret -eq 0 ]] && end "downloaded" || end "not found"
     59    return $ret
    9260}
    9361
    9462trap cleanup exit
    9563
    96 case $# in
    97 0)
    98     foreachPhpVersion downloadPhp
    99     ;;
    100 1)
    101     loadPhpVersion "$1"
    102     downloadPhp
    103     ;;
    104 esac
    105 
    106 exit 0
     64phpFiles_foreach download_x
Note: See TracChangeset for help on using the changeset viewer.