Commit 243e6fbe by Sam Stephenson

Support conditional package installation with `--if <test>`

parent 3a426d13
...@@ -93,15 +93,15 @@ file_is_not_empty() { ...@@ -93,15 +93,15 @@ file_is_not_empty() {
} }
install_package() { install_package() {
install_package_using "tarball" 1 $* install_package_using "tarball" 1 "$@"
} }
install_git() { install_git() {
install_package_using "git" 2 $* install_package_using "git" 2 "$@"
} }
install_svn() { install_svn() {
install_package_using "svn" 2 $* install_package_using "svn" 2 "$@"
} }
install_package_using() { install_package_using() {
...@@ -110,10 +110,22 @@ install_package_using() { ...@@ -110,10 +110,22 @@ install_package_using() {
local package_name="$3" local package_name="$3"
shift 3 shift 3
local fetch_args=( "$package_name" "${@:1:$package_type_nargs}" )
local make_args=( "$package_name" )
local arg last_arg
for arg in "${@:$(( $package_type_nargs + 1 ))}"; do
if [ "$last_arg" = "--if" ]; then
"$arg" || return 0
elif [ "$arg" != "--if" ]; then
make_args["${#make_args[@]}"]="$arg"
fi
last_arg="$arg"
done
pushd "$BUILD_PATH" >&4 pushd "$BUILD_PATH" >&4
"fetch_${package_type}" "$package_name" $* "fetch_${package_type}" "${fetch_args[@]}"
shift $(($package_type_nargs)) make_package "${make_args[@]}"
make_package "$package_name" $*
popd >&4 popd >&4
{ echo "Installed ${package_name} to ${PREFIX_PATH}" { echo "Installed ${package_name} to ${PREFIX_PATH}"
......
if has_broken_mac_openssl; then install_package "openssl-1.0.1c" "https://www.openssl.org/source/openssl-1.0.1c.tar.gz#ae412727c8c15b67880aef7bd2999b2e" mac_openssl --if has_broken_mac_openssl
install_package "openssl-1.0.1c" "https://www.openssl.org/source/openssl-1.0.1c.tar.gz#ae412727c8c15b67880aef7bd2999b2e" mac_openssl
fi
install_git "ruby-2.0.0-dev" "https://github.com/ruby/ruby.git" "trunk" autoconf standard verify_openssl install_git "ruby-2.0.0-dev" "https://github.com/ruby/ruby.git" "trunk" autoconf standard verify_openssl
if has_broken_mac_openssl; then install_package "openssl-1.0.1c" "https://www.openssl.org/source/openssl-1.0.1c.tar.gz#ae412727c8c15b67880aef7bd2999b2e" mac_openssl --if has_broken_mac_openssl
install_package "openssl-1.0.1c" "https://www.openssl.org/source/openssl-1.0.1c.tar.gz#ae412727c8c15b67880aef7bd2999b2e" mac_openssl
fi
install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz#36c852831d02cf90508c29852361d01b" install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz#36c852831d02cf90508c29852361d01b"
install_package "ruby-2.0.0-preview1" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-preview1.tar.gz#c7d73f3ddb6d25e7733626ddbad04158" standard verify_openssl install_package "ruby-2.0.0-preview1" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-preview1.tar.gz#c7d73f3ddb6d25e7733626ddbad04158" standard verify_openssl
if has_broken_mac_openssl; then install_package "openssl-1.0.1c" "https://www.openssl.org/source/openssl-1.0.1c.tar.gz#ae412727c8c15b67880aef7bd2999b2e" mac_openssl --if has_broken_mac_openssl
install_package "openssl-1.0.1c" "https://www.openssl.org/source/openssl-1.0.1c.tar.gz#ae412727c8c15b67880aef7bd2999b2e" mac_openssl
fi
install_package "ruby-2.0.0-preview2" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-preview2.tar.gz#eaddcbf63dc775708de45c7a81ab54b9" standard verify_openssl install_package "ruby-2.0.0-preview2" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-preview2.tar.gz#eaddcbf63dc775708de45c7a81ab54b9" standard verify_openssl
if has_broken_mac_openssl; then install_package "openssl-1.0.1c" "https://www.openssl.org/source/openssl-1.0.1c.tar.gz#ae412727c8c15b67880aef7bd2999b2e" mac_openssl --if has_broken_mac_openssl
install_package "openssl-1.0.1c" "https://www.openssl.org/source/openssl-1.0.1c.tar.gz#ae412727c8c15b67880aef7bd2999b2e" mac_openssl
fi
install_package "ruby-2.0.0-rc1" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-rc1.tar.gz#7d587dde85e0edf7a2e4f6783e6c0e2e" standard verify_openssl install_package "ruby-2.0.0-rc1" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-rc1.tar.gz#7d587dde85e0edf7a2e4f6783e6c0e2e" standard verify_openssl
if has_broken_mac_openssl; then install_package "openssl-1.0.1c" "https://www.openssl.org/source/openssl-1.0.1c.tar.gz#ae412727c8c15b67880aef7bd2999b2e" mac_openssl --if has_broken_mac_openssl
install_package "openssl-1.0.1c" "https://www.openssl.org/source/openssl-1.0.1c.tar.gz#ae412727c8c15b67880aef7bd2999b2e" mac_openssl
fi
install_package "ruby-2.0.0-rc2" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-rc2.tar.gz#9d5e6f26db7c8c3ddefc81fdb19bd41a" standard verify_openssl install_package "ruby-2.0.0-rc2" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-rc2.tar.gz#9d5e6f26db7c8c3ddefc81fdb19bd41a" standard verify_openssl
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment