Skip to content

Commit

Permalink
Fix the greedy resolver (#4032)
Browse files Browse the repository at this point in the history
Fix #4030
  • Loading branch information
carlobaldassi authored Oct 1, 2024
1 parent 51d4910 commit e06588d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Resolve/Resolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ function greedysolver(graph::Graph)
return (false, Int[])
elseif old_v1 == spp[p1]
sol[p1] = v1
fill!(gconstr[p1], false)
gconstr[p1][v1] = true
push!(staged_next, p1)
end
end
Expand Down
34 changes: 33 additions & 1 deletion test/resolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,6 @@ end
)
@test resolve_tst(deps_data, reqs_data, want_data)


# require A, D, and lower version of Y
reqs_data = Any[
["A", "*"],
Expand All @@ -638,6 +637,39 @@ end
)
@test resolve_tst(deps_data, reqs_data, want_data)


VERBOSE && @info("SCHEME 15")
## DEPENDENCY SCHEME 15: A GRAPH WITH A WEAK DEPENDENCE
## (REDUCED VERSION OF A REALISTIC SCHEME, ref Pkg.jl issue #4030)
deps_data = Any[
["A", v"1"],
["A", v"2", "C", "*"],
["B", v"1", "D", "1", :weak],
["C", v"1", "E", "*"],
["C", v"2", "E", "*"],
["C", v"2", "B", "1"],
["E", v"1", "D", "1"],
["E", v"2", "F", "1"],
["F", v"1", "D", "*"],
["D", v"1"],
["D", v"2"],
]

@test sanity_tst(deps_data)

reqs_data = Any[
["A", "*"],
]
want_data = Dict(
"A" => v"2",
"B" => v"1",
"C" => v"2",
"D" => v"1",
"E" => v"2",
"F" => v"1",
)
@test resolve_tst(deps_data, reqs_data, want_data)

end

@testset "realistic" begin
Expand Down

0 comments on commit e06588d

Please sign in to comment.