Skip to content

Commit

Permalink
Try removing SOLVABLE_PROVIDES
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed Mar 18, 2024
1 parent f2d2e7a commit 478cb2e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
27 changes: 7 additions & 20 deletions libmamba/src/solver/libsolv/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1329,8 +1329,6 @@ namespace mamba::solver::libsolv
const specs::ChannelResolveParams& params
) -> expected_t<void>
{
static constexpr int install_flag = SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES;

auto solvable = std::optional<solv::ObjSolvableViewConst>{};

// the data about the channel is only in the prefix_data unfortunately
Expand All @@ -1357,13 +1355,13 @@ namespace mamba::solver::libsolv
{ /* .skip_installed= */ true }
);
const auto job_id = pool.add_dependency(first, REL_NAMESPACE, second);
jobs.push_back(install_flag, job_id);
jobs.push_back(SOLVER_INSTALL, job_id);
return {};
}

// We are not reinstalling but simply installing.
return pool_add_matchspec(pool, ms, params)
.transform([&](auto id) { jobs.push_back(install_flag, id); });
.transform([&](auto id) { jobs.push_back(SOLVER_INSTALL, id); });
}

template <typename Job>
Expand All @@ -1384,21 +1382,16 @@ namespace mamba::solver::libsolv
else
{
return pool_add_matchspec(pool, job.spec, params)
.transform(
[&](auto id)
{ raw_jobs.push_back(SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES, id); }
);
.transform([&](auto id) { raw_jobs.push_back(SOLVER_INSTALL, id); });
}
}
if constexpr (std::is_same_v<Job, Request::Remove>)
{
return pool_add_matchspec(pool, job.spec, params)
.transform(
[&](auto id)
{
[&](auto id) {
raw_jobs.push_back(
SOLVER_ERASE | SOLVER_SOLVABLE_PROVIDES
| (job.clean_dependencies ? SOLVER_CLEANDEPS : 0),
SOLVER_ERASE | (job.clean_dependencies ? SOLVER_CLEANDEPS : 0),
id
);
}
Expand All @@ -1417,15 +1410,9 @@ namespace mamba::solver::libsolv
&& job.spec.build_string().is_free()
&& job.spec.build_number().is_explicitly_free()))
{
raw_jobs.push_back(
SOLVER_INSTALL | SOLVER_SOLVABLE_PROVIDES | clean_deps,
id
);
raw_jobs.push_back(SOLVER_INSTALL | clean_deps, id);
}
raw_jobs.push_back(
SOLVER_UPDATE | SOLVER_SOLVABLE_PROVIDES | clean_deps,
id
);
raw_jobs.push_back(SOLVER_UPDATE | clean_deps, id);
}
);
}
Expand Down
1 change: 1 addition & 0 deletions libmamba/src/solver/libsolv/unsolvable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ namespace mamba::solver::libsolv
}
case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP:
case SOLVER_RULE_JOB_UNKNOWN_PACKAGE:
case SOLVER_RULE_JOB_UNSUPPORTED:
{
// A top level dependency does not exist.
// Could be a wrong name or missing channel.
Expand Down
6 changes: 3 additions & 3 deletions libmambapy/tests/test_solver_libsolv.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ def test_Solver_UnSolvable():
outcome = solver.solve(db, request)

assert isinstance(outcome, libsolv.UnSolvable)
assert "nothing provides" in "\n".join(outcome.problems(db))
assert "nothing provides" in outcome.problems_to_str(db)
assert "nothing provides" in outcome.all_problems_to_str(db)
assert len(outcome.problems(db)) > 0
assert isinstance(outcome.problems_to_str(db), str)
assert isinstance(outcome.all_problems_to_str(db), str)
assert "The following package could not be installed" in outcome.explain_problems(
db, libmambapy.Palette.no_color()
)
Expand Down

0 comments on commit 478cb2e

Please sign in to comment.