Skip to content

Commit

Permalink
Mur
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed Jun 8, 2023
1 parent 9150e07 commit 85d90d7
Showing 1 changed file with 59 additions and 68 deletions.
127 changes: 59 additions & 68 deletions libmamba/src/core/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,78 +1156,69 @@ namespace mamba
dlsize_s });
};

const auto& pool = m_pool.pool();

const int mode = SOLVER_TRANSACTION_SHOW_OBSOLETES | SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE;
auto transaction = m_transaction->raw();
transaction_classify(transaction, mode, classes.raw());
for (std::size_t n_classes = classes.size(), i = 0; i < n_classes; i += 4)
{
const Id cls = classes.at(i);
transaction_classify_pkgs(
transaction,
mode,
cls,
classes.at(i + 2),
classes.at(i + 3),
pkgs.raw()
);

const auto& pool = m_pool.pool();
for (const solv::SolvableId p : pkgs)
trans().classify_for_each_type(
pool,
[&](const auto type, const auto& solv_ids)
{
const auto s = [&]()
{
auto maybe_s = pool.get_solvable(p);
assert(maybe_s.has_value());
return maybe_s.value();
}();
auto get_newer = [&]()
for (const solv::SolvableId id : solv_ids)
{
auto maybe_newer_id = trans().step_newer(pool, s.id());
assert(maybe_newer_id.has_value());
auto maybe_newer = pool.get_solvable(maybe_newer_id.value());
assert(maybe_newer.has_value());
return maybe_newer.value();
};

if (filter(s))
{
format_row(ignored, s, Status::ignore, "=");
continue;
}
switch (cls)
{
case SOLVER_TRANSACTION_UPGRADED:
format_row(upgraded, s, Status::remove, "-");
format_row(upgraded, get_newer(), Status::install, "+");
break;
case SOLVER_TRANSACTION_CHANGED:
format_row(changed, s, Status::remove, "-");
format_row(changed, get_newer(), Status::install, "+");
break;
case SOLVER_TRANSACTION_REINSTALLED:
format_row(reinstalled, s, Status::install, "o");
break;
case SOLVER_TRANSACTION_DOWNGRADED:
format_row(downgraded, s, Status::remove, "-");
format_row(downgraded, get_newer(), Status::install, "+");
break;
case SOLVER_TRANSACTION_ERASE:
format_row(erased, s, Status::remove, "-");
break;
case SOLVER_TRANSACTION_INSTALL:
format_row(installed, s, Status::install, "+");
break;
case SOLVER_TRANSACTION_IGNORE:
break;
case SOLVER_TRANSACTION_VENDORCHANGE:
case SOLVER_TRANSACTION_ARCHCHANGE:
default:
LOG_ERROR << "Print case not handled: " << cls;
break;
const auto s = [&]()
{
auto maybe_s = pool.get_solvable(id);
assert(maybe_s.has_value());
return maybe_s.value();
}();
auto get_newer = [&]()
{
auto maybe_newer_id = trans().step_newer(pool, id);
assert(maybe_newer_id.has_value());
auto maybe_newer = pool.get_solvable(maybe_newer_id.value());
assert(maybe_newer.has_value());
return maybe_newer.value();
};

if (filter(s))
{
format_row(ignored, s, Status::ignore, "=");
continue;
}
switch (type)
{
case SOLVER_TRANSACTION_UPGRADED:
format_row(upgraded, s, Status::remove, "-");
format_row(upgraded, get_newer(), Status::install, "+");
break;
case SOLVER_TRANSACTION_CHANGED:
format_row(changed, s, Status::remove, "-");
format_row(changed, get_newer(), Status::install, "+");
break;
case SOLVER_TRANSACTION_REINSTALLED:
format_row(reinstalled, s, Status::install, "o");
break;
case SOLVER_TRANSACTION_DOWNGRADED:
format_row(downgraded, s, Status::remove, "-");
format_row(downgraded, get_newer(), Status::install, "+");
break;
case SOLVER_TRANSACTION_ERASE:
format_row(erased, s, Status::remove, "-");
break;
case SOLVER_TRANSACTION_INSTALL:
format_row(installed, s, Status::install, "+");
break;
case SOLVER_TRANSACTION_IGNORE:
break;
case SOLVER_TRANSACTION_VENDORCHANGE:
case SOLVER_TRANSACTION_ARCHCHANGE:
default:
LOG_ERROR << "Print case not handled: " << type;
break;
}
}
}
}
},
SOLVER_TRANSACTION_SHOW_OBSOLETES | SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE
);

std::stringstream summary;
summary << "Summary:\n\n";
Expand Down

0 comments on commit 85d90d7

Please sign in to comment.