alpm_api(3)

NAME
alpm_api - Public API

 - The libalpm Public API.

SYNOPSIS

  Modules
Options
Libalpm option getters and setters.
Database Functions
Functions to query and manipulate the database of libalpm.
Package Functions
Functions to manipulate libalpm packages.

  Data Structures
struct _alpm_depend_t
Dependency.
struct _alpm_depmissing_t
Missing dependency.
struct _alpm_conflict_t
Conflict.
struct _alpm_fileconflict_t
File conflict.
struct _alpm_group_t
Package group.
struct _alpm_file_t
File in a package.
struct _alpm_filelist_t
Package filelist container.
struct _alpm_backup_t
Local package or package file backup entry.
struct _alpm_pgpkey_t
struct _alpm_sigresult_t
Signature result.
struct _alpm_siglist_t
Signature list.
struct _alpm_event_any_t
struct _alpm_event_package_operation_t
struct _alpm_event_optdep_removal_t
struct _alpm_event_scriptlet_info_t
struct _alpm_event_database_missing_t
struct _alpm_event_pkgdownload_t
struct _alpm_event_pacnew_created_t
struct _alpm_event_pacsave_created_t
struct _alpm_event_hook_t
struct _alpm_event_hook_run_t
union _alpm_event_t
Events.
struct _alpm_question_any_t
struct _alpm_question_install_ignorepkg_t
struct _alpm_question_replace_t
struct _alpm_question_conflict_t
struct _alpm_question_corrupted_t
struct _alpm_question_remove_pkgs_t
struct _alpm_question_select_provider_t
struct _alpm_question_import_key_t
union _alpm_question_t
Questions.

  Typedefs
typedef int64_t alpm_time_t
typedef enum _alpm_pkgreason_t alpm_pkgreason_t
Package install reasons.
typedef enum _alpm_pkgfrom_t alpm_pkgfrom_t
Location a package object was loaded from.
typedef enum _alpm_pkgvalidation_t alpm_pkgvalidation_t
Method used to validate a package.
typedef enum _alpm_depmod_t alpm_depmod_t
Types of version constraints in dependency specs.
typedef enum _alpm_fileconflicttype_t alpm_fileconflicttype_t
File conflict type.
typedef enum _alpm_siglevel_t alpm_siglevel_t
PGP signature verification options.
typedef enum _alpm_sigstatus_t alpm_sigstatus_t
PGP signature verification status return codes.
typedef enum _alpm_sigvalidity_t alpm_sigvalidity_t
PGP signature verification status return codes.
typedef struct _alpm_depend_t alpm_depend_t
Dependency.
typedef struct _alpm_depmissing_t alpm_depmissing_t
Missing dependency.
typedef struct _alpm_conflict_t alpm_conflict_t
Conflict.
typedef struct _alpm_fileconflict_t alpm_fileconflict_t
File conflict.
typedef struct _alpm_group_t alpm_group_t
Package group.
typedef struct _alpm_file_t alpm_file_t
File in a package.
typedef struct _alpm_filelist_t alpm_filelist_t
Package filelist container.
typedef struct _alpm_backup_t alpm_backup_t
Local package or package file backup entry.
typedef struct _alpm_pgpkey_t alpm_pgpkey_t
typedef struct _alpm_sigresult_t alpm_sigresult_t
Signature result.
typedef struct _alpm_siglist_t alpm_siglist_t
Signature list.
typedef enum _alpm_hook_when_t alpm_hook_when_t
typedef enum _alpm_loglevel_t alpm_loglevel_t
Logging Levels.
typedef void(* alpm_cb_log) (alpm_loglevel_t, const char *, va_list)
typedef int enum _alpm_event_type_t alpm_event_type_t
Type of events.
typedef struct _alpm_event_any_t alpm_event_any_t
typedef enum _alpm_package_operation_t alpm_package_operation_t
typedef struct _alpm_event_package_operation_t alpm_event_package_operation_t
typedef struct _alpm_event_optdep_removal_t alpm_event_optdep_removal_t
typedef struct _alpm_event_scriptlet_info_t alpm_event_scriptlet_info_t
typedef struct _alpm_event_database_missing_t alpm_event_database_missing_t
typedef struct _alpm_event_pkgdownload_t alpm_event_pkgdownload_t
typedef struct _alpm_event_pacnew_created_t alpm_event_pacnew_created_t
typedef struct _alpm_event_pacsave_created_t alpm_event_pacsave_created_t
typedef struct _alpm_event_hook_t alpm_event_hook_t
typedef struct _alpm_event_hook_run_t alpm_event_hook_run_t
typedef union _alpm_event_t alpm_event_t
Events.
typedef void(* alpm_cb_event) (alpm_event_t *)
Event callback.
typedef enum _alpm_question_type_t alpm_question_type_t
Type of questions.
typedef struct _alpm_question_any_t alpm_question_any_t
typedef struct _alpm_question_install_ignorepkg_t alpm_question_install_ignorepkg_t
typedef struct _alpm_question_replace_t alpm_question_replace_t
typedef struct _alpm_question_conflict_t alpm_question_conflict_t
typedef struct _alpm_question_corrupted_t alpm_question_corrupted_t
typedef struct _alpm_question_remove_pkgs_t alpm_question_remove_pkgs_t
typedef struct _alpm_question_select_provider_t alpm_question_select_provider_t
typedef struct _alpm_question_import_key_t alpm_question_import_key_t
typedef union _alpm_question_t alpm_question_t
Questions.
typedef void(* alpm_cb_question) (alpm_question_t *)
Question callback.
typedef enum _alpm_progress_t alpm_progress_t
Progress.
typedef void(* alpm_cb_progress) (alpm_progress_t, const char *, int, size_t, size_t)
Progress callback.
typedef void(* alpm_cb_download) (const char *filename, off_t xfered, off_t total)
Type of download progress callbacks.
typedef void(* alpm_cb_totaldl) (off_t total)
typedef int(* alpm_cb_fetch) (const char *url, const char *localpath, int force)
A callback for downloading files.

  Enumerations
