LibPkg
|
A class to manage the package triggers executed during the commiting of the packages. More...
#include <triggers.h>
Public Member Functions | |
triggers (pkgbase &pb, trigger_run *tr, log *lg) | |
Construct the class to maintain lists and create triggers. More... | |
~triggers () | |
void | add_pre_install (const std::string &pkgname, const std::string &old_version, const std::string &new_version, bool has_unwind) |
Add pre install trigger to list of triggers. More... | |
void | add_post_install (const std::string &pkgname, const std::string &old_version, const std::string &new_version) |
Add post install trigger to list of triggers. More... | |
void | add_pre_remove (const std::string &pkgname, const std::string &old_version, const std::string &new_version) |
Add pre remove trigger to list of triggers. More... | |
void | add_post_remove (const std::string &pkgname, const std::string &old_version, const std::string &new_version) |
Add post remove trigger to list of triggers. More... | |
void | add_post_install_abort (const string &pkgname, const std::string &old_version, const std::string &new_version) |
Set package being removed has a post install trigger. More... | |
void | add_post_remove_file (const std::string &filename) |
Add file to list of files that need to be copied so they are available to run after the package has been removed. More... | |
bool | post_remove_files_to_copy () const |
Check if there are any post remove triggers left to copy. More... | |
bool | copy_post_remove_file () |
Copy one post remove trigger file for use later. More... | |
bool | pre_remove_triggers_to_run () const |
Check if there are any pre remove triggers to run. More... | |
trigger * | next_pre_remove_trigger () |
Remove and return the next pre remove trigger to run. More... | |
bool | pre_install_triggers_to_run () const |
Check if there are any pre install triggers to run. More... | |
trigger * | next_pre_install_trigger () |
Remove and return the next pre install trigger to run. More... | |
bool | pre_install_to_unwind () const |
Check if there are any pre install triggers to unwind. More... | |
trigger * | next_pre_install_unwind () |
Return a post remove trigger to be called to unwind the action of a pre install trigger. More... | |
bool | pre_remove_to_unwind () const |
Check if there are any pre remove triggers to remove. More... | |
trigger * | next_pre_remove_unwind () |
Return a post install trigger to be called to unwind the action of a pre remove trigger. More... | |
bool | post_remove_files_to_remove () const |
Check if there are any post remove trigger copies to remove. More... | |
void | remove_post_remove_file () |
Remove a post remove copied field. More... | |
bool | post_remove_triggers_to_run () const |
Check if there are any post remove triggers to run. More... | |
trigger * | next_post_remove_trigger () |
Remove and return the next post remove trigger to run. More... | |
bool | post_install_triggers_to_run () const |
Check if there are any post install triggers to run. More... | |
trigger * | next_post_install_trigger () |
Remove and return the next postinstall trigger to run. More... | |
void | delete_shared_vars () |
Delete the shared environmental variables created by the triggers. More... | |
A class to manage the package triggers executed during the commiting of the packages.
pkg::triggers::triggers | ( | pkgbase & | pb, |
trigger_run * | tr, | ||
log * | lg | ||
) |
Construct the class to maintain lists and create triggers.
tr | the trigger_run object that will run the triggers |
lg | the log to log trigger output to. Can be 0 for no logging. |
pkg::triggers::~triggers | ( | ) |
References delete_shared_vars().
void pkg::triggers::add_pre_install | ( | const std::string & | pkgname, |
const std::string & | old_version, | ||
const std::string & | new_version, | ||
bool | has_unwind | ||
) |
Add pre install trigger to list of triggers.
pkgname | name of package containing the trigger |
old_version | version of package the package to remove or "" if install only |
new_version | version of the package to install or "" if remove only |
has_unwind | post remove script exists for unwind |
Referenced by pkg::unpack::poll().
void pkg::triggers::add_post_install | ( | const std::string & | pkgname, |
const std::string & | old_version, | ||
const std::string & | new_version | ||
) |
Add post install trigger to list of triggers.
pkgname | name of package containing the trigger |
old_version | version of package the package to remove or "" if install only |
new_version | version of the package to install or "" if remove only |
Referenced by pkg::unpack::poll().
void pkg::triggers::add_pre_remove | ( | const std::string & | pkgname, |
const std::string & | old_version, | ||
const std::string & | new_version | ||
) |
Add pre remove trigger to list of triggers.
pkgname | name of package containing the trigger |
old_version | version of package the package to remove or "" if install only |
new_version | version of the package to install or "" if remove only |
Referenced by pkg::unpack::poll().
void pkg::triggers::add_post_remove | ( | const std::string & | pkgname, |
const std::string & | old_version, | ||
const std::string & | new_version | ||
) |
Add post remove trigger to list of triggers.
pkgname | name of package containing the trigger |
old_version | version of package the package to remove or "" if install only |
new_version | version of the package to install or "" if remove only |
Referenced by pkg::unpack::poll().
void pkg::triggers::add_post_install_abort | ( | const string & | pkgname, |
const std::string & | old_version, | ||
const std::string & | new_version | ||
) |
Set package being removed has a post install trigger.
pkgname | name of package containing the trigger |
old_version | version of package the package to remove or "" if install only |
new_version | version of the package to install or "" if remove only |
Referenced by pkg::unpack::poll().
void pkg::triggers::add_post_remove_file | ( | const std::string & | filename | ) |
Add file to list of files that need to be copied so they are available to run after the package has been removed.
filename | the path to the file that will be copied |
Referenced by pkg::unpack::poll().
bool pkg::triggers::post_remove_files_to_copy | ( | ) | const |
Check if there are any post remove triggers left to copy.
Referenced by pkg::unpack::poll().
bool pkg::triggers::copy_post_remove_file | ( | ) |
Copy one post remove trigger file for use later.
References pkg::copy_object(), pkg::dst_to_post_remove(), pkg::force_delete(), pkg::LOG_ERROR_POST_REMOVE_COPY, and pkg::log::message().
Referenced by pkg::unpack::poll().
bool pkg::triggers::pre_remove_triggers_to_run | ( | ) | const |
Check if there are any pre remove triggers to run.
Referenced by pkg::unpack::poll().
trigger * pkg::triggers::next_pre_remove_trigger | ( | ) |
Remove and return the next pre remove trigger to run.
References pkg::trigger::pre_remove.
Referenced by pkg::unpack::poll().
bool pkg::triggers::pre_install_triggers_to_run | ( | ) | const |
Check if there are any pre install triggers to run.
Referenced by pkg::unpack::poll().
trigger * pkg::triggers::next_pre_install_trigger | ( | ) |
Remove and return the next pre install trigger to run.
References pkg::trigger::pre_install.
Referenced by pkg::unpack::poll().
bool pkg::triggers::pre_install_to_unwind | ( | ) | const |
Check if there are any pre install triggers to unwind.
Referenced by pkg::unpack::poll().
trigger * pkg::triggers::next_pre_install_unwind | ( | ) |
Return a post remove trigger to be called to unwind the action of a pre install trigger.
References pkg::trigger::abort_pre_install.
Referenced by pkg::unpack::poll().
bool pkg::triggers::pre_remove_to_unwind | ( | ) | const |
Check if there are any pre remove triggers to remove.
Referenced by pkg::unpack::poll().
trigger * pkg::triggers::next_pre_remove_unwind | ( | ) |
Return a post install trigger to be called to unwind the action of a pre remove trigger.
References pkg::trigger::abort_pre_remove.
Referenced by pkg::unpack::poll().
bool pkg::triggers::post_remove_files_to_remove | ( | ) | const |
Check if there are any post remove trigger copies to remove.
Referenced by pkg::unpack::poll().
void pkg::triggers::remove_post_remove_file | ( | ) |
Remove a post remove copied field.
References pkg::dst_to_post_remove(), and pkg::force_delete().
Referenced by pkg::unpack::poll().
bool pkg::triggers::post_remove_triggers_to_run | ( | ) | const |
Check if there are any post remove triggers to run.
trigger * pkg::triggers::next_post_remove_trigger | ( | ) |
Remove and return the next post remove trigger to run.
References pkg::trigger::post_remove.
bool pkg::triggers::post_install_triggers_to_run | ( | ) | const |
Check if there are any post install triggers to run.
trigger * pkg::triggers::next_post_install_trigger | ( | ) |
Remove and return the next postinstall trigger to run.
References pkg::trigger::post_install.
void pkg::triggers::delete_shared_vars | ( | ) |
Delete the shared environmental variables created by the triggers.
i.e. All variables starting PkgTrigger$S_
References pkg::LOG_INFO_DELETE_SHARED_VAR, pkg::log::message(), and pkg::swi::OS_ReadVarVal.
Referenced by pkg::unpack::poll(), and ~triggers().
Reference Manual | LibPkg | Version 0.6.1 (28 Jan 2015) |