libalpm
Arch Linux Package Manager Library
alpm.h File Reference
#include <stdint.h>
#include <sys/types.h>
#include <stdarg.h>
#include <archive.h>
#include <archive_entry.h>
#include <alpm_list.h>
Include dependency graph for alpm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  alpm_pkg_xdata_t
 The extended data type used to store non-standard package data fields. More...
 
struct  alpm_file_t
 File in a package. More...
 
struct  alpm_filelist_t
 Package filelist container. More...
 
struct  alpm_backup_t
 Local package or package file backup entry. More...
 
struct  alpm_group_t
 Package group. More...
 
struct  alpm_pgpkey_t
 A PGP key. More...
 
struct  alpm_sigresult_t
 Signature result. More...
 
struct  alpm_siglist_t
 Signature list. More...
 
struct  alpm_depend_t
 The basic dependency type. More...
 
struct  alpm_depmissing_t
 Missing dependency. More...
 
struct  alpm_conflict_t
 A conflict that has occurred between two packages. More...
 
struct  alpm_fileconflict_t
 File conflict. More...
 
struct  alpm_event_any_t
 An event that may represent any event. More...
 
struct  alpm_event_package_operation_t
 A package operation event occurred. More...
 
struct  alpm_event_optdep_removal_t
 An optional dependency was removed. More...
 
struct  alpm_event_scriptlet_info_t
 A scriptlet was ran. More...
 
struct  alpm_event_database_missing_t
 A database is missing. More...
 
struct  alpm_event_pkgdownload_t
 A package was downloaded. More...
 
struct  alpm_event_pacnew_created_t
 A pacnew file was created. More...
 
struct  alpm_event_pacsave_created_t
 A pacsave file was created. More...
 
struct  alpm_event_hook_t
 pre/post transaction hooks are to be ran. More...
 
struct  alpm_event_hook_run_t
 A pre/post transaction hook was ran. More...
 
struct  alpm_event_pkg_retrieve_t
 Packages downloading about to start. More...
 
union  alpm_event_t
 Events. More...
 
struct  alpm_question_any_t
 A question that can represent any other question. More...
 
struct  alpm_question_install_ignorepkg_t
 Should target in ignorepkg be installed anyway? More...
 
struct  alpm_question_replace_t
 Should a package be replaced? More...
 
struct  alpm_question_conflict_t
 Should a conflicting package be removed? More...
 
struct  alpm_question_corrupted_t
 Should a corrupted package be deleted? More...
 
struct  alpm_question_remove_pkgs_t
 Should unresolvable targets be removed from the transaction? More...
 
struct  alpm_question_select_provider_t
 Provider selection. More...
 
struct  alpm_question_import_key_t
 Should a key be imported? More...
 
union  alpm_question_t
 Questions. More...
 
struct  alpm_download_event_init_t
 Context struct for when a download starts. More...
 
struct  alpm_download_event_progress_t
 Context struct for when a download progresses. More...
 
struct  alpm_download_event_retry_t
 Context struct for when a download retries. More...
 
struct  alpm_download_event_completed_t
 Context struct for when a download completes. More...
 

Typedefs

typedef int64_t alpm_time_t
 The time type used by libalpm.
 
typedef void(* alpm_cb_event) (void *ctx, alpm_event_t *event)
 Event callback.
 
typedef void(* alpm_cb_question) (void *ctx, alpm_question_t *question)
 Question callback.
 
typedef void(* alpm_cb_progress) (void *ctx, alpm_progress_t progress, const char *pkg, int percent, size_t howmany, size_t current)
 Progress callback.
 
typedef void(* alpm_cb_download) (void *ctx, const char *filename, alpm_download_event_type_t event, void *data)
 Type of download progress callbacks.
 
typedef int(* alpm_cb_fetch) (void *ctx, const char *url, const char *localpath, int force)
 A callback for downloading files.
 
typedef void(* alpm_cb_log) (void *ctx, alpm_loglevel_t level, const char *fmt, va_list args)
 The callback type for logging.
 

Enumerations

enum  alpm_errno_t {
  ALPM_ERR_OK = 0 , ALPM_ERR_MEMORY , ALPM_ERR_SYSTEM , ALPM_ERR_BADPERMS ,
  ALPM_ERR_NOT_A_FILE , ALPM_ERR_NOT_A_DIR , ALPM_ERR_WRONG_ARGS , ALPM_ERR_DISK_SPACE ,
  ALPM_ERR_HANDLE_NULL , ALPM_ERR_HANDLE_NOT_NULL , ALPM_ERR_HANDLE_LOCK , ALPM_ERR_DB_OPEN ,
  ALPM_ERR_DB_CREATE , ALPM_ERR_DB_NULL , ALPM_ERR_DB_NOT_NULL , ALPM_ERR_DB_NOT_FOUND ,
  ALPM_ERR_DB_INVALID , ALPM_ERR_DB_INVALID_SIG , ALPM_ERR_DB_VERSION , ALPM_ERR_DB_WRITE ,
  ALPM_ERR_DB_REMOVE , ALPM_ERR_SERVER_BAD_URL , ALPM_ERR_SERVER_NONE , ALPM_ERR_TRANS_NOT_NULL ,
  ALPM_ERR_TRANS_NULL , ALPM_ERR_TRANS_DUP_TARGET , ALPM_ERR_TRANS_DUP_FILENAME , ALPM_ERR_TRANS_NOT_INITIALIZED ,
  ALPM_ERR_TRANS_NOT_PREPARED , ALPM_ERR_TRANS_ABORT , ALPM_ERR_TRANS_TYPE , ALPM_ERR_TRANS_NOT_LOCKED ,
  ALPM_ERR_TRANS_HOOK_FAILED , ALPM_ERR_PKG_NOT_FOUND , ALPM_ERR_PKG_IGNORED , ALPM_ERR_PKG_INVALID ,
  ALPM_ERR_PKG_INVALID_CHECKSUM , ALPM_ERR_PKG_INVALID_SIG , ALPM_ERR_PKG_MISSING_SIG , ALPM_ERR_PKG_OPEN ,
  ALPM_ERR_PKG_CANT_REMOVE , ALPM_ERR_PKG_INVALID_NAME , ALPM_ERR_PKG_INVALID_ARCH , ALPM_ERR_SIG_MISSING ,
  ALPM_ERR_SIG_INVALID , ALPM_ERR_UNSATISFIED_DEPS , ALPM_ERR_CONFLICTING_DEPS , ALPM_ERR_FILE_CONFLICTS ,
  ALPM_ERR_RETRIEVE , ALPM_ERR_INVALID_REGEX , ALPM_ERR_LIBARCHIVE , ALPM_ERR_LIBCURL ,
  ALPM_ERR_EXTERNAL_DOWNLOAD , ALPM_ERR_GPGME , ALPM_ERR_MISSING_CAPABILITY_SIGNATURES
}
 libalpm's error type More...
 
