Skip to content

Commit 81af75b

Browse files
authored
Revert "Enable installation of versioned historical stdlibs (#2614)" (#2637)
This reverts commit 092703e.
1 parent 13ed937 commit 81af75b

File tree

4 files changed

+36
-52
lines changed

4 files changed

+36
-52
lines changed

src/Operations.jl

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ function update_manifest!(env::EnvCache, pkgs::Vector{PackageSpec}, deps_map, ju
131131
entry = PackageEntry(;name = pkg.name, version = pkg.version, pinned = pkg.pinned,
132132
tree_hash = pkg.tree_hash, path = pkg.path, repo = pkg.repo, uuid=pkg.uuid)
133133
if is_stdlib(pkg.uuid, julia_version)
134-
# Only set stdlib versions for versioned (external) stdlibs
135-
entry.version = stdlib_version(pkg.uuid, julia_version)
134+
# do not set version for stdlibs
135+
entry.version = nothing
136136
end
137137
if Types.is_project(env, pkg)
138138
entry.deps = env.project.deps
@@ -384,7 +384,6 @@ function deps_graph(env::EnvCache, registries::Vector{Registry.RegistryInstance}
384384
union!(uuids, fixed_uuids)
385385
end
386386

387-
stdlibs_for_julia_version = Types.get_last_stdlibs(julia_version)
388387
seen = Set{UUID}()
389388

390389
# pkg -> version -> (dependency => compat):
@@ -400,21 +399,13 @@ function deps_graph(env::EnvCache, registries::Vector{Registry.RegistryInstance}
400399
for uuid in unseen
401400
push!(seen, uuid)
402401
uuid in keys(fixed) && continue
403-
all_compat_u = get_or_make!(all_compat, uuid)
404-
405-
uuid_is_stdlib = false
406-
stdlib_name = ""
407-
stdlib_version = nothing
408-
if haskey(stdlibs_for_julia_version, uuid)
409-
uuid_is_stdlib = true
410-
stdlib_name, stdlib_version = stdlibs_for_julia_version[uuid]
411-
end
402+
all_compat_u = get_or_make!(all_compat, uuid)
412403

413-
# If we're requesting resolution of a package that is an unregistered stdlib (or one
414-
# that tracks no version information) we must special-case it here. This is further
415-
# complicated by the fact that we can ask this question relative to a Julia version.
416-
if is_unregistered_stdlib(uuid) || (uuid_is_stdlib && stdlib_version === nothing)
417-
path = Types.stdlib_path(stdlibs_for_julia_version[uuid][1])
404+
# If we're requesting resolution of a package that is an stdlib and is not registered,
405+
# we must special-case it here. This is further complicated by the fact that we can
406+
# ask this question relative to a particular Julia version.
407+
if is_unregistered_stdlib(uuid) || is_stdlib(uuid, julia_version)
408+
path = Types.stdlib_path(stdlibs()[uuid])
418409
proj_file = projectfile_path(path; strict=true)
419410
@assert proj_file !== nothing
420411
proj = read_package(proj_file)

src/Types.jl

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using SHA
2222

2323
export UUID, SHA1, VersionRange, VersionSpec,
2424
PackageSpec, PackageEntry, EnvCache, Context, GitRepo, Context!, Manifest, Project, err_rep,
25-
PkgError, pkgerror, has_name, has_uuid, is_stdlib, stdlib_version, is_unregistered_stdlib, stdlibs, write_env, write_env_usage, parse_toml, find_registered!,
25+
PkgError, pkgerror, has_name, has_uuid, is_stdlib, is_unregistered_stdlib, stdlibs, write_env, write_env_usage, parse_toml, find_registered!,
2626
project_resolve!, project_deps_resolve!, manifest_resolve!, registry_resolve!, stdlib_resolve!, handle_repos_develop!, handle_repos_add!, ensure_resolved,
2727
registered_name,
2828
manifest_info,
@@ -411,9 +411,8 @@ is_stdlib(uuid::UUID) = uuid in keys(stdlibs())
411411

412412
# Find the entry in `STDLIBS_BY_VERSION`
413413
# that corresponds to the requested version, and use that.
414-
# If we can't find one, defaults to `UNREGISTERED_STDLIBS`
415414
function get_last_stdlibs(julia_version::VersionNumber)
416-
last_stdlibs = UNREGISTERED_STDLIBS
415+
last_stdlibs = Dict{UUID,String}()
417416
for (version, stdlibs) in STDLIBS_BY_VERSION
418417
if VersionNumber(julia_version.major, julia_version.minor, julia_version.patch) < version
419418
break
@@ -422,10 +421,6 @@ function get_last_stdlibs(julia_version::VersionNumber)
422421
end
423422
return last_stdlibs
424423
end
425-
# If `julia_version` is set to `nothing`, that means (essentially) treat all registered
426-
# stdlibs as normal packages so that we get the latest versions of everything, ignoring
427-
# julia compat. So we set the list of stdlibs to that of only the unregistered stdlibs.
428-
get_last_stdlibs(::Nothing) = UNREGISTERED_STDLIBS
429424

430425
# Allow asking if something is an stdlib for a particular version of Julia
431426
function is_stdlib(uuid::UUID, julia_version::Union{VersionNumber, Nothing})
@@ -434,24 +429,23 @@ function is_stdlib(uuid::UUID, julia_version::Union{VersionNumber, Nothing})
434429
return is_stdlib(uuid)
435430
end
436431

432+
# If this UUID is known to be unregistered, always return `true`
433+
if haskey(UNREGISTERED_STDLIBS, uuid)
434+
return true
435+
end
436+
437+
# Otherwise, if the `julia_version` is `nothing`, all registered stdlibs
438+
# will be treated like normal packages.
439+
if julia_version === nothing
440+
return false
441+
end
442+
437443
last_stdlibs = get_last_stdlibs(julia_version)
438444
# Note that if the user asks for something like `julia_version = 0.7.0`, we'll
439445
# fall through with an empty `last_stdlibs`, which will always return `false`.
440446
return uuid in keys(last_stdlibs)
441447
end
442448

443-
# Return the version of a stdlib with respect to a particular Julia version, or
444-
# `nothing` if that stdlib is not versioned. We only store version numbers for
445-
# stdlibs that are external and thus could be installed from their repositories,
446-
# e.g. things like `GMP_jll`, `Tar`, etc...
447-
function stdlib_version(uuid::UUID, julia_version::Union{VersionNumber,Nothing})
448-
last_stdlibs = get_last_stdlibs(julia_version)
449-
if !(uuid in keys(last_stdlibs))
450-
return nothing
451-
end
452-
return last_stdlibs[uuid][2]
453-
end
454-
455449
is_unregistered_stdlib(uuid::UUID) = haskey(UNREGISTERED_STDLIBS, uuid)
456450

457451
Context!(kw_context::Vector{Pair{Symbol,Any}})::Context =

test/new.jl

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,6 +2667,16 @@ end
26672667
return only(deps[name])
26682668
end
26692669

2670+
isolate(loaded_depot=true) do
2671+
# Test that adding `NetworkOptions` results in a `Manifest.toml` with no version
2672+
# which means that it was treated as a standard library
2673+
Pkg.add("NetworkOptions")
2674+
block = get_manifest_block("NetworkOptions")
2675+
@test haskey(block, "uuid")
2676+
@test block["uuid"] == networkoptions_uuid
2677+
@test !haskey(block, "version")
2678+
end
2679+
26702680
isolate(loaded_depot=true) do
26712681
# Next, test that if we ask for `v1.5` it DOES have a version, and that GMP_jll installs v6.1.X
26722682
Pkg.add(["NetworkOptions", "GMP_jll"]; julia_version=v"1.5")
@@ -2688,7 +2698,7 @@ end
26882698
artifacts_toml = joinpath(gmp_jll_dir, "Artifacts.toml")
26892699
@test isfile(artifacts_toml)
26902700
meta = artifact_meta("GMP", artifacts_toml)
2691-
@test meta !== nothing
2701+
@test meta != nothing
26922702

26932703
gmp_artifact_path = artifact_path(Base.SHA1(meta["git-tree-sha1"]))
26942704
@test isdir(gmp_artifact_path)
@@ -2700,22 +2710,8 @@ end
27002710
end
27012711
end
27022712

2703-
# Next, test that if we ask for `v1.6`, GMP_jll gets `v6.2.0`, and for `v1.7`, it gets `v6.2.1`
2704-
function do_gmp_test(julia_version, gmp_version)
2705-
isolate(loaded_depot=true) do
2706-
Pkg.add("GMP_jll"; julia_version)
2707-
gmp_block = get_manifest_block("GMP_jll")
2708-
@test haskey(gmp_block, "uuid")
2709-
@test gmp_block["uuid"] == gmp_jll_uuid
2710-
@test haskey(gmp_block, "version")
2711-
@test startswith(gmp_block["version"], string(gmp_version))
2712-
end
2713-
end
2714-
do_gmp_test(v"1.6", v"6.2.0")
2715-
do_gmp_test(v"1.7", v"6.2.1")
2716-
27172713
isolate(loaded_depot=true) do
2718-
# Next, test that if we ask for `nothing`, NetworkOptions has a `version` but `LinearAlgebra` does not.
2714+
# Next, test that if we ask for `nothing`, NetworkOptions has a `version` but `LinearAlgebra` does.
27192715
Pkg.add(["LinearAlgebra", "NetworkOptions"]; julia_version=nothing)
27202716
no_block = get_manifest_block("NetworkOptions")
27212717
@test haskey(no_block, "uuid")

test/resolve.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@ end
435435
return versions[idx]
436436
end
437437

438+
#=
439+
# DISABLED FOR NOW BECAUSE THE JLL INTO STDLIBS BROKE IT
438440
# First, we're going to resolve for specific versions of Julia, ensuring we get the right dep versions:
439441
Pkg.Registry.download_default_registries(Pkg.stdout_f())
440442
ctx = Pkg.Types.Context(;julia_version=v"1.5")
@@ -467,6 +469,7 @@ end
467469
mpfr = find_by_name(versions, "MPFR_jll")
468470
@test mpfr !== nothing
469471
@test mpfr.version.major == 4 && mpfr.version.minor == 0
472+
=#
470473
end
471474
end
472475

0 commit comments

Comments
 (0)