From 30affd5bdf533f5df700ca7791014d93aabac2e7 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Jan 13 2021 15:51:22 +0000 Subject: Disable multiversion installation in package transactions Normally, package management transactions support so-called "multiversion" or "install-only" packages, where these packages are designed to be parallel installable while still using the same name. This is mainly done with kernel packages, as people usually want fallback kernels. However, the design of transactional updates makes this feature irrelevant, since we take full system snapshots and have the ability to boot into any of them at any given time. Thus, we can tolerate having only one kernel package installed in any given snapshot. --- diff --git a/src/txnupd.cpp b/src/txnupd.cpp index 9f67c82..36158c2 100644 --- a/src/txnupd.cpp +++ b/src/txnupd.cpp @@ -134,9 +134,16 @@ static bool setupTransactionalUpdate(PluginHandle * handle) { auto transactionRoot = handle->transaction.getRoot(); dnf_context_set_install_root(handle->context, transactionRoot.c_str()); - /* Let's prevent uninstallation of the plugin so that we don't break the system */ + /* Acquire the sack and goal so that we can apply settings to the transaction */ auto dnfSack = dnf_context_get_sack(handle->context); auto dnfGoal = dnf_context_get_goal(handle->context); + + /* Set installonly_limit to 1 to disable multiversioned kernel installation, + * as we don't need it for this type of transaction. + */ + dnf_sack_set_installonly_limit(dnfSack, 1); + + /* Prevent uninstallation of the plugin so that we don't break the system */ auto dnfPluginPkgQuery = hy_query_create(dnfSack); hy_query_filter(dnfPluginPkgQuery, HY_PKG_FILE, HY_EQ, TXNUPD_PLUGIN_PATH); auto dnfPluginPkgSet = hy_query_run_set(dnfPluginPkgQuery);