enum  alpm_siglevel_t {
  ALPM_SIG_PACKAGE = (1 << 0) , ALPM_SIG_PACKAGE_OPTIONAL = (1 << 1) , ALPM_SIG_PACKAGE_MARGINAL_OK = (1 << 2) , ALPM_SIG_PACKAGE_UNKNOWN_OK = (1 << 3) ,
  ALPM_SIG_DATABASE = (1 << 10) , ALPM_SIG_DATABASE_OPTIONAL = (1 << 11) , ALPM_SIG_DATABASE_MARGINAL_OK = (1 << 12) , ALPM_SIG_DATABASE_UNKNOWN_OK = (1 << 13) ,
  ALPM_SIG_USE_DEFAULT = (1 << 30)
}
 PGP signature verification options. More...
 
enum  alpm_sigstatus_t {
  ALPM_SIGSTATUS_VALID , ALPM_SIGSTATUS_KEY_EXPIRED , ALPM_SIGSTATUS_SIG_EXPIRED , ALPM_SIGSTATUS_KEY_UNKNOWN ,
  ALPM_SIGSTATUS_KEY_DISABLED , ALPM_SIGSTATUS_INVALID
}
 PGP signature verification status return codes. More...
 
enum  alpm_sigvalidity_t { ALPM_SIGVALIDITY_FULL , ALPM_SIGVALIDITY_MARGINAL , ALPM_SIGVALIDITY_NEVER , ALPM_SIGVALIDITY_UNKNOWN }
 The trust level of a PGP key. More...
 
enum  alpm_depmod_t {
  ALPM_DEP_MOD_ANY = 1 , ALPM_DEP_MOD_EQ , ALPM_DEP_MOD_GE , ALPM_DEP_MOD_LE ,
  ALPM_DEP_MOD_GT , ALPM_DEP_MOD_LT
}
 Types of version constraints in dependency specs. More...
 
enum  alpm_fileconflicttype_t { ALPM_FILECONFLICT_TARGET = 1 , ALPM_FILECONFLICT_FILESYSTEM }
 File conflict type. More...
 
enum  alpm_event_type_t {
  ALPM_EVENT_CHECKDEPS_START = 1 , ALPM_EVENT_CHECKDEPS_DONE , ALPM_EVENT_FILECONFLICTS_START , ALPM_EVENT_FILECONFLICTS_DONE ,
  ALPM_EVENT_RESOLVEDEPS_START , ALPM_EVENT_RESOLVEDEPS_DONE , ALPM_EVENT_INTERCONFLICTS_START , ALPM_EVENT_INTERCONFLICTS_DONE ,
  ALPM_EVENT_TRANSACTION_START , ALPM_EVENT_TRANSACTION_DONE , ALPM_EVENT_PACKAGE_OPERATION_START , ALPM_EVENT_PACKAGE_OPERATION_DONE ,
  ALPM_EVENT_INTEGRITY_START , ALPM_EVENT_INTEGRITY_DONE , ALPM_EVENT_LOAD_START , ALPM_EVENT_LOAD_DONE ,
  ALPM_EVENT_SCRIPTLET_INFO , ALPM_EVENT_DB_RETRIEVE_START , ALPM_EVENT_DB_RETRIEVE_DONE , ALPM_EVENT_DB_RETRIEVE_FAILED ,
  ALPM_EVENT_PKG_RETRIEVE_START , ALPM_EVENT_PKG_RETRIEVE_DONE , ALPM_EVENT_PKG_RETRIEVE_FAILED , ALPM_EVENT_DISKSPACE_START ,
  ALPM_EVENT_DISKSPACE_DONE , ALPM_EVENT_OPTDEP_REMOVAL , ALPM_EVENT_DATABASE_MISSING , ALPM_EVENT_KEYRING_START ,
  ALPM_EVENT_KEYRING_DONE , ALPM_EVENT_KEY_DOWNLOAD_START , ALPM_EVENT_KEY_DOWNLOAD_DONE , ALPM_EVENT_PACNEW_CREATED ,
  ALPM_EVENT_PACSAVE_CREATED , ALPM_EVENT_HOOK_START , ALPM_EVENT_HOOK_DONE , ALPM_EVENT_HOOK_RUN_START ,
  ALPM_EVENT_HOOK_RUN_DONE
}
 Type of events. More...
 
