Loading bin/ruby-build +6 −1 Original line number Diff line number Diff line Loading @@ -317,7 +317,12 @@ http_head_aria2c() { } http_get_aria2c() { aria2c -o "${2:--}" ${ARIA2_OPTS} "$1" local out="${2:-$(mktemp "out.XXXXXX")}" if aria2c --allow-overwrite=true -o "${out}" ${ARIA2_OPTS} "$1" >&4; then [ -n "$2" ] || cat "${out}" else false fi } http_head_curl() { Loading test/cache.bats +3 −3 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ setup() { @test "packages are saved to download cache" { stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/without-checksum Loading Loading @@ -59,7 +59,7 @@ setup() { stub shasum true "echo invalid" "echo $checksum" stub aria2c "--dry-run * : true" \ "-o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2" "--allow-overwrite=true -o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" touch "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" Loading @@ -76,7 +76,7 @@ setup() { @test "nonexistent cache directory is ignored" { stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" export RUBY_BUILD_CACHE_PATH="${TMP}/nonexistent" Loading test/checksum.bats +9 −9 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL without checksum" { stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/without-checksum Loading @@ -20,7 +20,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with valid checksum" { stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum Loading @@ -34,7 +34,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with invalid checksum" { stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-invalid-checksum Loading @@ -48,7 +48,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with checksum but no shasum support" { stub shasum false stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum Loading @@ -62,7 +62,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with valid md5 checksum" { stub md5 true "echo 83e6d7725e20166024a1eb74cde80677" stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-md5-checksum Loading @@ -76,7 +76,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with md5 checksum but no md5 support" { stub md5 false stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-md5-checksum Loading @@ -90,7 +90,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package with invalid checksum" { stub shasum true "echo invalid" stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum Loading Loading @@ -126,7 +126,7 @@ DEF stub shasum true \ "echo invalid" \ "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" export -n RUBY_BUILD_CACHE_PATH export RUBY_BUILD_BUILD_PATH="${TMP}/build" Loading @@ -145,7 +145,7 @@ DEF } @test "package URL with checksum of unexpected length" { stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" run_inline_definition <<DEF install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.gz#checksum_of_unexpected_length" copy Loading test/mirror.bats +8 −8 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL without checksum bypasses mirror" { stub shasum true stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/without-checksum echo "$output" >&2 Loading @@ -24,7 +24,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with checksum but no shasum support bypasses mirror" { stub shasum false stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum Loading @@ -42,7 +42,7 @@ export RUBY_BUILD_ARIA2_OPTS= stub shasum true "echo $checksum" stub aria2c "--dry-run $mirror_url : true" \ "-o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2" "--allow-overwrite=true -o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" install_fixture definitions/with-checksum Loading @@ -60,7 +60,7 @@ export RUBY_BUILD_ARIA2_OPTS= stub shasum true "echo $checksum" stub aria2c "--dry-run $mirror_url : false" \ "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum Loading @@ -78,8 +78,8 @@ export RUBY_BUILD_ARIA2_OPTS= stub shasum true "echo invalid" "echo $checksum" stub aria2c "--dry-run $mirror_url : true" \ "-o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2" \ "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" "--allow-overwrite=true -o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \ "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum echo "$output" >&2 Loading @@ -98,7 +98,7 @@ export RUBY_BUILD_ARIA2_OPTS= stub shasum true "echo $checksum" stub aria2c "--dry-run : true" \ "-o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2" \ "--allow-overwrite=true -o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \ install_fixture definitions/with-checksum Loading @@ -115,7 +115,7 @@ export RUBY_BUILD_ARIA2_OPTS= local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" stub shasum true "echo $checksum" stub aria2c "-o * https://cache.ruby-lang.org/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * https://cache.ruby-lang.org/* : cp $FIXTURE_ROOT/\${4##*/} \$3" run_inline_definition <<DEF install_package "package-1.0.0" "https://cache.ruby-lang.org/packages/package-1.0.0.tar.gz#ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" copy Loading Loading
bin/ruby-build +6 −1 Original line number Diff line number Diff line Loading @@ -317,7 +317,12 @@ http_head_aria2c() { } http_get_aria2c() { aria2c -o "${2:--}" ${ARIA2_OPTS} "$1" local out="${2:-$(mktemp "out.XXXXXX")}" if aria2c --allow-overwrite=true -o "${out}" ${ARIA2_OPTS} "$1" >&4; then [ -n "$2" ] || cat "${out}" else false fi } http_head_curl() { Loading
test/cache.bats +3 −3 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ setup() { @test "packages are saved to download cache" { stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/without-checksum Loading Loading @@ -59,7 +59,7 @@ setup() { stub shasum true "echo invalid" "echo $checksum" stub aria2c "--dry-run * : true" \ "-o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2" "--allow-overwrite=true -o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" touch "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" Loading @@ -76,7 +76,7 @@ setup() { @test "nonexistent cache directory is ignored" { stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" export RUBY_BUILD_CACHE_PATH="${TMP}/nonexistent" Loading
test/checksum.bats +9 −9 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL without checksum" { stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/without-checksum Loading @@ -20,7 +20,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with valid checksum" { stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum Loading @@ -34,7 +34,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with invalid checksum" { stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-invalid-checksum Loading @@ -48,7 +48,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with checksum but no shasum support" { stub shasum false stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum Loading @@ -62,7 +62,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with valid md5 checksum" { stub md5 true "echo 83e6d7725e20166024a1eb74cde80677" stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-md5-checksum Loading @@ -76,7 +76,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with md5 checksum but no md5 support" { stub md5 false stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-md5-checksum Loading @@ -90,7 +90,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package with invalid checksum" { stub shasum true "echo invalid" stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum Loading Loading @@ -126,7 +126,7 @@ DEF stub shasum true \ "echo invalid" \ "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" export -n RUBY_BUILD_CACHE_PATH export RUBY_BUILD_BUILD_PATH="${TMP}/build" Loading @@ -145,7 +145,7 @@ DEF } @test "package URL with checksum of unexpected length" { stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" run_inline_definition <<DEF install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.gz#checksum_of_unexpected_length" copy Loading
test/mirror.bats +8 −8 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL without checksum bypasses mirror" { stub shasum true stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/without-checksum echo "$output" >&2 Loading @@ -24,7 +24,7 @@ export RUBY_BUILD_ARIA2_OPTS= @test "package URL with checksum but no shasum support bypasses mirror" { stub shasum false stub aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum Loading @@ -42,7 +42,7 @@ export RUBY_BUILD_ARIA2_OPTS= stub shasum true "echo $checksum" stub aria2c "--dry-run $mirror_url : true" \ "-o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2" "--allow-overwrite=true -o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" install_fixture definitions/with-checksum Loading @@ -60,7 +60,7 @@ export RUBY_BUILD_ARIA2_OPTS= stub shasum true "echo $checksum" stub aria2c "--dry-run $mirror_url : false" \ "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum Loading @@ -78,8 +78,8 @@ export RUBY_BUILD_ARIA2_OPTS= stub shasum true "echo invalid" "echo $checksum" stub aria2c "--dry-run $mirror_url : true" \ "-o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2" \ "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2" "--allow-overwrite=true -o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \ "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" install_fixture definitions/with-checksum echo "$output" >&2 Loading @@ -98,7 +98,7 @@ export RUBY_BUILD_ARIA2_OPTS= stub shasum true "echo $checksum" stub aria2c "--dry-run : true" \ "-o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2" \ "--allow-overwrite=true -o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \ install_fixture definitions/with-checksum Loading @@ -115,7 +115,7 @@ export RUBY_BUILD_ARIA2_OPTS= local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" stub shasum true "echo $checksum" stub aria2c "-o * https://cache.ruby-lang.org/* : cp $FIXTURE_ROOT/\${3##*/} \$2" stub aria2c "--allow-overwrite=true -o * https://cache.ruby-lang.org/* : cp $FIXTURE_ROOT/\${4##*/} \$3" run_inline_definition <<DEF install_package "package-1.0.0" "https://cache.ruby-lang.org/packages/package-1.0.0.tar.gz#ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" copy Loading