Skip to content

Commit

Permalink
Add arch to module pool
Browse files Browse the repository at this point in the history
It is important to provide architecture to libsolv pool, because it
might lead to incorrect resolve of active module items.
  • Loading branch information
j-mracek committed Nov 16, 2023
1 parent 2d77952 commit 79726c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libdnf5/base/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

#include "base_impl.hpp"
#include "conf/config.h"
#include "module/module_sack_impl.hpp"
#include "solv/pool.hpp"
#include "utils/dnf4convert/dnf4convert.hpp"
#include "utils/fs/utils.hpp"
Expand Down Expand Up @@ -221,7 +222,9 @@ void Base::setup() {
pool_setdisttype(**pool, DISTTYPE_RPM);
// TODO(jmracek) - architecture variable is changable therefore architecture in vars must be synchronized with RpmPool
// (and force to recompute provides) or locked
pool_setarch(**pool, vars->get_value("arch").c_str());
const char * arch = vars->get_value("arch").c_str();
pool_setarch(**pool, arch);
module_sack.p_impl->set_arch(arch);
pool_set_rootdir(**pool, installroot.get_value().c_str());

p_impl->plugins.post_base_setup();
Expand Down
6 changes: 6 additions & 0 deletions libdnf5/module/module_sack_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.

extern "C" {
#include <solv/pool.h>
#include <solv/poolarch.h>
}

#include <optional>
Expand Down Expand Up @@ -145,6 +146,11 @@ class ModuleSack::Impl {
/// @throw NoModuleError if the module doesn't exist.
/// @since 5.0.14
bool reset(const std::string & module_spec, bool count = true);
/// Set architecture for module pool
/// @param arch architecture.
/// @since 5.1.18
void set_arch(const char * arch) { pool_setarch(pool, arch); };


private:
friend class libdnf5::base::Transaction;
Expand Down

0 comments on commit 79726c3

Please sign in to comment.