enum  alpm_package_operation_t {
  ALPM_PACKAGE_INSTALL = 1 , ALPM_PACKAGE_UPGRADE , ALPM_PACKAGE_REINSTALL , ALPM_PACKAGE_DOWNGRADE ,
  ALPM_PACKAGE_REMOVE
}
 An enum over the kind of package operations. More...
 
enum  alpm_hook_when_t { ALPM_HOOK_PRE_TRANSACTION = 1 , ALPM_HOOK_POST_TRANSACTION }
 Kind of hook. More...
 
enum  alpm_question_type_t {
  ALPM_QUESTION_INSTALL_IGNOREPKG = (1 << 0) , ALPM_QUESTION_REPLACE_PKG = (1 << 1) , ALPM_QUESTION_CONFLICT_PKG = (1 << 2) , ALPM_QUESTION_CORRUPTED_PKG = (1 << 3) ,
  ALPM_QUESTION_REMOVE_PKGS = (1 << 4) , ALPM_QUESTION_SELECT_PROVIDER = (1 << 5) , ALPM_QUESTION_IMPORT_KEY = (1 << 6)
}
 Type of question. More...
 
enum  alpm_progress_t {
  ALPM_PROGRESS_ADD_START , ALPM_PROGRESS_UPGRADE_START , ALPM_PROGRESS_DOWNGRADE_START , ALPM_PROGRESS_REINSTALL_START ,
  ALPM_PROGRESS_REMOVE_START , ALPM_PROGRESS_CONFLICTS_START , ALPM_PROGRESS_DISKSPACE_START , ALPM_PROGRESS_INTEGRITY_START ,
  ALPM_PROGRESS_LOAD_START , ALPM_PROGRESS_KEYRING_START
}
 An enum over different kinds of progress alerts. More...
 
enum  alpm_download_event_type_t { ALPM_DOWNLOAD_INIT , ALPM_DOWNLOAD_PROGRESS , ALPM_DOWNLOAD_RETRY , ALPM_DOWNLOAD_COMPLETED }
 File download events. More...
 
enum  alpm_db_usage_t {
  ALPM_DB_USAGE_SYNC = 1 , ALPM_DB_USAGE_SEARCH = (1 << 1) , ALPM_DB_USAGE_INSTALL = (1 << 2) , ALPM_DB_USAGE_UPGRADE = (1 << 3) ,
  ALPM_DB_USAGE_ALL = (1 << 4) - 1
}
 The usage level of a database. More...
 
enum  alpm_loglevel_t { ALPM_LOG_ERROR = 1 , ALPM_LOG_WARNING = (1 << 1) , ALPM_LOG_DEBUG = (1 << 2) , ALPM_LOG_FUNCTION = (1 << 3) }
 Logging Levels. More...
 
enum  alpm_pkgreason_t { ALPM_PKG_REASON_EXPLICIT = 0 , ALPM_PKG_REASON_DEPEND = 1 , ALPM_PKG_REASON_UNKNOWN = 2 }
 Package install reasons. More...
 
enum  alpm_pkgfrom_t { ALPM_PKG_FROM_FILE = 1 , ALPM_PKG_FROM_LOCALDB , ALPM_PKG_FROM_SYNCDB }
 Location a package object was loaded from. More...
 
enum  alpm_pkgvalidation_t {
  ALPM_PKG_VALIDATION_UNKNOWN = 0 , ALPM_PKG_VALIDATION_NONE = (1 << 0) , ALPM_PKG_VALIDATION_MD5SUM = (1 << 1) , ALPM_PKG_VALIDATION_SHA256SUM = (1 << 2) ,
  ALPM_PKG_VALIDATION_SIGNATURE = (1 << 3)
}
 Method used to validate a package. More...
 
enum  alpm_transflag_t {
  ALPM_TRANS_FLAG_NODEPS = 1 , ALPM_TRANS_FLAG_NOSAVE = (1 << 2) , ALPM_TRANS_FLAG_NODEPVERSION = (1 << 3) , ALPM_TRANS_FLAG_CASCADE = (1 << 4) ,
  ALPM_TRANS_FLAG_RECURSE = (1 << 5) , ALPM_TRANS_FLAG_DBONLY = (1 << 6) , ALPM_TRANS_FLAG_NOHOOKS = (1 << 7) , ALPM_TRANS_FLAG_ALLDEPS = (1 << 8) ,
  ALPM_TRANS_FLAG_DOWNLOADONLY = (1 << 9) , ALPM_TRANS_FLAG_NOSCRIPTLET = (1 << 10) , ALPM_TRANS_FLAG_NOCONFLICTS = (1 << 11) , ALPM_TRANS_FLAG_NEEDED = (1 << 13) ,
  ALPM_TRANS_FLAG_ALLEXPLICIT = (1 << 14) , ALPM_TRANS_FLAG_UNNEEDED = (1 << 15) , ALPM_TRANS_FLAG_RECURSEALL = (1 << 16) , ALPM_TRANS_FLAG_NOLOCK = (1 << 17)
}
 Transaction flags. More...
 
enum  alpm_caps { ALPM_CAPABILITY_NLS = (1 << 0) , ALPM_CAPABILITY_DOWNLOADER = (1 << 1) , ALPM_CAPABILITY_SIGNATURES = (1 << 2) }
 Enum of possible compile time features. More...
 

Functions

alpm_file_talpm_filelist_contains (const alpm_filelist_t *filelist, const char *path)
 Determines whether a package filelist contains a given path.
 
alpm_list_talpm_find_group_pkgs (alpm_list_t *dbs, const char *name)
 Find group members across a list of databases.
 
alpm_errno_t alpm_errno (alpm_handle_t *handle)
 Returns the current error code from the handle.
 
const char * alpm_strerror (alpm_errno_t err)
 Returns the string corresponding to an error number.
 
