-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libdnf, actions plugin] Support
pre/post_add_cmdline_packages
hooks
And increases plugin version to 1.0.0
- Loading branch information
Showing
1 changed file
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ using namespace libdnf5; | |
namespace { | ||
|
||
constexpr const char * PLUGIN_NAME = "actions"; | ||
constexpr plugin::Version PLUGIN_VERSION{0, 3, 0}; | ||
constexpr plugin::Version PLUGIN_VERSION{1, 0, 0}; | ||
|
||
constexpr const char * attrs[]{"author.name", "author.email", "description", nullptr}; | ||
constexpr const char * attrs_value[]{"Jaroslav Rohel", "[email protected]", "Actions Plugin."}; | ||
|
@@ -98,6 +98,12 @@ class Actions final : public plugin::IPlugin { | |
|
||
void repos_loaded() override { on_hook(repos_loaded_actions); } | ||
|
||
void pre_add_cmdline_packages(const std::vector<std::string> &) override { | ||
on_hook(pre_add_cmdline_packages_actions); | ||
} | ||
|
||
void post_add_cmdline_packages() override { on_hook(post_add_cmdline_packages_actions); } | ||
|
||
void pre_transaction(const libdnf5::base::Transaction & transaction) override { | ||
on_transaction(transaction, pre_trans_actions); | ||
} | ||
|
@@ -129,6 +135,8 @@ class Actions final : public plugin::IPlugin { | |
std::vector<Action> post_base_setup_actions; | ||
std::vector<Action> repos_configured_actions; | ||
std::vector<Action> repos_loaded_actions; | ||
std::vector<Action> pre_add_cmdline_packages_actions; | ||
std::vector<Action> post_add_cmdline_packages_actions; | ||
std::vector<Action> pre_trans_actions; | ||
std::vector<Action> post_trans_actions; | ||
|
||
|
@@ -466,6 +474,8 @@ void Actions::parse_action_files() { | |
POST_BASE_SETUP, | ||
REPOS_CONFIGURED, | ||
REPOS_LOADED, | ||
PRE_ADD_CMDLINE_PACKAGES, | ||
POST_ADD_CMDLINE_PACKAGES, | ||
PRE_TRANS, | ||
POST_TRANS | ||
} hook; | ||
|
@@ -477,6 +487,10 @@ void Actions::parse_action_files() { | |
hook = Hooks::REPOS_CONFIGURED; | ||
} else if (line.starts_with("repos_loaded:")) { | ||
hook = Hooks::REPOS_LOADED; | ||
} else if (line.starts_with("pre_add_cmdline_packages:")) { | ||
hook = Hooks::PRE_ADD_CMDLINE_PACKAGES; | ||
} else if (line.starts_with("post_add_cmdline_packages:")) { | ||
hook = Hooks::POST_ADD_CMDLINE_PACKAGES; | ||
} else if (line.starts_with("pre_transaction:")) { | ||
hook = Hooks::PRE_TRANS; | ||
} else if (line.starts_with("post_transaction:")) { | ||
|
@@ -546,6 +560,12 @@ void Actions::parse_action_files() { | |
case Hooks::REPOS_LOADED: | ||
repos_loaded_actions.emplace_back(std::move(act)); | ||
break; | ||
case Hooks::PRE_ADD_CMDLINE_PACKAGES: | ||
pre_add_cmdline_packages_actions.emplace_back(std::move(act)); | ||
break; | ||
case Hooks::POST_ADD_CMDLINE_PACKAGES: | ||
post_add_cmdline_packages_actions.emplace_back(std::move(act)); | ||
break; | ||
case Hooks::PRE_TRANS: | ||
pre_trans_actions.emplace_back(std::move(act)); | ||
break; | ||
|