Skip to content

Warn if sandbox has deps that have been yanked #3659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,25 @@ end

get_or_make!(d::Dict{K,V}, k::K) where {K,V} = get!(d, k) do; V() end

isyanked(pkg::PackageSpec) = isyanked(pkg.uuid, pkg.version)
function isyanked(uuid::UUID, version::VersionNumber)
found = false
yanked = true
for reg in Registry.reachable_registries()
pkg = get(reg, uuid, nothing)
if pkg isa Registry.PkgEntry
found = true
info = Registry.registry_info(pkg)
if !Registry.isyanked(info, version)
yanked = false
continue
end
end
end
found || error("Could not find package with uuid $(repr(uuid)) in any registry")
return yanked
end

const JULIA_UUID = UUID("1222c4b2-2114-5bfd-aeef-88e4692bbb3e")
const PKGORIGIN_HAVE_VERSION = :version in fieldnames(Base.PkgOrigin)
function deps_graph(env::EnvCache, registries::Vector{Registry.RegistryInstance}, uuid_to_name::Dict{UUID,String},
Expand Down Expand Up @@ -1805,6 +1824,20 @@ function sandbox(fn::Function, ctx::Context, target::PackageSpec, target_path::S
)
end

yanked = ""
for (uuid, pkgentry) in temp_ctx.env.manifest.deps
if isyanked(uuid, pkgentry.version)
yanked *= " - $(PkgId(pkg.uuid, pkg.name)) version $(pkg.version)\n"
end
end
if !isempty(yanked)
@warn """
The following package versions from the manifest have been yanked, which
means the current manifest cannot be resolved:
$yanked
"""
end

try
Pkg.resolve(temp_ctx; io=devnull, skip_writing_project=true)
@debug "Using _parent_ dep graph"
Expand Down