alpm_handle_t * alpm_initialize (const char *root, const char *dbpath, alpm_errno_t *err)
 Initializes the library.
 
int alpm_release (alpm_handle_t *handle)
 Release the library.
 
int alpm_pkg_check_pgp_signature (alpm_pkg_t *pkg, alpm_siglist_t *siglist)
 Check the PGP signature for the given package file.
 
int alpm_db_check_pgp_signature (alpm_db_t *db, alpm_siglist_t *siglist)
 Check the PGP signature for the given database.
 
int alpm_siglist_cleanup (alpm_siglist_t *siglist)
 Clean up and free a signature result list.
 
int alpm_decode_signature (const char *base64_data, unsigned char **data, size_t *data_len)
 Decode a loaded signature in base64 form.
 
int alpm_extract_keyid (alpm_handle_t *handle, const char *identifier, const unsigned char *sig, const size_t len, alpm_list_t **keys)
 Extract the Issuer Key ID from a signature.
 
alpm_list_talpm_checkdeps (alpm_handle_t *handle, alpm_list_t *pkglist, alpm_list_t *remove, alpm_list_t *upgrade, int reversedeps)
 Checks dependencies and returns missing ones in a list.
 
alpm_pkg_t * alpm_find_satisfier (alpm_list_t *pkgs, const char *depstring)
 Find a package satisfying a specified dependency.
 
alpm_pkg_t * alpm_find_dbs_satisfier (alpm_handle_t *handle, alpm_list_t *dbs, const char *depstring)
 Find a package satisfying a specified dependency.
 
alpm_list_talpm_checkconflicts (alpm_handle_t *handle, alpm_list_t *pkglist)
 Check the package conflicts in a database.
 
char * alpm_dep_compute_string (const alpm_depend_t *dep)
 Returns a newly allocated string representing the dependency information.
 
alpm_depend_talpm_dep_from_string (const char *depstring)
 Return a newly allocated dependency information parsed from a string should be used to free the dependency .
 
void alpm_dep_free (alpm_depend_t *dep)
 Free a dependency info structure.
 
void alpm_fileconflict_free (alpm_fileconflict_t *conflict)
 Free a fileconflict and its members.
 
void alpm_depmissing_free (alpm_depmissing_t *miss)
 Free a depmissing and its members.
 
void alpm_conflict_free (alpm_conflict_t *conflict)
 Free a conflict and its members.
 
alpm_db_t * alpm_get_localdb (alpm_handle_t *handle)
 Get the database of locally installed packages.
 
alpm_list_talpm_get_syncdbs (alpm_handle_t *handle)
 Get the list of sync databases.
 
alpm_db_t * alpm_register_syncdb (alpm_handle_t *handle, const char *treename, int level)
 Register a sync database of packages.
 
int alpm_unregister_all_syncdbs (alpm_handle_t *handle)
 Unregister all package databases.
 
int alpm_db_unregister (alpm_db_t *db)
 Unregister a package database.
 
alpm_handle_t * alpm_db_get_handle (alpm_db_t *db)
 Get the handle of a package database.
 
const char * alpm_db_get_name (const alpm_db_t *db)
 Get the name of a package database.
 
int alpm_db_get_siglevel (alpm_db_t *db)
 Get the signature verification level for a database.
 
int alpm_db_get_valid (alpm_db_t *db)
 Check the validity of a database.
 
int alpm_db_update (alpm_handle_t *handle, alpm_list_t *dbs, int force)
 Update package databases.
 
alpm_pkg_t * alpm_db_get_pkg (alpm_db_t *db, const char *name)
 Get a package entry from a package database.
 
alpm_list_talpm_db_get_pkgcache (alpm_db_t *db)
 Get the package cache of a package database.
 
alpm_group_talpm_db_get_group (alpm_db_t *db, const char *name)
 Get a group entry from a package database.
 
alpm_list_talpm_db_get_groupcache (alpm_db_t *db)
 Get the group cache of a package database.
 
int alpm_db_search (alpm_db_t *db, const alpm_list_t *needles, alpm_list_t **ret)
 Searches a database with regular expressions.
 