enum _alpm_pkgreason_t { ALPM_PKG_REASON_EXPLICIT = 0, ALPM_PKG_REASON_DEPEND = 1 }
Package install reasons.
enum _alpm_pkgfrom_t { ALPM_PKG_FROM_FILE = 1, ALPM_PKG_FROM_LOCALDB, ALPM_PKG_FROM_SYNCDB }
Location a package object was loaded from.
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.
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.
enum _alpm_fileconflicttype_t { ALPM_FILECONFLICT_TARGET = 1, ALPM_FILECONFLICT_FILESYSTEM }
File conflict type.
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.
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.
enum _alpm_sigvalidity_t { ALPM_SIGVALIDITY_FULL, ALPM_SIGVALIDITY_MARGINAL, ALPM_SIGVALIDITY_NEVER, ALPM_SIGVALIDITY_UNKNOWN }
PGP signature verification status return codes.
enum _alpm_hook_when_t { ALPM_HOOK_PRE_TRANSACTION = 1, ALPM_HOOK_POST_TRANSACTION }
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.
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_RETRIEVE_START, ALPM_EVENT_RETRIEVE_DONE, ALPM_EVENT_RETRIEVE_FAILED, ALPM_EVENT_PKGDOWNLOAD_START, ALPM_EVENT_PKGDOWNLOAD_DONE, ALPM_EVENT_PKGDOWNLOAD_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.
enum _alpm_package_operation_t { ALPM_PACKAGE_INSTALL = 1, ALPM_PACKAGE_UPGRADE, ALPM_PACKAGE_REINSTALL, ALPM_PACKAGE_DOWNGRADE, ALPM_PACKAGE_REMOVE }
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 questions.
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 }
Progress.
enum alpm_caps { ALPM_CAPABILITY_NLS = (1 << 0), ALPM_CAPABILITY_DOWNLOADER = (1 << 1), ALPM_CAPABILITY_SIGNATURES = (1 << 2) }

  Functions
