add install_zip

This commit is contained in:
Yamashita Yuu 2013-05-16 22:39:15 +09:00
parent c24207428c
commit dd0e3feae3
4 changed files with 81 additions and 38 deletions

View file

@ -108,6 +108,10 @@ install_jar() {
install_package_using "jar" 1 "$@"
}
install_zip() {
install_package_using "zip" 1 "$@"
}
install_package_using() {
local package_type="$1"
local package_type_nargs="$2"
@ -384,6 +388,48 @@ download_jar() {
download_tarball "$@"
}
fetch_zip() {
local package_name="$1"
local package_url="$2"
local mirror_url
local checksum
if [ "$package_url" != "${package_url/\#}" ]; then
checksum="${package_url#*#}"
package_url="${package_url%%#*}"
if [ -n "$PYTHON_BUILD_MIRROR_URL" ]; then
mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum"
fi
fi
local package_filename="${package_name}.zip"
symlink_zip_from_cache "$package_filename" "$checksum" || {
echo "Downloading ${package_filename}..." >&2
{ http head "$mirror_url" &&
download_zip "$mirror_url" "$package_filename" "$checksum"
} ||
download_zip "$package_url" "$package_filename" "$checksum"
}
{ if unzip "$package_filename"; then
if [ -z "$KEEP_BUILD_PATH" ]; then
rm -f "$package_filename"
else
true
fi
fi
} >&4 2>&1
}
symlink_zip_from_cache() {
symlink_tarball_from_cache "$@"
}
download_zip() {
download_tarball "$@"
}
build_package() {
local package_name="$1"
shift

View file

@ -1,27 +1,26 @@
case "$(uname -s)" in
"Darwin" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-osx64.tar.bz2#1c293253e8e4df411c3dd59dff82a663"
install_package "pypy-1.8" "https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-osx64.tar.bz2#1c293253e8e4df411c3dd59dff82a663" pypy
;;
"Linux" )
case "$(uname -m)" in
"i386" | "i486" | "i586" | "i686" | "i786" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux.tar.bz2#c4a1d11e0283a390d9e9b801a4633b9f"
install_package "pypy-1.8" "https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux.tar.bz2#c4a1d11e0283a390d9e9b801a4633b9f" pypy
;;
"x86_64" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux64.tar.bz2#3b81363ccbc042dfdda2fabbf419e788"
install_package "pypy-1.8" "https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux64.tar.bz2#3b81363ccbc042dfdda2fabbf419e788" pypy
;;
esac
;;
"CYGWIN"* | "MINGW"* )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-win32.zip#1af8ee722721e9f5fd06b61af530ecb3"
# FIXME: never tested on Windows
install_zip "pypy-1.8" "https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-win32.zip#1af8ee722721e9f5fd06b61af530ecb3" pypy
;;
* )
echo "pypy-1.8 is not available." 1>&2
exit 1
;;
esac
if [ -z "$PYPY_URL" ]; then
echo "pypy is not available." 1>&2
exit 1
else
install_package "pypy-1.8" "$PYPY_URL" pypy
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python
fi
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python

View file

@ -1,27 +1,26 @@
case "$(uname -s)" in
"Darwin" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-osx64.tar.bz2#aad9c4b7b827583e37fe8ae0f7cfe0ff"
install_package "pypy-1.9" "https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-osx64.tar.bz2#aad9c4b7b827583e37fe8ae0f7cfe0ff" pypy
;;
"Linux" )
case "$(uname -m)" in
"i386" | "i486" | "i586" | "i686" | "i786" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux.tar.bz2#1a08c88642434fc2e0e4256d351f48db"
install_package "pypy-1.9" "https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux.tar.bz2#1a08c88642434fc2e0e4256d351f48db" pypy
;;
"x86_64" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux64.tar.bz2#201d2cce2557e40c784473b471ee1b6b"
install_package "pypy-1.9" "https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux64.tar.bz2#201d2cce2557e40c784473b471ee1b6b" pypy
;;
esac
;;
"CYGWIN"* | "MINGW"* )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-win32.zip#e7655066baed3c7bbbca7df617817dd5"
# FIXME: never tested on Windows
install_zip "pypy-1.9" "https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-win32.zip#e7655066baed3c7bbbca7df617817dd5" pypy
;;
* )
echo "pypy-1.9 is not available." 1>&2
exit 1
;;
esac
if [ -z "$PYPY_URL" ]; then
echo "pypy is not available." 1>&2
exit 1
else
install_package "pypy-1.9" "$PYPY_URL" pypy
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python
fi
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python

View file

@ -1,32 +1,31 @@
case "$(uname -s)" in
"Darwin" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-osx64.tar.bz2#39837722da4a03ca03eda187aafa13bb"
install_package "pypy-2.0" "https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-osx64.tar.bz2#39837722da4a03ca03eda187aafa13bb" "pypy"
;;
"Linux" )
case "$(uname -m)" in
"armel" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-alpha-arm-armel.tar.bz2#b9c36b99296c85a590c3e480b05d5a13"
install_package "pypy-2.0-alpha-arm" "https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-alpha-arm-armel.tar.bz2#b9c36b99296c85a590c3e480b05d5a13" "pypy"
;;
"armhf" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-alpha-arm-armhf.tar.bz2#2565ce68b4032eb306d998e722495694"
install_package "pypy-2.0-alpha-arm" "https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-alpha-arm-armhf.tar.bz2#2565ce68b4032eb306d998e722495694" "pypy"
;;
"i386" | "i486" | "i586" | "i686" | "i786" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-linux.tar.bz2#267c46ed8c591da19b6091aa90fa9acf"
install_package "pypy-2.0" "https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-linux.tar.bz2#267c46ed8c591da19b6091aa90fa9acf" "pypy"
;;
"x86_64" )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-linux64.tar.bz2#2fe3298ac9354fbdb57a38472936b823"
install_package "pypy-2.0" "https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-linux64.tar.bz2#2fe3298ac9354fbdb57a38472936b823" "pypy"
esac
;;
"CYGWIN"* | "MINGW"* )
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-win32.zip#f0d051c2b612b64dff496a6c0f3654fb"
# FIXME: never tested on Windows
install_zip "pypy-2.0" "https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-win32.zip#f0d051c2b612b64dff496a6c0f3654fb" "pypy"
;;
* )
echo "pypy-2.0 is not available." 1>&2
exit 1
;;
esac
if [ -z "$PYPY_URL" ]; then
echo "pypy is not available." 1>&2
exit 1
else
install_package "pypy-2.0" "$PYPY_URL" pypy
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python
fi
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python