Commit cb1128ca by Mislav Marohnić

Merge branch 'relative-paths'

parents d35349e8 b37427b6
...@@ -772,6 +772,8 @@ fi ...@@ -772,6 +772,8 @@ fi
PREFIX_PATH="${ARGUMENTS[1]}" PREFIX_PATH="${ARGUMENTS[1]}"
if [ -z "$PREFIX_PATH" ]; then if [ -z "$PREFIX_PATH" ]; then
usage usage
elif [ "${PREFIX_PATH#/}" = "$PREFIX_PATH" ]; then
PREFIX_PATH="${PWD}/${PREFIX_PATH}"
fi fi
if [ -z "$TMPDIR" ]; then if [ -z "$TMPDIR" ]; then
......
#!/usr/bin/env bats #!/usr/bin/env bats
load test_helper load test_helper
export RUBY_BUILD_CACHE_PATH="$TMP/cache"
setup() {
mkdir -p "$INSTALL_ROOT"
stub md5 false
stub curl false
}
cached_tarball() {
mkdir -p "$RUBY_BUILD_CACHE_PATH"
pushd "$RUBY_BUILD_CACHE_PATH" >/dev/null
tarball "$1"
popd >/dev/null
}
tarball() { tarball() {
local name="$1" local name="$1"
local path="$TMP/$name" local path="$PWD/$name"
local configure="$path/configure" local configure="$path/configure"
mkdir -p "$path" mkdir -p "$path"
...@@ -14,68 +28,67 @@ echo "$name: \$@" > build.log ...@@ -14,68 +28,67 @@ echo "$name: \$@" > build.log
OUT OUT
chmod +x "$configure" chmod +x "$configure"
tar czf "${path}.tgz" -C "$TMP" "$name" tar czf "${path}.tar.gz" -C "${path%/*}" "$name"
echo "${path}.tgz" }
stub_make_install() {
stub make \
' : echo make "$@" >> build.log' \
"install : cat build.log >> '$INSTALL_ROOT/build.log'"
} }
stub_download() { assert_build_log() {
stub curl "-C - -o * -*S* $1 : cp '$(tarball "$2")' \$4" run cat "$INSTALL_ROOT/build.log"
assert_output
} }
@test "yaml is installed for ruby" { @test "yaml is installed for ruby" {
mkdir -p "$INSTALL_ROOT/bin" cached_tarball "yaml-0.1.4"
cached_tarball "ruby-2.0.0"
stub md5 false
stub brew false stub brew false
stub_download "http://pyyaml.org/*" "yaml-0.1.4" stub_make_install
stub_download "http://ruby-lang.org/*" "ruby-2.0.0" stub_make_install
stub make \
' : echo make "$@" >> build.log' \
"install : cp build.log '$INSTALL_ROOT/yaml.log'" \
' : echo make "$@" >> build.log' \
"install : cp build.log '$INSTALL_ROOT/ruby.log'"
install_fixture definitions/needs-yaml install_fixture definitions/needs-yaml
assert_success assert_success
unstub curl
unstub make unstub make
run cat "$INSTALL_ROOT/yaml.log" assert_build_log <<OUT
assert_output <<OUT
yaml-0.1.4: --prefix=$INSTALL_ROOT yaml-0.1.4: --prefix=$INSTALL_ROOT
make -j 2 make -j 2
OUT
run cat "$INSTALL_ROOT/ruby.log"
assert_output <<OUT
ruby-2.0.0: --prefix=$INSTALL_ROOT ruby-2.0.0: --prefix=$INSTALL_ROOT
make -j 2 make -j 2
OUT OUT
} }
@test "yaml is linked from Homebrew" { @test "yaml is linked from Homebrew" {
cached_tarball "ruby-2.0.0"
brew_libdir="$TMP/homebrew-yaml" brew_libdir="$TMP/homebrew-yaml"
mkdir -p "$INSTALL_ROOT/bin"
mkdir -p "$brew_libdir" mkdir -p "$brew_libdir"
stub md5 false
stub brew "--prefix libyaml : echo '$brew_libdir'" stub brew "--prefix libyaml : echo '$brew_libdir'"
stub_download "http://ruby-lang.org/*" "ruby-2.0.0" stub_make_install
stub make \
' : echo make "$@" >> build.log' \
"install : cp build.log '$INSTALL_ROOT/ruby.log'"
install_fixture definitions/needs-yaml install_fixture definitions/needs-yaml
assert_success assert_success
unstub brew unstub brew
unstub curl
unstub make unstub make
run cat "$INSTALL_ROOT/ruby.log" assert_build_log <<OUT
assert_output <<OUT
ruby-2.0.0: --prefix=$INSTALL_ROOT --with-libyaml-dir=$brew_libdir ruby-2.0.0: --prefix=$INSTALL_ROOT --with-libyaml-dir=$brew_libdir
make -j 2 make -j 2
OUT OUT
} }
@test "custom relative install destination" {
export RUBY_BUILD_CACHE_PATH="$FIXTURE_ROOT"
cd "$TMP"
install_fixture definitions/without-checksum ./here
assert_success
assert [ -x ./here/bin/package ]
}
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