From 12a620ecbe9b30112433bb239f7607f54d19da10 Mon Sep 17 00:00:00 2001 From: Jaroslav Mracek Date: Tue, 2 Apr 2024 08:12:00 +0200 Subject: [PATCH] Use a different method for disabling plugins during build --- test/dnf5daemon-server/support.py | 3 +-- test/perl5/libdnf5/rpm/test_package_query.t | 6 +++--- test/python3/libdnf5/base_test_case.py | 5 ++--- test/python3/libdnf5/tutorial/session/create_base.py | 6 ++---- test/ruby/libdnf5/base_test_case.rb | 3 +-- test/shared/base_test_case.cpp | 5 ++--- test/shared/test_case_fixture.cpp | 5 ++--- test/tutorial/session/create_base.cpp | 7 +++---- 8 files changed, 16 insertions(+), 24 deletions(-) diff --git a/test/dnf5daemon-server/support.py b/test/dnf5daemon-server/support.py index 4b1b59fc02..995525795f 100644 --- a/test/dnf5daemon-server/support.py +++ b/test/dnf5daemon-server/support.py @@ -75,8 +75,7 @@ def setUp(self): "config": { "config_file_path": self.config_file_path, "installroot": self.installroot, - "pluginconfpath": os.path.join(self.installroot, "pluginconfpath"), - "pluginpath": os.path.join(self.installroot, "pluginpath"), + "plugins": 0, "cachedir": os.path.join(self.installroot, "var/cache/dnf"), "reposdir": self.reposdir, } diff --git a/test/perl5/libdnf5/rpm/test_package_query.t b/test/perl5/libdnf5/rpm/test_package_query.t index df3c470ca7..5dc1825077 100644 --- a/test/perl5/libdnf5/rpm/test_package_query.t +++ b/test/perl5/libdnf5/rpm/test_package_query.t @@ -34,9 +34,9 @@ my $tmpdir = tempdir("libdnf5_perl5_unittest.XXXX", TMPDIR => 1, CLEANUP => 1); $base->get_config()->get_installroot_option()->set($libdnf5::conf::Option::Priority_RUNTIME, $tmpdir."/installroot"); $base->get_config()->get_cachedir_option()->set($libdnf5::conf::Option::Priority_RUNTIME, $tmpdir."/cache"); -# Prevent loading plugins from host by redirecting of pluginconfpath and pluginpath to an empty directory -$base->get_config()->get_pluginconfpath_option()->set($libdnf5::conf::Option::Priority_RUNTIME, $tmpdir."/pluginconfpath"); -$base->get_config()->get_pluginpath_option()->set($libdnf5::conf::Option::Priority_RUNTIME, $tmpdir."/pluginpath"); +# Prevent loading plugins from host +$base->get_config()->get_plugins_option()->set(0); + # Sets base internals according to configuration $base->setup(); diff --git a/test/python3/libdnf5/base_test_case.py b/test/python3/libdnf5/base_test_case.py index 6fe07c9d23..a39a0b0b3c 100644 --- a/test/python3/libdnf5/base_test_case.py +++ b/test/python3/libdnf5/base_test_case.py @@ -39,9 +39,8 @@ def setUp(self): config.cachedir = os.path.join(self.temp_dir, "cache") config.optional_metadata_types = libdnf5.conf.OPTIONAL_METADATA_TYPES - # Prevent loading plugins from host by redirecting of pluginconfpath and pluginpath to an empty directory - config.pluginconfpath = os.path.join(self.temp_dir, "pluginconfpath") - config.pluginpath = os.path.join(self.temp_dir, "pluginpath") + # Prevent loading plugins from the host + config.plugins = False vars = self.base.get_vars().get() vars.set("arch", "x86_64") diff --git a/test/python3/libdnf5/tutorial/session/create_base.py b/test/python3/libdnf5/tutorial/session/create_base.py index e78bee17da..ea45619c1d 100644 --- a/test/python3/libdnf5/tutorial/session/create_base.py +++ b/test/python3/libdnf5/tutorial/session/create_base.py @@ -12,10 +12,8 @@ base_config = base.get_config() base_config.installroot = installroot -# Optionally prevent of loading plugins from host by redirecting of pluginconfpath and pluginpath to an empty directory -# This is only important to make test functional during RPM build, but not for standard usecases -base_config.pluginconfpath = os.path.join(installroot, "pluginconfpath") -base_config.pluginpath = os.path.join(installroot, "pluginpath") +# Optionally prevent of loading of plugins. Plugins are loaded by default from the host +base_config.plugins = False # Optionally load configuration from the config files. # diff --git a/test/ruby/libdnf5/base_test_case.rb b/test/ruby/libdnf5/base_test_case.rb index 35675f42ad..b03b84ccec 100644 --- a/test/ruby/libdnf5/base_test_case.rb +++ b/test/ruby/libdnf5/base_test_case.rb @@ -38,8 +38,7 @@ def setup() @base.get_config().get_cachedir_option().set(File.join(@temp_dir, "cache")) # Prevent loading of plugins from host - @base.get_config().get_pluginconfpath_option().set(File.join(@temp_dir, "pluginconfpath")) - @base.get_config().get_pluginpath_option().set(File.join(@temp_dir, "pluginpath")) + @base.get_config().get_plugins_option().set(false) # Sets Base internals according to configuration @base.setup() diff --git a/test/shared/base_test_case.cpp b/test/shared/base_test_case.cpp index 93bc5af274..5b811f8bc6 100644 --- a/test/shared/base_test_case.cpp +++ b/test/shared/base_test_case.cpp @@ -233,9 +233,8 @@ void BaseTestCase::setUp() { base.get_config().get_cachedir_option().set(temp->get_path() / "cache"); base.get_config().get_optional_metadata_types_option().set(libdnf5::OPTIONAL_METADATA_TYPES); - // Prevent loading libdnf5 plugins by redirecting configuration to an empty directory - base.get_config().get_pluginconfpath_option().set(temp->get_path() / "pluginconfpath"); - base.get_config().get_pluginpath_option().set(temp->get_path() / "pluginpath"); + // Prevent loading libdnf5 plugins + base.get_config().get_plugins_option().set(false); base.get_vars()->set("arch", "x86_64"); diff --git a/test/shared/test_case_fixture.cpp b/test/shared/test_case_fixture.cpp index 6359c7ae5d..fc944c9428 100644 --- a/test/shared/test_case_fixture.cpp +++ b/test/shared/test_case_fixture.cpp @@ -86,9 +86,8 @@ std::unique_ptr TestCaseFixture::get_preconfigured_base() { base->get_config().get_installroot_option().set(temp->get_path() / "installroot"); base->get_config().get_cachedir_option().set(temp->get_path() / "cache"); - // Prevent loading libdnf5 plugins by redirecting configuration to an empty directory - base->get_config().get_pluginconfpath_option().set(temp->get_path() / "pluginconfpath"); - base->get_config().get_pluginpath_option().set(temp->get_path() / "pluginpath"); + // Prevent loading libdnf5 plugins + base->get_config().get_plugins_option().set(false); return base; } diff --git a/test/tutorial/session/create_base.cpp b/test/tutorial/session/create_base.cpp index c501cd4fd6..3e255b8d1b 100644 --- a/test/tutorial/session/create_base.cpp +++ b/test/tutorial/session/create_base.cpp @@ -12,10 +12,9 @@ libdnf5::Base base; // installroot directory tree as its root for the rest of its lifetime. base.get_config().get_installroot_option().set(installroot); -// Optionally - Prevent loading libdnf5 plugins by redirecting configuration to an empty directory -// It is important only this tutorial, but not so much for other usecases -base.get_config().get_pluginconfpath_option().set(installroot / "pluginconfpath"); -base.get_config().get_pluginpath_option().set(installroot / "pluginpath"); +// Optionally - Prevent loading libdnf5 plugins. +// Plugins are loaded by default from the host +base.get_config().get_plugins_option().set(false); // Optionally load configuration from the config files. //