From 995d379c024a96c07c8576541f6f526f9c5ff585 Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Fri, 8 Mar 2024 19:30:38 +0000 Subject: [PATCH] system-upgrade: fix DNF 4 regressions - 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 --- dnf5/commands/offline/offline.cpp | 8 ++++++++ dnf5/context.cpp | 4 ++++ dnf5/include/dnf5/offline.hpp | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dnf5/commands/offline/offline.cpp b/dnf5/commands/offline/offline.cpp index ebee1c2a59..b8f21f88c0 100644 --- a/dnf5/commands/offline/offline.cpp +++ b/dnf5/commands/offline/offline.cpp @@ -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() { @@ -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"); diff --git a/dnf5/context.cpp b/dnf5/context.cpp index 9184c4fcab..5b411525fe 100644 --- a/dnf5/context.cpp +++ b/dnf5/context.cpp @@ -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(); } diff --git a/dnf5/include/dnf5/offline.hpp b/dnf5/include/dnf5/offline.hpp index f733ab021d..2cf3198a48 100644 --- a/dnf5/include/dnf5/offline.hpp +++ b/dnf5/include/dnf5/offline.hpp @@ -64,6 +64,7 @@ struct OfflineTransactionStateData { bool poweroff_after = false; std::vector enabled_repos; std::vector disabled_repos; + std::string module_platform_id; }; class OfflineTransactionState { @@ -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