int alpm_logaction (alpm_handle_t *handle, const char *prefix, const char *fmt,...) __attribute__((format(printf
 A printf-like function for logging.
 
int alpm_pkg_load (alpm_handle_t *handle, const char *filename, int full, int level, alpm_pkg_t **pkg)
 Create a package from a file.
 
int alpm_fetch_pkgurl (alpm_handle_t *handle, const alpm_list_t *urls, alpm_list_t **fetched)
 Fetch a list of remote packages.
 
alpm_pkg_t * alpm_pkg_find (alpm_list_t *haystack, const char *needle)
 Find a package in a list by name.
 
int alpm_pkg_free (alpm_pkg_t *pkg)
 Free a package.
 
int alpm_pkg_checkmd5sum (alpm_pkg_t *pkg)
 Check the integrity (with md5) of a package from the sync cache.
 
int alpm_pkg_vercmp (const char *a, const char *b)
 Compare two version strings and determine which one is 'newer'.
 
alpm_list_talpm_pkg_compute_requiredby (alpm_pkg_t *pkg)
 Computes the list of packages requiring a given package.
 
alpm_list_talpm_pkg_compute_optionalfor (alpm_pkg_t *pkg)
 Computes the list of packages optionally requiring a given package.
 
int alpm_pkg_should_ignore (alpm_handle_t *handle, alpm_pkg_t *pkg)
 Test if a package should be ignored.
 
int alpm_trans_get_flags (alpm_handle_t *handle)
 Returns the bitfield of flags for the current transaction.
 
alpm_list_talpm_trans_get_add (alpm_handle_t *handle)
 Returns a list of packages added by the transaction.
 
alpm_list_talpm_trans_get_remove (alpm_handle_t *handle)
 Returns the list of packages removed by the transaction.
 
int alpm_trans_init (alpm_handle_t *handle, int flags)
 Initialize the transaction.
 
int alpm_trans_prepare (alpm_handle_t *handle, alpm_list_t **data)
 Prepare a transaction.
 
int alpm_trans_commit (alpm_handle_t *handle, alpm_list_t **data)
 Commit a transaction.
 
int alpm_trans_interrupt (alpm_handle_t *handle)
 Interrupt a transaction.
 
int alpm_trans_release (alpm_handle_t *handle)
 Release a transaction.
 
alpm_pkg_t * alpm_sync_get_new_version (alpm_pkg_t *pkg, alpm_list_t *dbs_sync)
 Check for new version of pkg in syncdbs.
 
char * alpm_compute_md5sum (const char *filename)
 Get the md5 sum of file.
 
char * alpm_compute_sha256sum (const char *filename)
 Get the sha256 sum of file.
 
int alpm_unlock (alpm_handle_t *handle)
 Remove the database lock file.
 
const char * alpm_version (void)
 Get the version of library.
 
int alpm_capabilities (void)
 Get the capabilities of the library.
 
int alpm_sandbox_setup_child (alpm_handle_t *handle, const char *sandboxuser, const char *sandbox_path)
 Drop privileges by switching to a different user.
 
Server accessors
alpm_list_talpm_db_get_servers (const alpm_db_t *db)
 Get the list of servers assigned to this db.
 
int alpm_db_set_servers (alpm_db_t *db, alpm_list_t *servers)
 Sets the list of servers for the database to use.
 
int alpm_db_add_server (alpm_db_t *db, const char *url)
 Add a download server to a database.
 
int alpm_db_remove_server (alpm_db_t *db, const char *url)
 Remove a download server from a database.
 
alpm_list_talpm_db_get_cache_servers (const alpm_db_t *db)
 Get the list of cache servers assigned to this db.
 
int alpm_db_set_cache_servers (alpm_db_t *db, alpm_list_t *servers)
 Sets the list of cache servers for the database to use.
 
int alpm_db_add_cache_server (alpm_db_t *db, const char *url)
 Add a download cache server to a database.
 
int alpm_db_remove_cache_server (alpm_db_t *db, const char *url)
 Remove a download cache server from a database.
 
Usage accessors
int alpm_db_set_usage (alpm_db_t *db, int usage)
 Sets the usage of a database.
 
int alpm_db_get_usage (alpm_db_t *db, int *usage)
 Gets the usage of a database.
 
Accessors for callbacks
alpm_cb_log alpm_option_get_logcb (alpm_handle_t *handle)
 Returns the callback used for logging.
 
void * alpm_option_get_logcb_ctx (alpm_handle_t *handle)
 Returns the callback used for logging.
 
int alpm_option_set_logcb (alpm_handle_t *handle, alpm_cb_log cb, void *ctx)
 Sets the callback used for logging.
 
alpm_cb_download alpm_option_get_dlcb (alpm_handle_t *handle)
 Returns the callback used to report download progress.
 
void * alpm_option_get_dlcb_ctx (alpm_handle_t *handle)
 Returns the callback used to report download progress.
 
int alpm_option_set_dlcb (alpm_handle_t *handle, alpm_cb_download cb, void *ctx)
 Sets the callback used to report download progress.
 
alpm_cb_fetch alpm_option_get_fetchcb (alpm_handle_t *handle)
 Returns the downloading callback.
 
void * alpm_option_get_fetchcb_ctx (alpm_handle_t *handle)
 Returns the downloading callback.
 
int alpm_option_set_fetchcb (alpm_handle_t *handle, alpm_cb_fetch cb, void *ctx)
 Sets the downloading callback.
 
alpm_cb_event alpm_option_get_eventcb (alpm_handle_t *handle)
 Returns the callback used for events.
 
void * alpm_option_get_eventcb_ctx (alpm_handle_t *handle)
 Returns the callback used for events.
 
int alpm_option_set_eventcb (alpm_handle_t *handle, alpm_cb_event cb, void *ctx)
 Sets the callback used for events.
 
alpm_cb_question alpm_option_get_questioncb (alpm_handle_t *handle)
 Returns the callback used for questions.
 
void * alpm_option_get_questioncb_ctx (alpm_handle_t *handle)
 Returns the callback used for questions.
 
int alpm_option_set_questioncb (alpm_handle_t *handle, alpm_cb_question cb, void *ctx)
 Sets the callback used for questions.
 
alpm_cb_progress alpm_option_get_progresscb (alpm_handle_t *handle)
 Returns the callback used for operation progress.
 
void * alpm_option_get_progresscb_ctx (alpm_handle_t *handle)
 Returns the callback used for operation progress.
 
int alpm_option_set_progresscb (alpm_handle_t *handle, alpm_cb_progress cb, void *ctx)
 Sets the callback used for operation progress.
 
Accessors to the root directory

The root directory is the prefix to which libalpm installs packages to.

Hooks and scriptlets will also be run in a chroot to ensure they behave correctly in alternative roots.

const char * alpm_option_get_root (alpm_handle_t *handle)
 Returns the root path.
 
Accessors to the database path

The dbpath is where libalpm stores the local db and downloads sync databases.

const char * alpm_option_get_dbpath (alpm_handle_t *handle)
 Returns the path to the database directory.
 
Accessors to the lockfile

The lockfile is used to ensure two instances of libalpm can not write to the database at the same time.

The lock file is created when committing a transaction and released when the transaction completes. Or when calling alpm_unlock.

const char * alpm_option_get_lockfile (alpm_handle_t *handle)
 Get the name of the database lock file.
 
Accessors to the list of package cache directories.

This is where libalpm will store downloaded packages.

alpm_list_talpm_option_get_cachedirs (alpm_handle_t *handle)
 Gets the currently configured cachedirs,.
 
int alpm_option_set_cachedirs (alpm_handle_t *handle, alpm_list_t *cachedirs)
 Sets the cachedirs.
 
int alpm_option_add_cachedir (alpm_handle_t *handle, const char *cachedir)
 Append a cachedir to the configured cachedirs.
 
int alpm_option_remove_cachedir (alpm_handle_t *handle, const char *cachedir)
 Remove a cachedir from the configured cachedirs.
 
Accessors to the list of package hook directories.

libalpm will search these directories for hooks to run.

A hook in a later directory will override previous hooks if they have the same name.

alpm_list_talpm_option_get_hookdirs (alpm_handle_t *handle)
 Gets the currently configured hookdirs,.
 
int alpm_option_set_hookdirs (alpm_handle_t *handle, alpm_list_t *hookdirs)
 Sets the hookdirs.
 
int alpm_option_add_hookdir (alpm_handle_t *handle, const char *hookdir)
 Append a hookdir to the configured hookdirs.
 
int alpm_option_remove_hookdir (alpm_handle_t *handle, const char *hookdir)
 Remove a hookdir from the configured hookdirs.
 
Accessors to the list of overwritable files.

Normally libalpm will refuse to install a package that owns files that are already on disk and not owned by that package.

If a conflicting file matches a glob in the overwrite_files list, then no conflict will be raised and libalpm will simply overwrite the file.

alpm_list_talpm_option_get_overwrite_files (alpm_handle_t *handle)
 Gets the currently configured overwritable files,.
 
int alpm_option_set_overwrite_files (alpm_handle_t *handle, alpm_list_t *globs)
 Sets the overwritable files.
 
int alpm_option_add_overwrite_file (alpm_handle_t *handle, const char *glob)
 Append an overwritable file to the configured overwritable files.
 
int alpm_option_remove_overwrite_file (alpm_handle_t *handle, const char *glob)
 Remove a file glob from the configured overwritable files globs.
 
Accessors to the log file

This controls where libalpm will save log output to.

const char * alpm_option_get_logfile (alpm_handle_t *handle)
 Gets the filepath to the currently set logfile.
 
int alpm_option_set_logfile (alpm_handle_t *handle, const char *logfile)
 Sets the logfile path.
 
Accessors to the GPG directory

This controls where libalpm will store GnuPG's files.

const char * alpm_option_get_gpgdir (alpm_handle_t *handle)
 Returns the path to libalpm's GnuPG home directory.
 
int alpm_option_set_gpgdir (alpm_handle_t *handle, const char *gpgdir)
 Sets the path to libalpm's GnuPG home directory.
 
Accessors for use sandboxuser

This controls the user that libalpm will use for sensitive operations like downloading files.

const char * alpm_option_get_sandboxuser (alpm_handle_t *handle)
 Returns the user to switch to for sensitive operations.
 
int alpm_option_set_sandboxuser (alpm_handle_t *handle, const char *sandboxuser)
 Sets the user to switch to for sensitive operations.
 
Accessors for use syslog

This controls whether libalpm will also use the syslog.

Even if this option is enabled, libalpm will still try to log to its log file.

int alpm_option_get_usesyslog (alpm_handle_t *handle)
 Returns whether to use syslog (0 is FALSE, TRUE otherwise).
 
int alpm_option_set_usesyslog (alpm_handle_t *handle, int usesyslog)
 Sets whether to use syslog (0 is FALSE, TRUE otherwise).
 
Accessors to the list of no-upgrade files.

These functions modify the list of files which should not be updated by package installation.

alpm_list_talpm_option_get_noupgrades (alpm_handle_t *handle)
 Get the list of no-upgrade files.
 
int alpm_option_add_noupgrade (alpm_handle_t *handle, const char *path)
 Add a file to the no-upgrade list.
 
int alpm_option_set_noupgrades (alpm_handle_t *handle, alpm_list_t *noupgrade)
 Sets the list of no-upgrade files.
 
int alpm_option_remove_noupgrade (alpm_handle_t *handle, const char *path)
 Remove an entry from the no-upgrade list.
 
int alpm_option_match_noupgrade (alpm_handle_t *handle, const char *path)
 Test if a path matches any of the globs in the no-upgrade list.
 
Accessors to the list of no-extract files.

These functions modify the list of filenames which should be skipped packages which should not be upgraded by a sysupgrade operation.

alpm_list_talpm_option_get_noextracts (alpm_handle_t *handle)
 Get the list of no-extract files.
 
int alpm_option_add_noextract (alpm_handle_t *handle, const char *path)
 Add a file to the no-extract list.
 
int alpm_option_set_noextracts (alpm_handle_t *handle, alpm_list_t *noextract)
 Sets the list of no-extract files.
 
int alpm_option_remove_noextract (alpm_handle_t *handle, const char *path)
 Remove an entry from the no-extract list.
 
int alpm_option_match_noextract (alpm_handle_t *handle, const char *path)
 Test if a path matches any of the globs in the no-extract list.
 
Accessors to the list of ignored packages.

These functions modify the list of packages that should be ignored by a sysupgrade.

Entries in this list may be globs and only match the package's name. Providers are not taken into account.

alpm_list_talpm_option_get_ignorepkgs (alpm_handle_t *handle)
 Get the list of ignored packages.
 
int alpm_option_add_ignorepkg (alpm_handle_t *handle, const char *pkg)
 Add a file to the ignored package list.
 
int alpm_option_set_ignorepkgs (alpm_handle_t *handle, alpm_list_t *ignorepkgs)
 Sets the list of packages to ignore.
 
int alpm_option_remove_ignorepkg (alpm_handle_t *handle, const char *pkg)
 Remove an entry from the ignorepkg list.
 
Accessors to the list of ignored groups.

These functions modify the list of groups whose packages should be ignored by a sysupgrade.

Entries in this list may be globs.

alpm_list_talpm_option_get_ignoregroups (alpm_handle_t *handle)
 Get the list of ignored groups.
 
int alpm_option_add_ignoregroup (alpm_handle_t *handle, const char *grp)
 Add a file to the ignored group list.
 
int alpm_option_set_ignoregroups (alpm_handle_t *handle, alpm_list_t *ignoregrps)
 Sets the list of groups to ignore.
 
int alpm_option_remove_ignoregroup (alpm_handle_t *handle, const char *grp)
 Remove an entry from the ignoregroup list.
 
Accessors to the list of ignored dependencies.

These functions modify the list of dependencies that should be ignored by a sysupgrade.

This is effectively a list of virtual providers that packages can use to satisfy their dependencies.

alpm_list_talpm_option_get_assumeinstalled (alpm_handle_t *handle)
 Gets the list of dependencies that are assumed to be met.
 
int alpm_option_add_assumeinstalled (alpm_handle_t *handle, const alpm_depend_t *dep)
 Add a depend to the assumed installed list.
 
int alpm_option_set_assumeinstalled (alpm_handle_t *handle, alpm_list_t *deps)
 Sets the list of dependencies that are assumed to be met.
 
int alpm_option_remove_assumeinstalled (alpm_handle_t *handle, const alpm_depend_t *dep)
 Remove an entry from the assume installed list.
 
Accessors to the list of allowed architectures.

libalpm will only install packages that match one of the configured architectures.

The architectures do not need to match the physical architecture. They can just be treated as a label.

alpm_list_talpm_option_get_architectures (alpm_handle_t *handle)
 Returns the allowed package architecture.
 
int alpm_option_add_architecture (alpm_handle_t *handle, const char *arch)
 Adds an allowed package architecture.
 
int alpm_option_set_architectures (alpm_handle_t *handle, alpm_list_t *arches)
 Sets the allowed package architecture.
 
int alpm_option_remove_architecture (alpm_handle_t *handle, const char *arch)
 Removes an allowed package architecture.
 
Accessors for check space.

This controls whether libalpm will check if there is sufficient before installing packages.

int alpm_option_get_checkspace (alpm_handle_t *handle)
 Get whether or not checking for free space before installing packages is enabled.
 
int alpm_option_set_checkspace (alpm_handle_t *handle, int checkspace)
 Enable/disable checking free space before installing packages.
 
Accessors for the database extension

This controls the extension used for sync databases.

libalpm will use this extension to both lookup remote databses and as the name used when opening reading them.

This is useful for file databases. Seems as files can increase the size of a database by quite a lot, a server could hold a database without files under one extension, and another with files under another extension.

Which one is downloaded and used then depends on this setting.

const char * alpm_option_get_dbext (alpm_handle_t *handle)
 Gets the configured database extension.
 
int alpm_option_set_dbext (alpm_handle_t *handle, const char *dbext)
 Sets the database extension.
 
Accessors for the signature levels
int alpm_option_get_default_siglevel (alpm_handle_t *handle)
 Get the default siglevel.
 
int alpm_option_set_default_siglevel (alpm_handle_t *handle, int level)
 Set the default siglevel.
 
int alpm_option_get_local_file_siglevel (alpm_handle_t *handle)
 Get the configured local file siglevel.
 
int alpm_option_set_local_file_siglevel (alpm_handle_t *handle, int level)
 Set the local file siglevel.
 
int alpm_option_get_remote_file_siglevel (alpm_handle_t *handle)
 Get the configured remote file siglevel.
 
int alpm_option_set_remote_file_siglevel (alpm_handle_t *handle, int level)
 Set the remote file siglevel.
 
Accessors for download timeout

By default, libalpm will timeout if a download has been transferring less than 1 byte for 10 seconds.

int alpm_option_set_disable_dl_timeout (alpm_handle_t *handle, unsigned short disable_dl_timeout)
 Enables/disables the download timeout.
 
Accessors for parallel downloads

alpm_db_update, alpm_fetch_pkgurl and alpm_trans_commit can all download packages in parallel.

This setting configures how many packages can be downloaded in parallel,

By default this value is set to 1, meaning packages are downloading sequentially.

int alpm_option_get_parallel_downloads (alpm_handle_t *handle)
 Gets the number of parallel streams to download database and package files.
 
int alpm_option_set_parallel_downloads (alpm_handle_t *handle, unsigned int num_streams)
 Sets number of parallel streams to download database and package files.
 
Accessors for sandbox

By default, libalpm will sandbox the downloader process.

int alpm_option_set_disable_sandbox (alpm_handle_t *handle, unsigned short disable_sandbox)
 Enables/disables the sandbox.
 
Package Property Accessors

Any pointer returned by these functions points to internal structures allocated by libalpm.

They should not be freed nor modified in any way.

For loaded packages, they will be freed when alpm_pkg_free is called. For database packages, they will be freed when the database is unregistered.

alpm_handle_t * alpm_pkg_get_handle (alpm_pkg_t *pkg)
 Gets the handle of a package.
 
const char * alpm_pkg_get_filename (alpm_pkg_t *pkg)
 Gets the name of the file from which the package was loaded.
 
const char * alpm_pkg_get_base (alpm_pkg_t *pkg)
 Returns the package base name.
 
const char * alpm_pkg_get_name (alpm_pkg_t *pkg)
 Returns the package name.
 
const char * alpm_pkg_get_version (alpm_pkg_t *pkg)
 Returns the package version as a string.
 
alpm_pkgfrom_t alpm_pkg_get_origin (alpm_pkg_t *pkg)
 Returns the origin of the package.
 
const char * alpm_pkg_get_desc (alpm_pkg_t *pkg)
 Returns the package description.
 
const char * alpm_pkg_get_url (alpm_pkg_t *pkg)
 Returns the package URL.
 
alpm_time_t alpm_pkg_get_builddate (alpm_pkg_t *pkg)
 Returns the build timestamp of the package.
 
alpm_time_t alpm_pkg_get_installdate (alpm_pkg_t *pkg)
 Returns the install timestamp of the package.
 
const char * alpm_pkg_get_packager (alpm_pkg_t *pkg)
 Returns the packager's name.
 
const char * alpm_pkg_get_md5sum (alpm_pkg_t *pkg)
 Returns the package's MD5 checksum as a string.
 
const char * alpm_pkg_get_sha256sum (alpm_pkg_t *pkg)
 Returns the package's SHA256 checksum as a string.
 
const char * alpm_pkg_get_arch (alpm_pkg_t *pkg)
 Returns the architecture for which the package was built.
 
off_t alpm_pkg_get_size (alpm_pkg_t *pkg)
 Returns the size of the package.
 
off_t alpm_pkg_get_isize (alpm_pkg_t *pkg)
 Returns the installed size of the package.
 
alpm_pkgreason_t alpm_pkg_get_reason (alpm_pkg_t *pkg)
 Returns the package installation reason.
 
alpm_list_talpm_pkg_get_licenses (alpm_pkg_t *pkg)
 Returns the list of package licenses.
 
alpm_list_talpm_pkg_get_groups (alpm_pkg_t *pkg)
 Returns the list of package groups.
 
alpm_list_talpm_pkg_get_depends (alpm_pkg_t *pkg)
 Returns the list of package dependencies as alpm_depend_t.
 
alpm_list_talpm_pkg_get_optdepends (alpm_pkg_t *pkg)
 Returns the list of package optional dependencies.
 
alpm_list_talpm_pkg_get_checkdepends (alpm_pkg_t *pkg)
 Returns a list of package check dependencies.
 
alpm_list_talpm_pkg_get_makedepends (alpm_pkg_t *pkg)
 Returns a list of package make dependencies.
 
alpm_list_talpm_pkg_get_conflicts (alpm_pkg_t *pkg)
 Returns the list of packages conflicting with pkg.
 
alpm_list_talpm_pkg_get_provides (alpm_pkg_t *pkg)
 Returns the list of packages provided by pkg.
 
alpm_list_talpm_pkg_get_replaces (alpm_pkg_t *pkg)
 Returns the list of packages to be replaced by pkg.
 
alpm_filelist_talpm_pkg_get_files (alpm_pkg_t *pkg)
 Returns the list of files installed by pkg.
 
alpm_list_talpm_pkg_get_backup (alpm_pkg_t *pkg)
 Returns the list of files backed up when installing pkg.
 
alpm_db_t * alpm_pkg_get_db (alpm_pkg_t *pkg)
 Returns the database containing pkg.
 
const char * alpm_pkg_get_base64_sig (alpm_pkg_t *pkg)
 Returns the base64 encoded package signature.
 
int alpm_pkg_get_sig (alpm_pkg_t *pkg, unsigned char **sig, size_t *sig_len)
 Extracts package signature either from embedded package signature or if it is absent then reads data from detached signature file.
 
int alpm_pkg_get_validation (alpm_pkg_t *pkg)
 Returns the method used to validate a package during install.
 
alpm_list_talpm_pkg_get_xdata (alpm_pkg_t *pkg)
 Gets the extended data field of a package.
 
int alpm_pkg_has_scriptlet (alpm_pkg_t *pkg)
 Returns whether the package has an install scriptlet.
 
off_t alpm_pkg_download_size (alpm_pkg_t *newpkg)
 Returns the size of the files that will be downloaded to install a package.
 
int alpm_pkg_set_reason (alpm_pkg_t *pkg, alpm_pkgreason_t reason)
 Set install reason for a package in the local database.
 
Changelog functions

Functions for reading the changelog

void * alpm_pkg_changelog_open (alpm_pkg_t *pkg)
 Open a package changelog for reading.
 
size_t alpm_pkg_changelog_read (void *ptr, size_t size, const alpm_pkg_t *pkg, void *fp)
 Read data from an open changelog 'file stream'.
 
int alpm_pkg_changelog_close (const alpm_pkg_t *pkg, void *fp)
 Close a package changelog for reading.
 
Mtree functions

Functions for reading the mtree

struct archive * alpm_pkg_mtree_open (alpm_pkg_t *pkg)
 Open a package mtree file for reading.
 
int alpm_pkg_mtree_next (const alpm_pkg_t *pkg, struct archive *archive, struct archive_entry **entry)
 Read next entry from a package mtree file.
 
int alpm_pkg_mtree_close (const alpm_pkg_t *pkg, struct archive *archive)
 Close a package mtree file.
 
Add/Remove packages

These functions remove/add packages to the transactions

int alpm_sync_sysupgrade (alpm_handle_t *handle, int enable_downgrade)
 Search for packages to upgrade and add them to the transaction.
 
int alpm_add_pkg (alpm_handle_t *handle, alpm_pkg_t *pkg)
 Add a package to the transaction.
 
int alpm_remove_pkg (alpm_handle_t *handle, alpm_pkg_t *pkg)
 Add a package removal to the transaction.