julia.withPackages: fix transitive weak-deps resolving

This commit is contained in:
Tom McLaughlin 2024-01-03 16:29:56 -08:00
parent 6ce10ae92e
commit 2402762c6f

View File

@ -78,6 +78,7 @@ let
pkgs, deps_map = _resolve(ctx.io, ctx.env, ctx.registries, pkgs, PRESERVE_NONE, ctx.julia_version)
if VERSION >= VersionNumber("1.9")
while true
# Check for weak dependencies, which appear on the RHS of the deps_map but not in pkgs.
# Build up weak_name_to_uuid
uuid_to_name = Dict()
@ -93,8 +94,11 @@ let
end
end
# If we have nontrivial weak dependencies, add each one to the initial pkgs and then re-run _resolve
if !isempty(weak_name_to_uuid)
if isempty(weak_name_to_uuid)
break
end
# We have nontrivial weak dependencies, so add each one to the initial pkgs and then re-run _resolve
println("Found weak dependencies: $(keys(weak_name_to_uuid))")
orig_uuids = Set([pkg.uuid for pkg in orig_pkgs])
@ -113,7 +117,7 @@ let
orig_pkgs[length(orig_pkgs)] = update_package_add(ctx, pkg, entry, false)
end
pkgs, deps_map = _resolve(ctx.io, ctx.env, ctx.registries, orig_pkgs, PRESERVE_NONE, ctx.julia_version)
global pkgs, deps_map = _resolve(ctx.io, ctx.env, ctx.registries, orig_pkgs, PRESERVE_NONE, ctx.julia_version)
end
end
'';