XBPS Library API  0.19
The X Binary Package System
Functions
Package removal functions

Functions

int xbps_remove_pkg (struct xbps_handle *xhp, const char *pkgver, bool update, bool soft_replace)
 
int xbps_remove_pkg_files (struct xbps_handle *xhp, prop_dictionary_t dict, const char *key, const char *pkgver)
 

Detailed Description

These functions will remove a package or only a subset of its files. Package removal steps:

  1. Its pre-remove target specified in the REMOVE script will be executed.
  2. Its links, files, conf_files and dirs will be removed. Modified files (not matchings its sha256 hash) are preserved, unless XBPS_FLAG_FORCE_REMOVE_FILES flag is set via xbps_init::flags member.
  3. Its post-remove target specified in the REMOVE script will be executed.
  4. Its state will be changed to XBPS_PKG_STATE_HALF_REMOVED.
  5. Its purge-remove target specified in the REMOVE script will be executed.
  6. Its package metadata file will be removed.
  7. Package will be unregistered from package database.
Note
  1. If a package is going to be updated, only steps 1 and 4 will be executed.
  2. If a package is going to be removed, all steps will be executed.

The following image shows the structure of an internalized package's files.plist dictionary:

xbps_pkg_files_dictionary.png

Legend:

Text inside of white boxes are the key associated with the object, its data type is specified on its edge, i.e string, array, integer, dictionary.

Function Documentation

int xbps_remove_pkg ( struct xbps_handle xhp,
const char *  pkgver,
bool  update,
bool  soft_replace 
)

Remove an installed package.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]pkgverPackage name/version to match.
[in]updateIf true, some steps will be skipped. See in the detailed description above for more information.
[in]soft_replaceIf true, some steps will be skipped. See in the detailed description above for more information.
Returns
0 on success, otherwise an errno value.

Definition at line 208 of file package_remove.c.

References xbps_handle::metadir, xbps_handle::rootdir, xbps_pkg_exec_script(), xbps_pkg_name(), xbps_pkg_state_installed(), xbps_pkg_version(), xbps_remove_pkg_files(), xbps_set_pkg_state_installed(), xbps_unregister_pkg(), and xbps_xasprintf().

Referenced by xbps_transaction_commit().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int xbps_remove_pkg_files ( struct xbps_handle xhp,
prop_dictionary_t  dict,
const char *  key,
const char *  pkgver 
)

Remove files defined in a proplib array as specified by key of an installed package.

Parameters
[in]xhpThe pointer to the xbps_handle struct.
[in]dictProplib dictionary internalized from package's XBPS_PKGFILES definition in package's metadata directory. The image in Detailed description shows off its structure.
[in]keyKey of the array object to match, valid values are: files, dirs, links and conf_files.
[in]pkgverPackage/version string matching package dictionary, i.e `foo-1.0'.
Returns
0 on success, otherwise an errno value.

Definition at line 75 of file package_remove.c.

References xbps_handle::flags, xbps_handle::rootdir, xbps_array_iter_from_dict(), xbps_file_hash_check(), xbps_pkg_name(), xbps_pkg_version(), and xbps_xasprintf().

Referenced by xbps_remove_pkg().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: