Skip to content

Commit

Permalink
system-upgrade: fix DNF 4 regressions
Browse files Browse the repository at this point in the history
- Store module_platform_id in offline-transaction-state.toml
- Set nogpgcheck in `dnf5 offline execute` since the gpgcheck should
  have already been performed when preparing the transaction
  • Loading branch information
evan-goode committed Mar 8, 2024
1 parent 2de75bc commit 995d379
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions dnf5/commands/offline/offline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ void OfflineExecuteCommand::pre_configure() {
// Additional removal could trigger unwanted changes in transaction.
ctx.base.get_config().get_clean_requirements_on_remove_option().set(false);
ctx.base.get_config().get_install_weak_deps_option().set(false);
// Disable gpgcheck entirely, since GPG integrity will have already been
// checked when the transaction was prepared and serialized. This way, we
// don't need to keep track of which packages need to be gpgchecked.
ctx.base.get_config().get_gpgcheck_option().set(false);
}

void OfflineExecuteCommand::configure() {
Expand All @@ -372,6 +376,10 @@ void OfflineExecuteCommand::configure() {
ctx.base.get_config().get_system_cachedir_option().set(state->get_data().cachedir);
ctx.base.get_config().get_cachedir_option().set(state->get_data().cachedir);

if (!state->get_data().module_platform_id.empty()) {
ctx.base.get_config().get_module_platform_id_option().set(state->get_data().module_platform_id);
}

// Set same set of enabled/disabled repos used during `system-upgrade download`
for (const auto & repo_id : state->get_data().enabled_repos) {
ctx.setopts.emplace_back(repo_id + ".enabled", "1");
Expand Down
4 changes: 4 additions & 0 deletions dnf5/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@ void Context::store_offline(libdnf5::base::Transaction & transaction) {
}
state.get_data().target_releasever = base.get_vars()->get_value("releasever");

if (!base.get_config().get_module_platform_id_option().empty()) {
state.get_data().module_platform_id = base.get_config().get_module_platform_id_option().get_value();
}

state.write();
}

Expand Down
4 changes: 3 additions & 1 deletion dnf5/include/dnf5/offline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct OfflineTransactionStateData {
bool poweroff_after = false;
std::vector<std::string> enabled_repos;
std::vector<std::string> disabled_repos;
std::string module_platform_id;
};

class OfflineTransactionState {
Expand Down Expand Up @@ -99,6 +100,7 @@ TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(
cmd_line,
poweroff_after,
enabled_repos,
disabled_repos)
disabled_repos,
module_platform_id)

#endif // DNF5_OFFLINE_HPP

0 comments on commit 995d379

Please sign in to comment.