Skip to content
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

Do not unnecessarily remove entries from compat #2450

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
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
8 changes: 3 additions & 5 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -997,17 +997,15 @@ function rm(ctx::Context, pkgs::Vector{PackageSpec})
println(ctx.io, "No changes")
return
end
# only declare `compat` for direct dependencies
# only declare `compat` for remaining direct or `extra` dependencies
# `julia` is always an implicit direct dependency
filter!(ctx.env.project.compat) do (name, _)
name == "julia" || name in keys(ctx.env.project.deps)
name == "julia" || name in keys(ctx.env.project.deps) || name in keys(ctx.env.project.extras)
end
deps_names = append!(collect(keys(ctx.env.project.deps)),
collect(keys(ctx.env.project.extras)))
deps_names = union(keys(ctx.env.project.deps), keys(ctx.env.project.extras))
filter!(ctx.env.project.targets) do (target, deps)
!isempty(filter!(in(deps_names), deps))
end

# only keep reachable manifest entires
prune_manifest(ctx.env)
# update project & manifest
Expand Down
10 changes: 10 additions & 0 deletions test/new.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,16 @@ end
@test !haskey(Pkg.Types.Context().env.project.compat, "Example")
@test haskey(Pkg.Types.Context().env.project.compat, "julia")
end end
# rm should not unnecessarily remove compat entries
isolate(loaded_depot=true) do; mktempdir() do tempdir
path = copy_test_package(tempdir, "CompatExtras")
Pkg.activate(path)
@test haskey(Pkg.Types.Context().env.project.compat, "Aqua")
@test haskey(Pkg.Types.Context().env.project.compat, "DataFrames")
Pkg.rm("DataFrames")
@test !haskey(Pkg.Types.Context().env.project.compat, "DataFrames")
@test haskey(Pkg.Types.Context().env.project.compat, "Aqua")
end end
# rm removes unused recursive depdencies
isolate(loaded_depot=true) do; mktempdir() do tempdir
path = copy_test_package(tempdir, "SimplePackage")
Expand Down
16 changes: 16 additions & 0 deletions test/test_packages/CompatExtras/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name = "CompatExtras"
uuid = "37f6bc05-9e90-43d5-90c6-4d69d7097606"
version = "0.1.0"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

[compat]
Aqua = "0.5"
DataFrames = "0.22"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"

[targets]
test = ["Aqua"]