Skip to content

Commit b359adf

Browse files
authored
Merge pull request #2336 from JuliaLang/fe/backports-release-1.6
[release-1.6] More backports for Julia 1.6.0
2 parents 20cb14b + e7622dc commit b359adf

File tree

6 files changed

+33
-14
lines changed

6 files changed

+33
-14
lines changed

src/API.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,11 @@ function precompile(ctx::Context; internal_call::Bool=false, kwargs...)
10831083
for (pkg, deps) in depsmap # precompilation loop
10841084
paths = Base.find_all_in_cache_path(pkg)
10851085
sourcepath = Base.locate_package(pkg)
1086-
sourcepath === nothing && continue
1086+
if sourcepath === nothing
1087+
failed_deps[pkg] = "Error: Missing source file for $(pkg)"
1088+
notify(was_processed[pkg])
1089+
continue
1090+
end
10871091
# Heuristic for when precompilation is disabled
10881092
if occursin(r"\b__precompile__\(\s*false\s*\)", read(sourcepath, String))
10891093
notify(was_processed[pkg])

src/Artifacts.jl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,22 @@ function download_artifact(
354354
msg = "Tree Hash Mismatch!\n"
355355
msg *= " Expected git-tree-sha1: $(bytes2hex(tree_hash.bytes))\n"
356356
msg *= " Calculated git-tree-sha1: $(bytes2hex(calc_hash.bytes))"
357+
# Since tree hash calculation is still broken on some systems, e.g. Pkg.jl#1860,
358+
# and Pkg.jl#2317 so we allow setting JULIA_PKG_IGNORE_HASHES=1 to ignore the
359+
# error and move the artifact to the expected location and return true
360+
ignore_hash = get(ENV, "JULIA_PKG_IGNORE_HASHES", nothing) == "1"
361+
if ignore_hash
362+
msg *= "\n\$JULIA_PKG_IGNORE_HASHES is set to 1: ignoring error and moving artifact to the expected location"
363+
end
357364
@error(msg)
358-
# Tree hash calculation is still broken on some systems, e.g. Pkg.jl#1860,
359-
# so we return true here and only raise the warning on the lines above.
360-
# return false
365+
if ignore_hash
366+
# Move it to the location we expected
367+
src = artifact_path(calc_hash; honor_overrides=false)
368+
dst = artifact_path(tree_hash; honor_overrides=false)
369+
mv(src, dst; force=true)
370+
return true
371+
end
372+
return false
361373
end
362374
end
363375

src/Types.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ function Base.:(==)(a::PackageInfo, b::PackageInfo)
14151415
return a.name == b.name && a.version == b.version && a.tree_hash == b.tree_hash &&
14161416
a.is_direct_dep == b.is_direct_dep &&
14171417
a.is_pinned == b.is_pinned && a.is_tracking_path == b.is_tracking_path &&
1418-
a.is_tracking_repo == a.is_tracking_repo &&
1418+
a.is_tracking_repo == b.is_tracking_repo &&
14191419
a.is_tracking_registry == b.is_tracking_registry &&
14201420
a.git_revision == b.git_revision && a.git_source == b.git_source &&
14211421
a.source == b.source && a.dependencies == b.dependencies

src/manifest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function normalize_deps(name, uuid, deps::Vector{String}, manifest::Dict{String,
9696
"but no such entry exists in the manifest.")
9797
end
9898
# should have used dict format instead of vector format
99-
length(infos) == 1 || pkgerror("Invalid manfiest format. ",
99+
length(infos) == 1 || pkgerror("Invalid manifest format. ",
100100
"`$name=$uuid`'s dependency on `$dep` is ambiguous.")
101101
final[dep] = infos[1].uuid
102102
end

test/artifacts.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,17 +268,20 @@ end
268268

269269
# Next, test incorrect download errors
270270
if !Sys.iswindows()
271-
mktempdir() do dir
271+
for ignore_hash in (false, true); withenv("JULIA_PKG_IGNORE_HASHES" => ignore_hash ? "1" : nothing) do; mktempdir() do dir
272272
with_artifacts_directory(dir) do
273273
@test artifact_meta("broken_artifact", joinpath(badifact_dir, "incorrect_gitsha.toml")) != nothing
274274
@test_logs (:error, r"Tree Hash Mismatch!") match_mode=:any begin
275-
# Only warn on wrong tree hash for now (see Pkg.jl#1885)
276-
# @test_throws ErrorException ensure_artifact_installed("broken_artifact", joinpath(badifact_dir, "incorrect_gitsha.toml"))
277-
path = ensure_artifact_installed("broken_artifact", joinpath(badifact_dir, "incorrect_gitsha.toml"))
278-
@test endswith(path, "0000000000000000000000000000000000000000")
275+
if !ignore_hash
276+
@test_throws ErrorException ensure_artifact_installed("broken_artifact", joinpath(badifact_dir, "incorrect_gitsha.toml"))
277+
else
278+
path = ensure_artifact_installed("broken_artifact", joinpath(badifact_dir, "incorrect_gitsha.toml"))
279+
@test endswith(path, "0000000000000000000000000000000000000000")
280+
@test isdir(path)
281+
end
279282
end
280283
end
281-
end
284+
end end end
282285
end
283286

284287
mktempdir() do dir

test/new.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ end
12601260
@test haskey(Pkg.project().dependencies, "Example")
12611261
@test haskey(Pkg.project().dependencies, "Unicode")
12621262
end end
1263-
# `instantiate` lonely manfiest
1263+
# `instantiate` lonely manifest
12641264
isolate(loaded_depot=true) do
12651265
manifest_dir = joinpath(@__DIR__, "manifest", "noproject")
12661266
cd(manifest_dir) do
@@ -1947,7 +1947,7 @@ end
19471947
# Manifest Status API
19481948
isolate(loaded_depot=true) do
19491949
io = PipeBuffer()
1950-
## empty manfiest
1950+
## empty manifest
19511951
Pkg.status(;io=io, mode=Pkg.PKGMODE_MANIFEST)
19521952
@test occursin(r"Status `.+Manifest\.toml` \(empty manifest\)", readline(io))
19531953
# loaded manifest

0 commit comments

Comments
 (0)