Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #38 from JuliaPackaging/sf/use_the_force_luke
Browse files Browse the repository at this point in the history
Ensure that `install()` passes `force` through to `download_verify()`
  • Loading branch information
staticfloat authored Feb 21, 2018
2 parents 551d3e1 + e46583f commit 73e2215
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Prefix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ function install(tarball_url::AbstractString,
verify(tarball_path, hash; verbose=verbose)
else
# If not, actually download it
download_verify(tarball_url, hash, tarball_path; verbose=verbose)
download_verify(tarball_url, hash, tarball_path;
force=force, verbose=verbose)
end

if verbose
Expand Down
15 changes: 14 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -593,14 +593,27 @@ const libfoo_downloads = Dict(
sleep(2)

open(tmpfile, "w") do f
write(f, "hehehehe")
write(f, "not the correct contents")
end

@test_throws ErrorException download_verify(url, hash, tmpfile; verbose=true)

# This should return `false`, signifying that the download had to erase
# the previously downloaded file.
@test !download_verify(url, hash, tmpfile; verbose=true, force=true)

# Now let's test that install() works the same way; freaking out if
# the local path has been messed with, unless `force` has been given:
tarball_path = joinpath(prefix, "downloads", basename(url))
try mkpath(dirname(tarball_path)) end
open(tarball_path, "w") do f
write(f, "not the correct contents")
end

@test_throws ErrorException install(url, hash; prefix=prefix, verbose=true)
@test install(url, hash; prefix=prefix, verbose=true, force=true)
@test satisfied(fooifier; verbose=true)
@test satisfied(libfoo; verbose=true)
end

# Test a bad download fails properly
Expand Down

0 comments on commit 73e2215

Please sign in to comment.