Skip to content

Commit

Permalink
Use a different method for disabling plugins during build
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mracek committed Apr 2, 2024
1 parent 0ecd400 commit 12a620e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 24 deletions.
3 changes: 1 addition & 2 deletions test/dnf5daemon-server/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
6 changes: 3 additions & 3 deletions test/perl5/libdnf5/rpm/test_package_query.t
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 2 additions & 3 deletions test/python3/libdnf5/base_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 2 additions & 4 deletions test/python3/libdnf5/tutorial/session/create_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
3 changes: 1 addition & 2 deletions test/ruby/libdnf5/base_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 2 additions & 3 deletions test/shared/base_test_case.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
5 changes: 2 additions & 3 deletions test/shared/test_case_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ std::unique_ptr<libdnf5::Base> 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;
}
7 changes: 3 additions & 4 deletions test/tutorial/session/create_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down

0 comments on commit 12a620e

Please sign in to comment.