libdnf5.plugin
- class libdnf5.plugin.IPlugin(data)
A base class for implementing LIBDNF5 plugins that introduce additional logic into the library using hooks.
- finish()
Finish the plugin and release all resources obtained by the init method and in hooks.
- get_api_version()
Returns the version of the API supported by the plugin. It can be called at any time.
- get_attribute(name)
Gets the value of the attribute from the plugin. Returns nullptr if the attribute does not exist. It can be called at any time.
- get_attributes()
- Return type:
string
- Returns:
A nullptr terminated array of attributes supported by the plugin.
- get_base()
- get_name()
Returns the name of the plugin. It can be called at any time.
- get_version()
Gets the plugin version. It can be called at any time.
- init()
Plugin initialization. Called before hooks.
- load_plugins()
The plugin can load additional plugins. E.g. C++ plugin for loading Python plugins. Called before init.
- post_add_cmdline_packages()
The post_add_cmdline_packages hook. It is called at the end of the RepoSack::add_cmdline_packages method.
- post_base_setup()
The post_base_setup hook. It is called at the end of the Base::setup method.
- post_transaction(transaction)
The post_transaction hook. It is called after transactions.
- Parameters:
transaction (libdnf5::base::Transaction) – Contains the completed transaction.
- pre_add_cmdline_packages(paths)
The pre_add_cmdline_packages hook. It is called at the beginning of the RepoSack::add_cmdline_packages method.
- Parameters:
paths (std::vector< std::string,std::allocator< std::string > >) – Vector of paths (local files or URLs) to package files to be inserted into cmdline repo.
- pre_base_setup()
The pre_base_setup hook. It is called at the beginning of the Base::setup method (after the init hook).
- pre_transaction(transaction)
The pre_transaction hook. It is called just before the actual transaction starts.
- Parameters:
transaction (libdnf5::base::Transaction) – Contains the transaction that will be started.
- repos_configured()
The repos_configured hook. It is called in Base::notify_repos_configured method.
- repos_loaded()
The repos_loaded hook. It is called at the end of the RepoSack::load_repos method (in Impl).
- thisown
- class libdnf5.plugin.IPlugin2_1(data)
Extended plugin interface with additional hooks introduced in version 2.1 of the plugin API.
- goal_resolved(transaction)
The goal resolved hook. It is called right after the goal is resolved.
- Parameters:
transaction (libdnf5::base::Transaction) – Contains the transaction that was resolved.
- thisown
- class libdnf5.plugin.IPlugin2_2(data)
Extended plugin interface with cleanup hooks introduced in version 2.2 of the plugin API.
Cleanup hooks are guaranteed to run regardless of whether the operation succeeded or failed. They are intended for releasing resources acquired in the pre hook. Each cleanup hook must only touch the plugin’s own local state.
- post_add_cmdline_packages_cleanup()
Cleanup hook guaranteed to run after RepoSack::add_cmdline_packages() completes (successfully or not).
- post_base_setup_cleanup()
Cleanup hook guaranteed to run after Base::setup() completes (successfully or not).
- post_transaction_cleanup(transaction)
Cleanup hook guaranteed to run after the transaction run finishes (successfully or not).
- Parameters:
transaction (libdnf5::base::Transaction) – The same transaction object passed to pre_transaction()/post_transaction().
- thisown
- class libdnf5.plugin.PluginInfo(*args)
- get_api_version()
- Return type:
PluginAPIVersion- Returns:
the version of the API supported by the plugin, or zeros if the plugin is not loaded
- get_attribute(name)
Gets the value of the attribute from the plugin. Returns nullptr if the attribute does not exist or plugin is not loaded. :rtype: string :return: the value of the name attribute or nullptr
- get_attributes()
- Return type:
string
- Returns:
a nullptr terminated array of attributes supported by the plugin or nullptr if the plugin is not loaded
- get_name()
- Return type:
string
- Returns:
the real name of the plugin or derived from the configuration file if the plugin is not loaded
- get_real_name()
- Return type:
string
- Returns:
the real plugin name (returned from plugin) or nullptr if the plugin is not loaded
- get_version()
- Return type:
- Returns:
the version of the plugin, or zeros if the plugin is not loaded
- is_loaded()
- Return type:
boolean
- Returns:
true if the plugin is loaded
- thisown