Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ruby-build
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ruby-build
Commits
abb7d1d2
Commit
abb7d1d2
authored
May 25, 2016
by
SHIBATA Hiroshi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #904 from yyuu/download-aria2c
Use `aria2c` the "ultra fast" downloader if available
parents
3dbbf902
f998f105
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
67 deletions
+72
-67
bin/ruby-build
+20
-18
test/build.bats
+1
-1
test/cache.bats
+12
-11
test/checksum.bats
+18
-17
test/fetch.bats
+1
-1
test/mirror.bats
+20
-19
No files found.
bin/ruby-build
View file @
abb7d1d2
...
@@ -300,42 +300,40 @@ http() {
...
@@ -300,42 +300,40 @@ http() {
local
file
=
"
$3
"
local
file
=
"
$3
"
[
-n
"
$url
"
]
||
return
1
[
-n
"
$url
"
]
||
return
1
if
type
curl &>/dev/null
;
then
if
type
aria2c &>/dev/null
;
then
"http_
${
method
}
_aria2c"
"
$url
"
"
$file
"
elif
type
curl &>/dev/null
;
then
"http_
${
method
}
_curl"
"
$url
"
"
$file
"
"http_
${
method
}
_curl"
"
$url
"
"
$file
"
elif
type
wget &>/dev/null
;
then
elif
type
wget &>/dev/null
;
then
"http_
${
method
}
_wget"
"
$url
"
"
$file
"
"http_
${
method
}
_wget"
"
$url
"
"
$file
"
else
else
echo
"error: please install
\`
curl
\`
or
\`
wget
\`
and try again"
>
&2
echo
"error: please install
\`
aria2c
\`
,
\`
curl
\`
or
\`
wget
\`
and try again"
>
&2
exit
1
exit
1
fi
fi
}
}
http_head_aria2c
()
{
aria2c
--dry-run
${
ARIA2_OPTS
}
"
$1
"
>
&4 2>&1
}
http_get_aria2c
()
{
aria2c
-o
"
${
2
:-
-
}
"
${
ARIA2_OPTS
}
"
$1
"
}
http_head_curl
()
{
http_head_curl
()
{
options
=
""
curl
-qsILf
${
CURL_OPTS
}
"
$1
"
>
&4 2>&1
[
-n
"
${
IPV4
}
"
]
&&
options
=
"--ipv4"
[
-n
"
${
IPV6
}
"
]
&&
options
=
"--ipv6"
curl
-qsILf
${
options
}
"
$1
"
>
&4 2>&1
}
}
http_get_curl
()
{
http_get_curl
()
{
options
=
""
curl
-q
-o
"
${
2
:-
-
}
"
-sSLf
${
CURL_OPTS
}
"
$1
"
[
-n
"
${
IPV4
}
"
]
&&
options
=
"--ipv4"
[
-n
"
${
IPV6
}
"
]
&&
options
=
"--ipv6"
curl
-q
-o
"
${
2
:-
-
}
"
-sSLf
${
options
}
"
$1
"
}
}
http_head_wget
()
{
http_head_wget
()
{
options
=
""
wget
-q
--spider
${
WGET_OPTS
}
"
$1
"
>
&4 2>&1
[
-n
"
${
IPV4
}
"
]
&&
options
=
"--inet4-only"
[
-n
"
${
IPV6
}
"
]
&&
options
=
"--inet6-only"
wget
-q
--spider
${
options
}
"
$1
"
>
&4 2>&1
}
}
http_get_wget
()
{
http_get_wget
()
{
options
=
""
wget
-nv
${
WGET_OPTS
}
-O
"
${
2
:-
-
}
"
"
$1
"
[
-n
"
${
IPV4
}
"
]
&&
options
=
"--inet4-only"
[
-n
"
${
IPV6
}
"
]
&&
options
=
"--inet6-only"
wget
-nv
${
options
}
-O
"
${
2
:-
-
}
"
"
$1
"
}
}
fetch_tarball
()
{
fetch_tarball
()
{
...
@@ -1239,6 +1237,10 @@ if [ -n "$RUBY_BUILD_SKIP_MIRROR" ] || ! has_checksum_support compute_sha2; then
...
@@ -1239,6 +1237,10 @@ if [ -n "$RUBY_BUILD_SKIP_MIRROR" ] || ! has_checksum_support compute_sha2; then
unset
RUBY_BUILD_MIRROR_URL
unset
RUBY_BUILD_MIRROR_URL
fi
fi
ARIA2_OPTS
=
"
${
RUBY_BUILD_ARIA2_OPTS
}
${
IPV4
+--disable-ipv6=true
}
${
IPV6
+--disable-ipv6=false
}
"
CURL_OPTS
=
"
${
RUBY_BUILD_CURL_OPTS
}
${
IPV4
+--ipv4
}
${
IPV6
+--ipv6
}
"
WGET_OPTS
=
"
${
RUBY_BUILD_WGET_OPTS
}
${
IPV4
+--inet4-only
}
${
IPV6
+--inet6-only
}
"
SEED
=
"
$(
date
"+%Y%m%d%H%M%S"
)
.
$$
"
SEED
=
"
$(
date
"+%Y%m%d%H%M%S"
)
.
$$
"
LOG_PATH
=
"
${
TMP
}
/ruby-build.
${
SEED
}
.log"
LOG_PATH
=
"
${
TMP
}
/ruby-build.
${
SEED
}
.log"
RUBY_BIN
=
"
${
PREFIX_PATH
}
/bin/ruby"
RUBY_BIN
=
"
${
PREFIX_PATH
}
/bin/ruby"
...
...
test/build.bats
View file @
abb7d1d2
...
@@ -10,7 +10,7 @@ export -n RUBY_CONFIGURE_OPTS
...
@@ -10,7 +10,7 @@ export -n RUBY_CONFIGURE_OPTS
setup() {
setup() {
mkdir -p "$INSTALL_ROOT"
mkdir -p "$INSTALL_ROOT"
stub md5 false
stub md5 false
stub
curl
false
stub
aria2c
false
}
}
executable() {
executable() {
...
...
test/cache.bats
View file @
abb7d1d2
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
load test_helper
load test_helper
export RUBY_BUILD_SKIP_MIRROR=1
export RUBY_BUILD_SKIP_MIRROR=1
export RUBY_BUILD_CACHE_PATH="$TMP/cache"
export RUBY_BUILD_CACHE_PATH="$TMP/cache"
export RUBY_BUILD_ARIA2_OPTS=
setup() {
setup() {
mkdir "$RUBY_BUILD_CACHE_PATH"
mkdir "$RUBY_BUILD_CACHE_PATH"
...
@@ -10,19 +11,19 @@ setup() {
...
@@ -10,19 +11,19 @@ setup() {
@test "packages are saved to download cache" {
@test "packages are saved to download cache" {
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/without-checksum
install_fixture definitions/without-checksum
assert_success
assert_success
assert [ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
assert [ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
unstub
curl
unstub
aria2c
}
}
@test "cached package without checksum" {
@test "cached package without checksum" {
stub
curl
stub
aria2c
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$RUBY_BUILD_CACHE_PATH"
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$RUBY_BUILD_CACHE_PATH"
...
@@ -31,13 +32,13 @@ setup() {
...
@@ -31,13 +32,13 @@ setup() {
assert_success
assert_success
assert [ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
assert [ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
unstub
curl
unstub
aria2c
}
}
@test "cached package with valid checksum" {
@test "cached package with valid checksum" {
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub
curl
stub
aria2c
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$RUBY_BUILD_CACHE_PATH"
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$RUBY_BUILD_CACHE_PATH"
...
@@ -47,7 +48,7 @@ setup() {
...
@@ -47,7 +48,7 @@ setup() {
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
assert [ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
...
@@ -57,8 +58,8 @@ setup() {
...
@@ -57,8 +58,8 @@ setup() {
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub shasum true "echo invalid" "echo $checksum"
stub shasum true "echo invalid" "echo $checksum"
stub
curl "-*I
* : true" \
stub
aria2c "--dry-run
* : true" \
"-
q -o * -*S* https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3
"
"-
o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2
"
touch "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz"
touch "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz"
...
@@ -69,13 +70,13 @@ setup() {
...
@@ -69,13 +70,13 @@ setup() {
assert [ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
assert [ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
assert diff -q "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" "${FIXTURE_ROOT}/package-1.0.0.tar.gz"
assert diff -q "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" "${FIXTURE_ROOT}/package-1.0.0.tar.gz"
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
@test "nonexistent cache directory is ignored" {
@test "nonexistent cache directory is ignored" {
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
export RUBY_BUILD_CACHE_PATH="${TMP}/nonexistent"
export RUBY_BUILD_CACHE_PATH="${TMP}/nonexistent"
...
@@ -85,5 +86,5 @@ setup() {
...
@@ -85,5 +86,5 @@ setup() {
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
refute [ -d "$RUBY_BUILD_CACHE_PATH" ]
refute [ -d "$RUBY_BUILD_CACHE_PATH" ]
unstub
curl
unstub
aria2c
}
}
test/checksum.bats
View file @
abb7d1d2
...
@@ -3,106 +3,107 @@
...
@@ -3,106 +3,107 @@
load test_helper
load test_helper
export RUBY_BUILD_SKIP_MIRROR=1
export RUBY_BUILD_SKIP_MIRROR=1
export RUBY_BUILD_CACHE_PATH=
export RUBY_BUILD_CACHE_PATH=
export RUBY_BUILD_ARIA2_OPTS=
@test "package URL without checksum" {
@test "package URL without checksum" {
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/without-checksum
install_fixture definitions/without-checksum
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
}
}
@test "package URL with valid checksum" {
@test "package URL with valid checksum" {
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
@test "package URL with invalid checksum" {
@test "package URL with invalid checksum" {
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/with-invalid-checksum
install_fixture definitions/with-invalid-checksum
assert_failure
assert_failure
refute [ -f "${INSTALL_ROOT}/bin/package" ]
refute [ -f "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
@test "package URL with checksum but no shasum support" {
@test "package URL with checksum but no shasum support" {
stub shasum false
stub shasum false
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
@test "package URL with valid md5 checksum" {
@test "package URL with valid md5 checksum" {
stub md5 true "echo 83e6d7725e20166024a1eb74cde80677"
stub md5 true "echo 83e6d7725e20166024a1eb74cde80677"
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/with-md5-checksum
install_fixture definitions/with-md5-checksum
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub md5
unstub md5
}
}
@test "package URL with md5 checksum but no md5 support" {
@test "package URL with md5 checksum but no md5 support" {
stub md5 false
stub md5 false
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/with-md5-checksum
install_fixture definitions/with-md5-checksum
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub md5
unstub md5
}
}
@test "package with invalid checksum" {
@test "package with invalid checksum" {
stub shasum true "echo invalid"
stub shasum true "echo invalid"
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_failure
assert_failure
refute [ -f "${INSTALL_ROOT}/bin/package" ]
refute [ -f "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
@test "existing tarball in build location is reused" {
@test "existing tarball in build location is reused" {
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub
curl
false
stub
aria2c
false
stub wget false
stub wget false
export -n RUBY_BUILD_CACHE_PATH
export -n RUBY_BUILD_CACHE_PATH
...
@@ -125,7 +126,7 @@ DEF
...
@@ -125,7 +126,7 @@ DEF
stub shasum true \
stub shasum true \
"echo invalid" \
"echo invalid" \
"echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
"echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
export -n RUBY_BUILD_CACHE_PATH
export -n RUBY_BUILD_CACHE_PATH
export RUBY_BUILD_BUILD_PATH="${TMP}/build"
export RUBY_BUILD_BUILD_PATH="${TMP}/build"
...
@@ -144,7 +145,7 @@ DEF
...
@@ -144,7 +145,7 @@ DEF
}
}
@test "package URL with checksum of unexpected length" {
@test "package URL with checksum of unexpected length" {
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
run_inline_definition <<DEF
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
install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.gz#checksum_of_unexpected_length" copy
...
...
test/fetch.bats
View file @
abb7d1d2
...
@@ -10,7 +10,7 @@ setup() {
...
@@ -10,7 +10,7 @@ setup() {
}
}
@test "failed download displays error message" {
@test "failed download displays error message" {
stub
curl
false
stub
aria2c
false
install_fixture definitions/without-checksum
install_fixture definitions/without-checksum
assert_failure
assert_failure
...
...
test/mirror.bats
View file @
abb7d1d2
...
@@ -4,11 +4,12 @@ load test_helper
...
@@ -4,11 +4,12 @@ load test_helper
export RUBY_BUILD_SKIP_MIRROR=
export RUBY_BUILD_SKIP_MIRROR=
export RUBY_BUILD_CACHE_PATH=
export RUBY_BUILD_CACHE_PATH=
export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
export RUBY_BUILD_ARIA2_OPTS=
@test "package URL without checksum bypasses mirror" {
@test "package URL without checksum bypasses mirror" {
stub shasum true
stub shasum true
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/without-checksum
install_fixture definitions/without-checksum
echo "$output" >&2
echo "$output" >&2
...
@@ -16,21 +17,21 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -16,21 +17,21 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
@test "package URL with checksum but no shasum support bypasses mirror" {
@test "package URL with checksum but no shasum support bypasses mirror" {
stub shasum false
stub shasum false
stub
curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
...
@@ -40,15 +41,15 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -40,15 +41,15 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
local mirror_url="${RUBY_BUILD_MIRROR_URL}/$checksum"
local mirror_url="${RUBY_BUILD_MIRROR_URL}/$checksum"
stub shasum true "echo $checksum"
stub shasum true "echo $checksum"
stub
curl "-*I*
$mirror_url : true" \
stub
aria2c "--dry-run
$mirror_url : true" \
"-
q -o * -*S* $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3
"
"-
o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2
"
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
...
@@ -58,15 +59,15 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -58,15 +59,15 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
local mirror_url="${RUBY_BUILD_MIRROR_URL}/$checksum"
local mirror_url="${RUBY_BUILD_MIRROR_URL}/$checksum"
stub shasum true "echo $checksum"
stub shasum true "echo $checksum"
stub
curl "-*I*
$mirror_url : false" \
stub
aria2c "--dry-run
$mirror_url : false" \
"-
q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
"-
o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
...
@@ -76,9 +77,9 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -76,9 +77,9 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
local mirror_url="${RUBY_BUILD_MIRROR_URL}/$checksum"
local mirror_url="${RUBY_BUILD_MIRROR_URL}/$checksum"
stub shasum true "echo invalid" "echo $checksum"
stub shasum true "echo invalid" "echo $checksum"
stub
curl "-*I*
$mirror_url : true" \
stub
aria2c "--dry-run
$mirror_url : true" \
"-
q -o * -*S* $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3
" \
"-
o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2
" \
"-
q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
"-
o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
echo "$output" >&2
echo "$output" >&2
...
@@ -86,7 +87,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -86,7 +87,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
...
@@ -96,15 +97,15 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -96,15 +97,15 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub shasum true "echo $checksum"
stub shasum true "echo $checksum"
stub
curl "-*I*
: true" \
stub
aria2c "--dry-run
: true" \
"-
q -o * -*S* https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3
" \
"-
o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$2
" \
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
...
@@ -114,7 +115,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -114,7 +115,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub shasum true "echo $checksum"
stub shasum true "echo $checksum"
stub
curl "-q -o * -*S* https://cache.ruby-lang.org/* : cp $FIXTURE_ROOT/\${5##*/} \$3
"
stub
aria2c "-o * https://cache.ruby-lang.org/* : cp $FIXTURE_ROOT/\${3##*/} \$2
"
run_inline_definition <<DEF
run_inline_definition <<DEF
install_package "package-1.0.0" "https://cache.ruby-lang.org/packages/package-1.0.0.tar.gz#ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" copy
install_package "package-1.0.0" "https://cache.ruby-lang.org/packages/package-1.0.0.tar.gz#ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" copy
...
@@ -123,6 +124,6 @@ DEF
...
@@ -123,6 +124,6 @@ DEF
assert_success
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
curl
unstub
aria2c
unstub shasum
unstub shasum
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment