Import recent changes from ruby-build 20140204

This commit is contained in:
Yamashita Yuu 2014-02-08 19:31:35 +09:00
parent e0547de922
commit 719e6db358
4 changed files with 73 additions and 9 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PYTHON_BUILD_VERSION="20140110.1" PYTHON_BUILD_VERSION="20140204"
set -E set -E
exec 3<&2 # preserve original stderr at fd 3 exec 3<&2 # preserve original stderr at fd 3
@ -548,6 +548,8 @@ build_package_standard() {
local PACKAGE_CONFIGURE_OPTS_ARRAY="${package_var_name}_CONFIGURE_OPTS_ARRAY[@]" local PACKAGE_CONFIGURE_OPTS_ARRAY="${package_var_name}_CONFIGURE_OPTS_ARRAY[@]"
local PACKAGE_MAKE_OPTS="${package_var_name}_MAKE_OPTS" local PACKAGE_MAKE_OPTS="${package_var_name}_MAKE_OPTS"
local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]" local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]"
local PACKAGE_MAKE_INSTALL_OPTS="${package_var_name}_MAKE_INSTALL_OPTS"
local PACKAGE_MAKE_INSTALL_OPTS_ARRAY="${package_var_name}_MAKE_INSTALL_OPTS_ARRAY[@]"
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS" local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
[ "$package_var_name" = "PYTHON" ] && use_homebrew_readline || true [ "$package_var_name" = "PYTHON" ] && use_homebrew_readline || true
@ -561,7 +563,7 @@ build_package_standard() {
) >&4 2>&1 ) >&4 2>&1
{ "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}" { "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}"
"$MAKE" install "$MAKE" install $MAKE_INSTALL_OPTS ${!PACKAGE_MAKE_INSTALL_OPTS} "${!PACKAGE_MAKE_INSTALL_OPTS_ARRAY}"
} >&4 2>&1 } >&4 2>&1
} }
@ -678,7 +680,7 @@ install_jruby_launcher() {
fix_jruby_shebangs() { fix_jruby_shebangs() {
for file in "${PREFIX_PATH}/bin"/*; do for file in "${PREFIX_PATH}/bin"/*; do
if [ "$(head -c 20 "$file")" = "#!/usr/bin/env jruby" ]; then if [ "$(head -c 20 "$file")" = "#!/usr/bin/env jruby" ]; then
sed -i.bak -E "1s:.+:#\!${PREFIX_PATH}/bin/jruby:" "$file" sed -i.bak "1 s:.*:#\!${PREFIX_PATH}\/bin\/jruby:" "$file"
rm "$file".bak rm "$file".bak
fi fi
done done

View file

@ -47,7 +47,7 @@ OUT
stub_make_install() { stub_make_install() {
stub "$MAKE" \ stub "$MAKE" \
" : echo \"$MAKE \$@\" >> build.log" \ " : echo \"$MAKE \$@\" >> build.log" \
"install : cat build.log >> '$INSTALL_ROOT/build.log'" "install : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'"
} }
assert_build_log() { assert_build_log() {
@ -56,7 +56,7 @@ assert_build_log() {
} }
@test "yaml is installed for python" { @test "yaml is installed for python" {
cached_tarball "yaml-0.1.4" cached_tarball "yaml-0.1.5"
cached_tarball "Python-3.2.1" cached_tarball "Python-3.2.1"
stub brew false stub brew false
@ -69,15 +69,17 @@ assert_build_log() {
unstub make unstub make
assert_build_log <<OUT assert_build_log <<OUT
yaml-0.1.4: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib yaml-0.1.5: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install
OUT OUT
} }
@test "apply python patch before building" { @test "apply python patch before building" {
cached_tarball "yaml-0.1.4" cached_tarball "yaml-0.1.5"
cached_tarball "Python-3.2.1" cached_tarball "Python-3.2.1"
stub brew false stub brew false
@ -92,11 +94,13 @@ OUT
unstub patch unstub patch
assert_build_log <<OUT assert_build_log <<OUT
yaml-0.1.4: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib yaml-0.1.5: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install
patch -p0 -i - patch -p0 -i -
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install
OUT OUT
} }
@ -118,6 +122,7 @@ OUT
assert_build_log <<OUT assert_build_log <<OUT
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib CPPFLAGS=-I$brew_libdir/include LDFLAGS=-L$brew_libdir/lib Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib CPPFLAGS=-I$brew_libdir/include LDFLAGS=-L$brew_libdir/lib
make -j 2 make -j 2
make install
OUT OUT
} }
@ -141,6 +146,7 @@ DEF
assert_build_log <<OUT assert_build_log <<OUT
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib CPPFLAGS=-I$readline_libdir/include LDFLAGS=-L$readline_libdir/lib Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib CPPFLAGS=-I$readline_libdir/include LDFLAGS=-L$readline_libdir/lib
make -j 2 make -j 2
make install
OUT OUT
} }
@ -166,6 +172,7 @@ DEF
assert_build_log <<OUT assert_build_log <<OUT
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib CPPFLAGS=-I$readline_libdir/include LDFLAGS=-L$readline_libdir/lib Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib CPPFLAGS=-I$readline_libdir/include LDFLAGS=-L$readline_libdir/lib
make -j 2 make -j 2
make install
OUT OUT
} }
@ -188,6 +195,7 @@ DEF
assert_build_log <<OUT assert_build_log <<OUT
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install
OUT OUT
} }
@ -211,6 +219,47 @@ DEF
assert_build_log <<OUT assert_build_log <<OUT
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
make -j 4 make -j 4
make install
OUT
}
@test "setting PYTHON_MAKE_INSTALL_OPTS to a multi-word string" {
cached_tarball "Python-3.2.1"
stub_make_install
export PYTHON_MAKE_INSTALL_OPTS="DOGE=\"such wow\""
run_inline_definition <<DEF
install_package "Python-3.2.1" "http://python.org/ftp/python/3.2.1/Python-3.2.1.tar.gz"
DEF
assert_success
unstub make
assert_build_log <<OUT
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
make -j 2
make install DOGE="such wow"
OUT
}
@test "setting MAKE_INSTALL_OPTS to a multi-word string" {
cached_tarball "Python-3.2.1"
stub_make_install
export MAKE_INSTALL_OPTS="DOGE=\"such wow\""
run_inline_definition <<DEF
install_package "Python-3.2.1" "http://python.org/ftp/python/3.2.1/Python-3.2.1.tar.gz"
DEF
assert_success
unstub make
assert_build_log <<OUT
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
make -j 2
make install DOGE="such wow"
OUT OUT
} }
@ -261,6 +310,7 @@ DEF
apply -p1 -i /my/patch.diff apply -p1 -i /my/patch.diff
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
make -j 2 make -j 2
make install
OUT OUT
} }

View file

@ -1,2 +1,2 @@
install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz" --if needs_yaml install_package "yaml-0.1.5" "http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz" --if needs_yaml
install_package "Python-3.2.1" "http://python.org/ftp/python/3.2.1/Python-3.2.1.tar.gz" install_package "Python-3.2.1" "http://python.org/ftp/python/3.2.1/Python-3.2.1.tar.gz"

View file

@ -17,6 +17,18 @@ load test_helper
assert [ -e share/python-build/pypy-2.0 ] assert [ -e share/python-build/pypy-2.0 ]
} }
@test "build definitions don't have the executable bit" {
cd "$TMP"
PREFIX="${PWD}/usr" run "${BATS_TEST_DIRNAME}/../install.sh"
assert_success ""
run $BASH -c 'ls -l usr/share/python-build | tail -2 | cut -d" " -f1'
assert_output <<OUT
-rw-r--r--
-rw-r--r--
OUT
}
@test "overwrites old installation" { @test "overwrites old installation" {
cd "$TMP" cd "$TMP"
mkdir -p bin share/python-build mkdir -p bin share/python-build