Skip to content

Commit 6fddac8

Browse files
KristofferCKristofferCfingolfin
authored
allow finding stdlibs that are normal packages in the manifest but are now stdlibs (#60061)
This helps handling manifest from earlier julia versions. This is kind of the `locate` version of the `identify` fallback in #56148. Need to write a test when this happens (and verify that this fix works). Noted in a slack #gripes comment. --------- Co-authored-by: KristofferC <[email protected]> Co-authored-by: Max Horn <[email protected]>
1 parent 443ec10 commit 6fddac8

File tree

4 files changed

+69
-1
lines changed

4 files changed

+69
-1
lines changed

base/loading.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ function locate_package_env(pkg::PkgId, stopenv::Union{String, Nothing}=nothing)
463463
path = manifest_uuid_path(env, pkg)
464464
# missing is used as a sentinel to stop looking further down in envs
465465
if path === missing
466+
# Before stopping, try stdlib fallback
467+
is_stdlib(pkg) && @goto stdlib_fallback
466468
path = nothing
467469
@goto done
468470
end
@@ -474,6 +476,7 @@ function locate_package_env(pkg::PkgId, stopenv::Union{String, Nothing}=nothing)
474476
stopenv == env && break
475477
end
476478
end
479+
@label stdlib_fallback
477480
# Allow loading of stdlibs if the name/uuid are given
478481
# e.g. if they have been explicitly added to the project/manifest
479482
mbypath = manifest_uuid_path(Sys.STDLIB, pkg)

test/loading.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,12 +1537,21 @@ end
15371537
mktempdir() do depot
15381538
# This manifest has a LibGit2 entry that is missing LibGit2_jll, which should be
15391539
# handled by falling back to the stdlib Project.toml for dependency truth.
1540-
badmanifest_test_dir = joinpath(@__DIR__, "project", "deps", "BadStdlibDeps.jl")
1540+
badmanifest_test_dir = joinpath(@__DIR__, "project", "deps", "BadStdlibDeps")
15411541
@test success(addenv(
15421542
`$(Base.julia_cmd()) --project=$badmanifest_test_dir --startup-file=no -e 'using LibGit2'`,
15431543
"JULIA_DEPOT_PATH" => depot * Base.Filesystem.pathsep(),
15441544
))
15451545
end
1546+
mktempdir() do depot
1547+
# This manifest has a LibGit2 entry that has a LibGit2_jll with a git-tree-hash1
1548+
# which simulates an old manifest where LibGit2_jll was not a stdlib
1549+
badmanifest_test_dir2 = joinpath(@__DIR__, "project", "deps", "BadStdlibDeps2")
1550+
@test success(addenv(
1551+
`$(Base.julia_cmd()) --project=$badmanifest_test_dir2 --startup-file=no -e 'using LibGit2'`,
1552+
"JULIA_DEPOT_PATH" => depot * Base.Filesystem.pathsep(),
1553+
))
1554+
end
15461555
end
15471556

15481557
@testset "code coverage disabled during precompilation" begin
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
julia_version = "1.12.0-DEV"
4+
manifest_format = "2.0"
5+
project_hash = "dc9d33b0ee13d9466bdb75b8d375808a534a79ec"
6+
7+
[[deps.Artifacts]]
8+
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
9+
version = "1.11.0"
10+
11+
[[deps.LibGit2]]
12+
deps = ["NetworkOptions", "Printf", "SHA", "LibGit2_jll"]
13+
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
14+
version = "1.11.0"
15+
16+
# This is an stdlib but intentionally has a git-tree-sha1 because
17+
# we are emulating that the manifest comes from a version where
18+
# LibGit2_jll was not an stdlib
19+
[[deps.LibGit2_jll]]
20+
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"]
21+
git-tree-sha1 = "1111111111111111111111111111111111111111"
22+
uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5"
23+
version = "1.8.0+0"
24+
25+
[[deps.LibSSH2_jll]]
26+
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
27+
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
28+
version = "1.11.0+1"
29+
30+
[[deps.Libdl]]
31+
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
32+
version = "1.11.0"
33+
34+
[[deps.MbedTLS_jll]]
35+
deps = ["Artifacts", "Libdl"]
36+
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
37+
version = "2.28.6+1"
38+
39+
[[deps.NetworkOptions]]
40+
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
41+
version = "1.2.0"
42+
43+
[[deps.Printf]]
44+
deps = ["Unicode"]
45+
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
46+
version = "1.11.0"
47+
48+
[[deps.SHA]]
49+
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
50+
version = "0.7.0"
51+
52+
[[deps.Unicode]]
53+
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
54+
version = "1.11.0"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[deps]
2+
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"

0 commit comments

Comments
 (0)