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
c1bd4134
Commit
c1bd4134
authored
Oct 26, 2013
by
Mislav Marohnić
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'failed-download'
parents
85f54709
51d8e512
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
8 deletions
+33
-8
bin/ruby-build
+10
-8
test/fetch.bats
+14
-0
test/test_helper.bash
+9
-0
No files found.
bin/ruby-build
View file @
c1bd4134
...
...
@@ -244,13 +244,12 @@ fetch_tarball() {
tar_args
=
"
${
tar_args
/z/j
}
"
fi
symlink_tarball_from_cache
"
$package_filename
"
"
$checksum
"
||
{
if
!
symlink_tarball_from_cache
"
$package_filename
"
"
$checksum
"
;
then
echo
"Downloading
${
package_filename
}
..."
>
&2
{
http head
"
$mirror_url
"
&&
download_tarball
"
$mirror_url
"
"
$package_filename
"
"
$checksum
"
}
||
http head
"
$mirror_url
"
&&
download_tarball
"
$mirror_url
"
"
$package_filename
"
"
$checksum
"
||
download_tarball
"
$package_url
"
"
$package_filename
"
"
$checksum
"
}
fi
{
if
tar
$tar_args
"
$package_filename
"
;
then
if
[
-z
"
$KEEP_BUILD_PATH
"
]
;
then
...
...
@@ -283,9 +282,12 @@ download_tarball() {
echo
"->
$package_url
"
>
&2
{
http get
"
$package_url
"
"
$package_filename
"
verify_checksum
"
$package_filename
"
"
$checksum
"
}
>
&4 2>&1
||
return
1
if
http get
"
$package_url
"
"
$package_filename
"
>
&4 2>&1
;
then
verify_checksum
"
$package_filename
"
"
$checksum
"
>
&4 2>&1
||
return
1
else
echo
"error: failed to download
$package_filename
"
>
&2
return
1
fi
if
[
-n
"
$RUBY_BUILD_CACHE_PATH
"
]
;
then
local
cached_package_filename
=
"
${
RUBY_BUILD_CACHE_PATH
}
/
$package_filename
"
...
...
test/fetch.bats
0 → 100644
View file @
c1bd4134
#!/usr/bin/env bats
load test_helper
export RUBY_BUILD_SKIP_MIRROR=1
export RUBY_BUILD_CACHE_PATH=
@test "failed download displays error message" {
stub curl false
install_fixture definitions/without-checksum
assert_failure
assert_output_contains "> http://example.com/packages/package-1.0.0.tar.gz"
assert_output_contains "error: failed to download package-1.0.0.tar.gz"
}
test/test_helper.bash
View file @
c1bd4134
...
...
@@ -94,3 +94,12 @@ assert_output() {
fi
assert_equal
"
$expected
"
"
$output
"
}
assert_output_contains
()
{
local
expected
=
"
$1
"
echo
"
$output
"
|
grep
-F
"
$expected
"
>
/dev/null
||
{
{
echo
"expected output to contain
$expected
"
echo
"actual:
$output
"
}
| flunk
}
}
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