int alpm_logaction (alpm_handle_t *handle, const char *prefix, const char *fmt,...) __attribute__((format(printf
char * alpm_fetch_pkgurl (alpm_handle_t *handle, const char *url)
Fetch a remote pkg.
char * alpm_compute_md5sum (const char *filename)
char * alpm_compute_sha256sum (const char *filename)
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_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.
void alpm_fileconflict_free (alpm_fileconflict_t *conflict)
Frees a conflict and its members.
void alpm_depmissing_free (alpm_depmissing_t *miss)
void alpm_conflict_free (alpm_conflict_t *conflict)
Free a conflict and its members.

Detailed Description

The libalpm Public API.

Typedef Documentation

  typedef struct _alpm_backup_t alpm_backup_t

Local package or package file backup entry.

  typedef void(* alpm_cb_download) (const char *filename, off_t xfered, off_t total)

Type of download progress callbacks.

Parameters
    filename the name of the file being downloaded
    xfered the number of transferred bytes
    total the total number of bytes to transfer

  typedef void(* alpm_cb_event) (alpm_event_t *)

Event callback.

  typedef int(* alpm_cb_fetch) (const char *url, const char *localpath, int force)

A callback for downloading files.

Parameters
    url the URL of the file to be downloaded
    localpath the directory to which the file should be downloaded
    force whether to force an update, even if the file is the same

Returns
    0 on success, 1 if the file exists and is identical, -1 on error.

  typedef void(* alpm_cb_progress) (alpm_progress_t, const char *, int, size_t, size_t)

Progress callback.

  typedef void(* alpm_cb_question) (alpm_question_t *)

Question callback.

  typedef struct _alpm_conflict_t alpm_conflict_t

Conflict.

  typedef struct _alpm_depend_t alpm_depend_t

Dependency.

  typedef struct _alpm_depmissing_t alpm_depmissing_t

Missing dependency.

  typedef enum _alpm_depmod_t alpm_depmod_t

Types of version constraints in dependency specs.

  typedef union _alpm_event_t alpm_event_t

Events. This is an union passed to the callback, that allows the frontend to know which type of event was triggered (via type). It is then possible to typecast the pointer to the right structure, or use the union field, in order to access event-specific data.

  typedef int enum _alpm_event_type_t alpm_event_type_t

Type of events.

  typedef struct _alpm_file_t alpm_file_t

File in a package.

  typedef struct _alpm_fileconflict_t alpm_fileconflict_t

File conflict.

  typedef enum _alpm_fileconflicttype_t alpm_fileconflicttype_t

File conflict type. Whether the conflict results from a file existing on the filesystem, or with another target in the transaction.

  typedef struct _alpm_filelist_t alpm_filelist_t

Package filelist container.

  typedef struct _alpm_group_t alpm_group_t

Package group.

  typedef enum _alpm_loglevel_t alpm_loglevel_t

Logging Levels.

  typedef enum _alpm_pkgfrom_t alpm_pkgfrom_t

Location a package object was loaded from.

  typedef enum _alpm_pkgreason_t alpm_pkgreason_t

Package install reasons.

  typedef enum _alpm_pkgvalidation_t alpm_pkgvalidation_t

Method used to validate a package.

  typedef enum _alpm_progress_t alpm_progress_t

Progress.

  typedef union _alpm_question_t alpm_question_t

Questions. This is an union passed to the callback, that allows the frontend to know which type of question was triggered (via type). It is then possible to typecast the pointer to the right structure, or use the union field, in order to access question-specific data.

  typedef enum _alpm_question_type_t alpm_question_type_t

Type of questions. Unlike the events or progress enumerations, this enum has bitmask values so a frontend can use a bitmask map to supply preselected answers to the different types of questions.

  typedef enum _alpm_siglevel_t alpm_siglevel_t

PGP signature verification options.

  typedef struct _alpm_siglist_t alpm_siglist_t

Signature list. Contains the number of signatures found and a pointer to an array of results. The array is of size count.

  typedef struct _alpm_sigresult_t alpm_sigresult_t

Signature result. Contains the key, status, and validity of a given signature.

  typedef enum _alpm_sigstatus_t alpm_sigstatus_t

PGP signature verification status return codes.

  typedef enum _alpm_sigvalidity_t alpm_sigvalidity_t

PGP signature verification status return codes.

Enumeration Type Documentation

  enum _alpm_depmod_t

Types of version constraints in dependency specs.

Enumerator

ALPM_DEP_MOD_ANY
    No version constraint.

ALPM_DEP_MOD_EQ
    Test version equality (package=x.y.z)

ALPM_DEP_MOD_GE
    Test for at least a version (package>=x.y.z)

ALPM_DEP_MOD_LE
    Test for at most a version (package<=x.y.z)

ALPM_DEP_MOD_GT
    Test for greater than some version (package>x.y.z)

ALPM_DEP_MOD_LT
    Test for less than some version (package<x.y.z)

  enum _alpm_event_type_t

Type of events.

Enumerator

ALPM_EVENT_CHECKDEPS_START
    Dependencies will be computed for a package.

ALPM_EVENT_CHECKDEPS_DONE
    Dependencies were computed for a package.

ALPM_EVENT_FILECONFLICTS_START
    File conflicts will be computed for a package.

ALPM_EVENT_FILECONFLICTS_DONE
    File conflicts were computed for a package.

ALPM_EVENT_RESOLVEDEPS_START
    Dependencies will be resolved for target package.

ALPM_EVENT_RESOLVEDEPS_DONE
    Dependencies were resolved for target package.

ALPM_EVENT_INTERCONFLICTS_START
    Inter-conflicts will be checked for target package.

ALPM_EVENT_INTERCONFLICTS_DONE
    Inter-conflicts were checked for target package.

ALPM_EVENT_TRANSACTION_START
    Processing the package transaction is starting.

ALPM_EVENT_TRANSACTION_DONE
    Processing the package transaction is finished.

ALPM_EVENT_PACKAGE_OPERATION_START
    Package will be installed/upgraded/downgraded/re-installed/removed; See alpm_event_package_operation_t for arguments.

ALPM_EVENT_PACKAGE_OPERATION_DONE
    Package was installed/upgraded/downgraded/re-installed/removed; See alpm_event_package_operation_t for arguments.

ALPM_EVENT_INTEGRITY_START
    Target package's integrity will be checked.

ALPM_EVENT_INTEGRITY_DONE
    Target package's integrity was checked.

ALPM_EVENT_LOAD_START
    Target package will be loaded.

ALPM_EVENT_LOAD_DONE
    Target package is finished loading.

ALPM_EVENT_SCRIPTLET_INFO
    Scriptlet has printed information; See alpm_event_scriptlet_info_t for arguments.

ALPM_EVENT_RETRIEVE_START
    Files will be downloaded from a repository.

ALPM_EVENT_RETRIEVE_DONE
    Files were downloaded from a repository.

ALPM_EVENT_RETRIEVE_FAILED
    Not all files were successfully downloaded from a repository.

ALPM_EVENT_PKGDOWNLOAD_START
    A file will be downloaded from a repository; See alpm_event_pkgdownload_t for arguments.

ALPM_EVENT_PKGDOWNLOAD_DONE
    A file was downloaded from a repository; See alpm_event_pkgdownload_t for arguments.

ALPM_EVENT_PKGDOWNLOAD_FAILED
    A file failed to be downloaded from a repository; See alpm_event_pkgdownload_t for arguments.

ALPM_EVENT_DISKSPACE_START
    Disk space usage will be computed for a package.

ALPM_EVENT_DISKSPACE_DONE
    Disk space usage was computed for a package.

ALPM_EVENT_OPTDEP_REMOVAL
    An optdepend for another package is being removed; See alpm_event_optdep_removal_t for arguments.

ALPM_EVENT_DATABASE_MISSING
    A configured repository database is missing; See alpm_event_database_missing_t for arguments.

ALPM_EVENT_KEYRING_START
    Checking keys used to create signatures are in keyring.

ALPM_EVENT_KEYRING_DONE
    Keyring checking is finished.

ALPM_EVENT_KEY_DOWNLOAD_START
    Downloading missing keys into keyring.

ALPM_EVENT_KEY_DOWNLOAD_DONE
    Key downloading is finished.

ALPM_EVENT_PACNEW_CREATED
    A .pacnew file was created; See alpm_event_pacnew_created_t for arguments.

ALPM_EVENT_PACSAVE_CREATED
    A .pacsave file was created; See alpm_event_pacsave_created_t for arguments.

ALPM_EVENT_HOOK_START
    Processing hooks will be started.

ALPM_EVENT_HOOK_DONE
    Processing hooks is finished.

ALPM_EVENT_HOOK_RUN_START
    A hook is starting.

ALPM_EVENT_HOOK_RUN_DONE
    A hook has finished running.

  enum _alpm_fileconflicttype_t

File conflict type. Whether the conflict results from a file existing on the filesystem, or with another target in the transaction.

  enum _alpm_loglevel_t

Logging Levels.

  enum _alpm_package_operation_t

Enumerator

ALPM_PACKAGE_INSTALL
    Package (to be) installed. (No oldpkg)

ALPM_PACKAGE_UPGRADE
    Package (to be) upgraded.

ALPM_PACKAGE_REINSTALL
    Package (to be) re-installed.

ALPM_PACKAGE_DOWNGRADE
    Package (to be) downgraded.

ALPM_PACKAGE_REMOVE
    Package (to be) removed. (No newpkg)

  enum _alpm_pkgfrom_t

Location a package object was loaded from.

  enum _alpm_pkgreason_t

Package install reasons.

Enumerator

ALPM_PKG_REASON_EXPLICIT
    Explicitly requested by the user.

ALPM_PKG_REASON_DEPEND
    Installed as a dependency for another package.

  enum _alpm_pkgvalidation_t

Method used to validate a package.

  enum _alpm_progress_t

Progress.

  enum _alpm_question_type_t

Type of questions. Unlike the events or progress enumerations, this enum has bitmask values so a frontend can use a bitmask map to supply preselected answers to the different types of questions.

  enum _alpm_siglevel_t

PGP signature verification options.

  enum _alpm_sigstatus_t

PGP signature verification status return codes.

  enum _alpm_sigvalidity_t

PGP signature verification status return codes.

Function Documentation

  int alpm_capabilities (void)

Get the capabilities of the library.

Returns
    a bitmask of the capabilities

  void alpm_conflict_free (alpm_conflict_t * conflict)

Free a conflict and its members.

  char * alpm_fetch_pkgurl (alpm_handle_t * handle, const char * url)

Fetch a remote pkg.

Parameters
    handle the context handle
    url URL of the package to download

Returns
    the downloaded filepath on success, NULL on error

  void alpm_fileconflict_free (alpm_fileconflict_t * conflict)

Frees a conflict and its members.

  alpm_handle_t * alpm_initialize (const char * root, const char * dbpath, alpm_errno_t * err)

Initializes the library. Creates handle, connects to database and creates lockfile. This must be called before any other functions are called.

Parameters
    root the root path for all filesystem operations
    dbpath the absolute path to the libalpm database
    err an optional variable to hold any error return codes

Returns
    a context handle on success, NULL on error, err will be set if provided

References alpm_list_add().

  int alpm_release (alpm_handle_t * myhandle)

Release the library. Disconnects from the database, removes handle and lockfile This should be the last alpm call you make. After this returns, handle should be considered invalid and cannot be reused in any way.

Parameters
    myhandle the context handle

Returns
    0 on success, -1 on error

References alpm_unregister_all_syncdbs().

  int alpm_unlock (alpm_handle_t * handle)

Remove the database lock file.

Parameters
    handle the context handle

Returns
    0 on success, -1 on error

Note
    Safe to call from inside signal handlers.

  const char * alpm_version (void)

Get the version of library.

Returns
    the library version, e.g. '6.0.4'

Author

Generated automatically by Doxygen for libalpm from the source code.