LibPkg
|
A class for unpacking and removing sets of packages. More...
#include <unpack.h>
Classes | |
class | cannot_process |
An exception class for reporting that one or more packages cannot be processed. More... | |
class | file_conflict |
An exception class for reporting that one or more files conflict with those already on the system. More... | |
class | file_info_not_found |
An exception class for reporting that a file information record could not be found. More... | |
Public Types | |
enum | state_type { state_pre_unpack, state_pre_remove, state_copy_post_remove, state_run_pre_remove_triggers, state_unpack, state_run_pre_install_triggers, state_replace, state_remove, state_post_remove, state_create_empty_dirs, state_post_unpack, state_done, state_unwind_create_empty_dirs, state_unwind_remove, state_unwind_replace, state_unwind_pre_install_triggers, state_unwind_unpack, state_unwind_pre_remove_triggers, state_unwind_copy_post_remove, state_unwind_pre_remove, state_unwind_pre_unpack, state_fail } |
An enumeration for describing the state of the unpack operation. More... | |
typedef unsigned long long | size_type |
A type for representing byte counts. More... | |
Public Member Functions | |
unpack (pkgbase &pb, const std::set< string > &packages) | |
Construct unpack object. More... | |
virtual | ~unpack () |
Destroy unpack object. More... | |
state_type | state () const |
Get current state of the unpack operation. More... | |
size_type | files_done () const |
Get number of files processed. More... | |
size_type | files_total () const |
Get total number of files to process. More... | |
size_type | bytes_done () const |
Get number of bytes processed. More... | |
size_type | bytes_total () const |
Get total number of bytes to process. More... | |
string | message () const |
Get error message. More... | |
bool | clear_state_text_changed () |
Check is state text has changed and clear the changed flag. More... | |
const std::string & | state_text () const |
Return the current state text. More... | |
const std::set< string > & | packages_cannot_process () const |
Get the set of packages that cannot be processed. More... | |
const std::set< string, case_insensitive_cmp > & | files_that_conflict () const |
Get the set of destination pathnames that conflict with files already on the system. More... | |
void | use_trigger_run (trigger_run *tr) |
Set the class to run triggers. More... | |
void | log_to (pkg::log *use_log) |
Set the log to add the unpack messages to. More... | |
void | warning_func (std::tr1::function< void(LogCode code, const std::string &item, const std::string &what)> &f) |
Set the function to log and capture warnings. More... | |
triggers * | detach_triggers () |
Detach triggers for use later in the commit stage. More... | |
![]() | |
thread () | |
Construct thread. More... | |
virtual | ~thread () |
Destroy thread. More... | |
Static Public Attributes | |
static const size_type | npos =static_cast<size_type>(-1) |
A null value for use in place of a byte count. More... | |
Protected Member Functions | |
void | poll () |
Poll this thread. More... | |
Additional Inherited Members | |
![]() | |
static void | poll_all () |
Poll all threads. More... | |
A class for unpacking and removing sets of packages.
typedef unsigned long long pkg::unpack::size_type |
A type for representing byte counts.
An enumeration for describing the state of the unpack operation.
Enumerator | |
---|---|
state_pre_unpack | The state in which the states of packages to be unpacked are changed to status::state_half_unpacked. |
state_pre_remove | The state in which the states of packages to be removed are changed to status::state_half_unpacked. |
state_copy_post_remove | The state in which post remove triggers are copied so they are preserved to be run after the packages have been removed. |
state_run_pre_remove_triggers | The state in which the pre remove triggers are run. |
state_unpack | The state in which files are unpacked from their zip archives and moved to temporary locations. |
state_run_pre_install_triggers | The state in which pre install triggers are run. |
state_replace | The state in which old versions of files are backed up and replaced with new versions. |
state_remove | The state in which old versions of files that do not have replacements are backed up then removed. |
state_post_remove | The state in which backups are deleted, and the states of packages to be removed are changed to status::state_removed. |
state_create_empty_dirs | The state in which any empty directwasries that need creating are created. |
state_post_unpack | The state in which the states of packages to be unpacked are changed to status::state_unpacked. |
state_done | The state in which all operations have been successfully completed. |
state_unwind_create_empty_dirs | The state in which empty diwas created are removed. |
state_unwind_remove | The state in which state_remove is being backed out. |
state_unwind_replace | The state in which state_replace is being backed out. |
state_unwind_pre_install_triggers | The state in which post remove triggers are run to unwind the actions of the pre install triggers. |
state_unwind_unpack | The state in which state_unpack is being backed out. |
state_unwind_pre_remove_triggers | The state in which post install triggers are run to unwind the actions of the pre remove and/or pre install triggers. |
state_unwind_copy_post_remove | The state in which post remove trigger copies are removed. |
state_unwind_pre_remove | The state in which state_pre_remove is being backed out. |
state_unwind_pre_unpack | The state in which state_pre_unpack is being backed out. |
state_fail | The state in which an error has occurred and an attempt has been made to back out changes. |
pkg::unpack::unpack | ( | pkgbase & | pb, |
const std::set< string > & | packages | ||
) |
Construct unpack object.
pb | the package database |
packages | the set of packages to process |
References pkg::pkgbase::curstat(), pkg::remove_req(), pkg::pkgbase::selstat(), and pkg::unpack_req().
|
virtual |
Destroy unpack object.
|
inline |
Get current state of the unpack operation.
Referenced by pkg::commit::poll(), and poll().
|
inline |
Get number of files processed.
Referenced by pkg::commit::poll().
|
inline |
Get total number of files to process.
Referenced by pkg::commit::poll().
|
inline |
Get number of bytes processed.
Referenced by pkg::commit::poll().
|
inline |
Get total number of bytes to process.
Referenced by pkg::commit::poll().
|
inline |
Get error message.
When state()==state_fail, this function returns a human-readable description of what went wrong.
Referenced by pkg::commit::poll().
|
inline |
Check is state text has changed and clear the changed flag.
|
inline |
Return the current state text.
Referenced by poll().
|
inline |
Get the set of packages that cannot be processed.
When state()==state_fail, this function returns a list of packages that cannot be processed until the package manager has been upgraded.
|
inline |
Get the set of destination pathnames that conflict with files already on the system.
When state()==state_fail, this function returns a list of files that must be deleted before the given set of packages can be processed.
Referenced by pkg::commit::poll().
void pkg::unpack::use_trigger_run | ( | trigger_run * | tr | ) |
Set the class to run triggers.
Referenced by pkg::commit::poll().
void pkg::unpack::log_to | ( | pkg::log * | use_log | ) |
Set the log to add the unpack messages to.
Referenced by pkg::commit::poll().
|
inline |
Set the function to log and capture warnings.
References dst_pathname, and src_pathname.
triggers * pkg::unpack::detach_triggers | ( | ) |
Detach triggers for use later in the commit stage.
This should done if the unpack was successful. The object that called this memory will now own the triggers and must delete them when they are no longer required.
Referenced by pkg::commit::poll().
|
protectedvirtual |
Poll this thread.
This function will be called repeatedly until the thread ceases to exist. The amount of work done per invokation should be kept small, in order that multithreading (within the application) and multitasking (across RISC OS as a whole) operate smoothly.
Reimplemented from pkg::thread.
References pkg::triggers::add_post_install(), pkg::triggers::add_post_install_abort(), pkg::triggers::add_post_remove(), pkg::triggers::add_post_remove_file(), pkg::triggers::add_pre_install(), pkg::triggers::add_pre_remove(), pkg::control::begin(), pkg::pkgbase::cache_pathname(), pkg::can_process(), pkg::status_table::commit(), pkg::binary_control_table::commit(), pkg::pkgbase::control(), pkg::triggers::copy_post_remove_file(), pkg::create_directory(), pkg::pkgbase::curstat(), pkg::triggers::delete_shared_vars(), pkg::control::description(), pkg::control::end(), pkg::status::environment_id(), pkg::zipfile::extract(), pkg::zipfile::find(), pkg::zipfile::file_info::find_extra(), pkg::trigger::finished(), pkg::status::flag(), pkg::status::flag_auto, pkg::force_delete(), pkg::force_move(), pkg::module_info::help_string(), pkg::pkgbase::info_pathname(), pkg::status_table::insert(), pkg::binary_control_table::insert(), pkg::LOG_ERROR_UNINITIALISED, pkg::LOG_ERROR_UNPACK_EXCEPTION, pkg::LOG_INFO_COPY_POST_REMOVE, pkg::LOG_INFO_CREATE_EMPTY_DIRS, pkg::LOG_INFO_MODULE_CHECK, pkg::LOG_INFO_MODULE_REPLACE, pkg::LOG_INFO_MODULE_UNWIND, pkg::LOG_INFO_MODULE_UPDATE, pkg::LOG_INFO_MODULE_USE, pkg::LOG_INFO_PRE_INSTALL_TRIGGERS, pkg::LOG_INFO_PRE_REMOVE_TRIGGERS, pkg::LOG_INFO_PREREMOVE, pkg::LOG_INFO_PREUNPACK, pkg::LOG_INFO_REMOVE_POST_REMOVE_TRIGGERS, pkg::LOG_INFO_RESTORE_CONTROL, pkg::LOG_INFO_UNPACK_DONE, pkg::LOG_INFO_UNPACK_FILES, pkg::LOG_INFO_UNPACK_REMOVE, pkg::LOG_INFO_UNPACK_REMOVED, pkg::LOG_INFO_UNPACK_REPLACE, pkg::LOG_INFO_UNPACKED_PACKAGE, pkg::LOG_INFO_UNPACKING_PACKAGE, pkg::LOG_INFO_UNWIND_DONE, pkg::LOG_INFO_UNWIND_EMPTY_DIRS, pkg::LOG_INFO_UNWIND_PRE_INSTALL_TRIGGERS, pkg::LOG_INFO_UNWIND_PRE_REMOVE_TRIGGERS, pkg::LOG_INFO_UNWIND_REMOVED, pkg::LOG_INFO_UNWIND_REPLACED_FILES, pkg::LOG_INFO_UNWIND_STATE, pkg::LOG_INFO_UNWIND_STATE_REMOVED, pkg::LOG_INFO_UNWIND_UNPACK_FILES, pkg::trigger::log_to(), pkg::LOG_WARNING_MODULE_PACKAGE_UPDATE_FAILED, pkg::LOG_WARNING_NO_TRIGGER_RUN, pkg::trigger::message(), pkg::log::message(), pkg::triggers::next_pre_install_trigger(), pkg::triggers::next_pre_install_unwind(), pkg::triggers::next_pre_remove_trigger(), pkg::triggers::next_pre_remove_unwind(), pkg::object_length(), pkg::object_type(), pkg::pkgbase::paths(), pkg::triggers::post_remove_files_to_copy(), pkg::triggers::post_remove_files_to_remove(), pkg::triggers::pre_install_to_unwind(), pkg::triggers::pre_install_triggers_to_run(), pkg::triggers::pre_remove_to_unwind(), pkg::triggers::pre_remove_triggers_to_run(), pkg::pkgbase::prevstat(), pkg::module_info::read_ok(), pkg::triggers::remove_post_remove_file(), pkg::status_table::rollback(), pkg::trigger::run(), pkg::pkgbase::selstat(), pkg::zipfile::size(), pkg::soft_delete(), src_pathname, pkg::trigger::state(), pkg::status::state(), state(), state_copy_post_remove, state_create_empty_dirs, state_done, pkg::trigger::state_error, state_fail, pkg::status::state_half_unpacked, pkg::status::state_installed, state_post_remove, state_post_unpack, state_pre_remove, state_pre_unpack, state_remove, pkg::status::state_removed, state_replace, state_run_pre_install_triggers, state_run_pre_remove_triggers, pkg::trigger::state_success, state_text(), state_unpack, pkg::status::state_unpacked, state_unwind_copy_post_remove, state_unwind_create_empty_dirs, state_unwind_pre_install_triggers, state_unwind_pre_remove, state_unwind_pre_remove_triggers, state_unwind_pre_unpack, state_unwind_remove, state_unwind_replace, state_unwind_unpack, pkg::module_info::title(), pkg::zipfile::file_info::usize(), pkg::module_info::version(), pkg::status::version(), pkg::control::version(), and pkg::write_file_info().
A null value for use in place of a byte count.
Reference Manual | LibPkg | Version 0.6.1 (28 Jan 2015) |