LibPkg
|
class to represent a trigger action from a script More...
#include <trigger.h>
Public Types | |
enum | action_type { pre_remove, pre_install, post_install, post_remove, abort_pre_remove, abort_pre_install } |
enum | state_type { state_none, state_running, state_success, state_error } |
Public Member Functions | |
trigger (pkgbase &pb, const std::string &pkgname, trigger::action_type action, const std::string &old_version, const std::string &new_version, trigger_run *runner) | |
Construct a new trigger. More... | |
void | log_to (log *log) |
void | run () |
Run the trigger. More... | |
bool | finished () const |
Check if the triggers has finished running. More... | |
const std::string & | pkgname () const |
action_type | action () const |
state_type | state () const |
const std::string & | message () const |
void | trigger_start_failed (const std::string &reason) |
Callback from trigger_run if the trigger could not be started. More... | |
void | trigger_log (const std::string &text) |
Log any output from the trigger. More... | |
void | trigger_finished () |
Callback from trigger_run when the trigger finished. More... | |
class to represent a trigger action from a script
pkg::trigger::trigger | ( | pkgbase & | pb, |
const std::string & | pkgname, | ||
trigger::action_type | action, | ||
const std::string & | old_version, | ||
const std::string & | new_version, | ||
trigger_run * | runner | ||
) |
Construct a new trigger.
pb | package base |
pkgname | name of package with trigger |
action | when the trigger is being run |
old_version | old version of the package or "" if not already installed |
new_version | new version of the package or "" if removing |
runner | interface to start the trigger in the front end |
References pkg::control::components(), pkg::pkgbase::control(), pkg::parse_component_list(), and pkg::pkgbase::paths().
|
inline |
Referenced by pkg::commit::poll().
void pkg::trigger::run | ( | ) |
Run the trigger.
References abort_pre_install, abort_pre_remove, action(), pkg::LOG_INFO_TRIGGER_RUN, pkg::log::message(), post_install, post_remove, pre_install, pre_remove, pkg::trigger_run::run(), and state_running.
Referenced by pkg::commit::poll().
|
inline |
Check if the triggers has finished running.
References state_error, and state_success.
|
inline |
Referenced by pkg::commit::poll().
|
inline |
Referenced by run().
|
inline |
Referenced by pkg::commit::poll().
|
inline |
Referenced by pkg::commit::poll().
void pkg::trigger::trigger_start_failed | ( | const std::string & | reason | ) |
Callback from trigger_run if the trigger could not be started.
reason | description of why the trigger could not be run |
References state_error, and trigger_log().
void pkg::trigger::trigger_log | ( | const std::string & | text | ) |
Log any output from the trigger.
This is usuall any text displayed during the execution of the trigger.
text | output from the trigger run |
References pkg::LOG_INFO_TRIGGER_OUTPUT, and pkg::log::message().
Referenced by trigger_finished(), and trigger_start_failed().
void pkg::trigger::trigger_finished | ( | ) |
Callback from trigger_run when the trigger finished.
References state_error, state_success, and trigger_log().
Reference Manual | LibPkg | Version 0.6.1 (28 Jan 2015) |