Prevent loading user's aria2.conf (fixes #625)

This commit is contained in:
Yamashita, Yuu 2016-06-22 00:38:38 +00:00
parent f64f7c7c49
commit c4e012d5e3
2 changed files with 17 additions and 2 deletions

View file

@ -336,12 +336,12 @@ http() {
} }
http_head_aria2c() { http_head_aria2c() {
aria2c --dry-run ${ARIA2_OPTS} "$1" >&4 2>&1 aria2c --dry-run --no-conf=true ${ARIA2_OPTS} "$1" >&4 2>&1
} }
http_get_aria2c() { http_get_aria2c() {
local out="${2:-$(mktemp "out.XXXXXX")}" local out="${2:-$(mktemp "out.XXXXXX")}"
if aria2c --allow-overwrite=true -o "${out}" ${ARIA2_OPTS} "$1" >&4; then if aria2c --allow-overwrite=true --no-conf=true -o "${out}" ${ARIA2_OPTS} "$1" >&4; then
[ -n "$2" ] || cat "${out}" [ -n "$2" ] || cat "${out}"
else else
false false

View file

@ -3,6 +3,7 @@
load test_helper load test_helper
export PYTHON_BUILD_SKIP_MIRROR=1 export PYTHON_BUILD_SKIP_MIRROR=1
export PYTHON_BUILD_CACHE_PATH= export PYTHON_BUILD_CACHE_PATH=
export PYTHON_BUILD_ARIA2_OPTS=
setup() { setup() {
ensure_not_found_in_path aria2c ensure_not_found_in_path aria2c
@ -19,6 +20,20 @@ setup() {
assert_output_contains "error: failed to download package-1.0.0.tar.gz" assert_output_contains "error: failed to download package-1.0.0.tar.gz"
} }
@test "using aria2c if available" {
stub aria2c "--allow-overwrite=true --no-conf=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$4"
install_fixture definitions/without-checksum
assert_success
assert_output <<OUT
Downloading package-1.0.0.tar.gz...
-> http://example.com/packages/package-1.0.0.tar.gz
Installing package-1.0.0...
Installed package-1.0.0 to ${TMP}/install
OUT
unstub aria2c
}
@test "fetching from git repository" { @test "fetching from git repository" {
stub git "clone --depth 1 --branch master http://example.com/packages/package.git package-dev : mkdir package-dev" stub git "clone --depth 1 --branch master http://example.com/packages/package.git package-dev : mkdir package-dev"