Skip to content

Commit

Permalink
Move Solution post-processing to solver
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed Feb 5, 2024
1 parent 2cd1f3f commit 0f4f4de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
21 changes: 0 additions & 21 deletions libmamba/src/core/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <fmt/color.h>
#include <fmt/format.h>
#include <fmt/ostream.h>
#include <solv/selection.h>
#include <solv/solver.h>

#include "mamba/core/channel_context.hpp"
#include "mamba/core/context.hpp"
Expand All @@ -30,15 +28,9 @@
#include "mamba/core/thread_utils.hpp"
#include "mamba/core/transaction.hpp"
#include "mamba/specs/match_spec.hpp"
#include "mamba/util/string.hpp"
#include "mamba/util/variant_cmp.hpp"
#include "solv-cpp/pool.hpp"
#include "solv-cpp/queue.hpp"
#include "solv-cpp/repo.hpp"
#include "solv-cpp/transaction.hpp"

#include "solver/helpers.hpp"
#include "solver/libsolv/helpers.hpp"

#include "progress_bar_impl.hpp"

Expand Down Expand Up @@ -257,8 +249,6 @@ namespace mamba
);
}

auto& pool = m_pool.pool();

auto requested_specs = std::vector<specs::MatchSpec>();
using Request = solver::Request;
solver::for_each_of<Request::Install, Request::Update>(
Expand All @@ -274,15 +264,6 @@ namespace mamba
std::move(requested_specs)
);

if (solver::libsolv::solution_needs_python_relink(pool, m_solution))
{
m_solution = solver::libsolv::add_noarch_relink_to_solution(
std::move(m_solution),
pool,
"python"
);
}

// if no action required, don't even start logging them
if (!empty())
{
Expand Down Expand Up @@ -926,8 +907,6 @@ namespace mamba
printers::alignment::left,
printers::alignment::right });
t.set_padding({ 2, 2, 2, 2, 5 });
solv::ObjQueue classes = {};
solv::ObjQueue pkgs = {};

using rows = std::vector<std::vector<printers::FormattedString>>;

Expand Down
12 changes: 11 additions & 1 deletion libmamba/src/solver/libsolv/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,17 @@ namespace mamba::solver::libsolv
auto trans = solv::ObjTransaction::from_solver(pool, *solver);
trans.order(pool);

return { solver::libsolv::transaction_to_solution(pool, trans, request, flags) };
auto solution = solver::libsolv::transaction_to_solution(pool, trans, request, flags);

if (solver::libsolv::solution_needs_python_relink(pool, solution))
{
return { solver::libsolv::add_noarch_relink_to_solution(
std::move(solution),
pool,
"python"
) };
}
return { std::move(solution) };
}
);
}
Expand Down

0 comments on commit 0f4f4de

Please sign in to comment.