libalpm
Arch Linux Package Manager Library
Package Functions

Functions to manipulate libalpm packages More...

Collaboration diagram for Package Functions:

Data Structures

struct  alpm_pkg_xdata_t
 The extended data type used to store non-standard package data fields. More...
 

Enumerations

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...
 

Functions

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.
 

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.
 

Detailed Description

Functions to manipulate libalpm packages


Data Structure Documentation

◆ alpm_pkg_xdata_t

struct alpm_pkg_xdata_t

The extended data type used to store non-standard package data fields.

Data Fields
char * name
char * value

Enumeration Type Documentation

◆ alpm_pkgfrom_t

Location a package object was loaded from.

Enumerator
ALPM_PKG_FROM_FILE 

Loaded from a file via alpm_pkg_load.

ALPM_PKG_FROM_LOCALDB 

From the local database.

ALPM_PKG_FROM_SYNCDB 

From a sync database.

◆ 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.

ALPM_PKG_REASON_UNKNOWN 

Failed parsing of local database.

◆ alpm_pkgvalidation_t

Method used to validate a package.

Enumerator
ALPM_PKG_VALIDATION_UNKNOWN 

The package's validation type is unknown.

ALPM_PKG_VALIDATION_NONE 

The package does not have any validation.

ALPM_PKG_VALIDATION_MD5SUM 

The package is validated with md5.

ALPM_PKG_VALIDATION_SHA256SUM 

The package is validated with sha256.

ALPM_PKG_VALIDATION_SIGNATURE 

The package is validated with a PGP signature.

Function Documentation

◆ alpm_fetch_pkgurl()

int alpm_fetch_pkgurl ( alpm_handle_t * handle,
const alpm_list_t * urls,
alpm_list_t ** fetched )

◆ alpm_pkg_changelog_close()

int alpm_pkg_changelog_close ( const alpm_pkg_t * pkg,
void * fp )

Close a package changelog for reading.

Parameters
pkgthe package to close the changelog of (either file or db)
fpthe 'file stream' to the package changelog to close
Returns
0 on success, -1 on error

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_changelog_open()

void * alpm_pkg_changelog_open ( alpm_pkg_t * pkg)

Open a package changelog for reading.

Similar to fopen in functionality, except that the returned 'file stream' could really be from an archive as well as from the database.

Parameters
pkgthe package to read the changelog of (either file or db)
Returns
a 'file stream' to the package changelog

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_changelog_read()

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'.

Similar to fread in functionality, this function takes a buffer and amount of data to read. If an error occurs pm_errno will be set.

Parameters
ptra buffer to fill with raw changelog data
sizethe size of the buffer
pkgthe package that the changelog is being read from
fpa 'file stream' to the package changelog
Returns
the number of characters read, or 0 if there is no more data or an error occurred.

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_checkmd5sum()

int alpm_pkg_checkmd5sum ( alpm_pkg_t * pkg)

Check the integrity (with md5) of a package from the sync cache.

Parameters
pkgpackage pointer
Returns
0 on success, -1 on error (pm_errno is set accordingly)

References ALPM_ERR_OK, ALPM_ERR_PKG_INVALID, ALPM_ERR_WRONG_ARGS, ALPM_PKG_FROM_SYNCDB, ALPM_PKG_VALIDATION_MD5SUM, ASSERT, FREE, and RET_ERR.

◆ alpm_pkg_compute_optionalfor()

alpm_list_t * alpm_pkg_compute_optionalfor ( alpm_pkg_t * pkg)

Computes the list of packages optionally requiring a given package.

The return value of this function is a newly allocated list of package names (char*), it should be freed by the caller.

Parameters
pkga package
Returns
the list of packages optionally requiring pkg

References compute_requiredby().

◆ alpm_pkg_compute_requiredby()

alpm_list_t * alpm_pkg_compute_requiredby ( alpm_pkg_t * pkg)

Computes the list of packages requiring a given package.

The return value of this function is a newly allocated list of package names (char*), it should be freed by the caller.

Parameters
pkga package
Returns
the list of packages requiring pkg

References compute_requiredby().

◆ alpm_pkg_download_size()

off_t alpm_pkg_download_size ( alpm_pkg_t * newpkg)

Returns the size of the files that will be downloaded to install a package.

Parameters
newpkgthe new package to upgrade to
Returns
the size of the download

References compute_download_size(), and INFRQ_DSIZE.

◆ alpm_pkg_find()

alpm_pkg_t * alpm_pkg_find ( alpm_list_t * haystack,
const char * needle )

Find a package in a list by name.

Parameters
haystacka list of alpm_pkg_t
needlethe package name
Returns
a pointer to the package if found or NULL

References alpm_list_t::data, and alpm_list_t::next.

Referenced by alpm_add_pkg(), alpm_checkdeps(), alpm_find_group_pkgs(), alpm_remove_pkg(), alpm_sync_sysupgrade(), check_replacers(), remove_notify_needed_optdepends(), remove_prepare_cascade(), remove_prepare_keep_needed(), and resolvedep().

◆ alpm_pkg_free()

int alpm_pkg_free ( alpm_pkg_t * pkg)

Free a package.

Only packages loaded with alpm_pkg_load can be freed. Packages from databases will be freed by libalpm when they are unregistered.

Parameters
pkgpackage pointer to free
Returns
0 on success, -1 on error (pm_errno is set accordingly)

References ALPM_PKG_FROM_FILE, and ASSERT.

◆ alpm_pkg_get_arch()

const char * alpm_pkg_get_arch ( alpm_pkg_t * pkg)

Returns the architecture for which the package was built.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

Referenced by check_arch().

◆ alpm_pkg_get_backup()

alpm_list_t * alpm_pkg_get_backup ( alpm_pkg_t * pkg)

Returns the list of files backed up when installing pkg.

Parameters
pkga pointer to package
Returns
a reference to a list of alpm_backup_t objects

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_base()

const char * alpm_pkg_get_base ( alpm_pkg_t * pkg)

Returns the package base name.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_base64_sig()

const char * alpm_pkg_get_base64_sig ( alpm_pkg_t * pkg)

Returns the base64 encoded package signature.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_builddate()

alpm_time_t alpm_pkg_get_builddate ( alpm_pkg_t * pkg)

Returns the build timestamp of the package.

Parameters
pkga pointer to package
Returns
the timestamp of the build time

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_checkdepends()

alpm_list_t * alpm_pkg_get_checkdepends ( alpm_pkg_t * pkg)

Returns a list of package check dependencies.

Parameters
pkga pointer to package
Returns
a reference to an internal list of alpm_depend_t structures.

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_conflicts()

alpm_list_t * alpm_pkg_get_conflicts ( alpm_pkg_t * pkg)

Returns the list of packages conflicting with pkg.

Parameters
pkga pointer to package
Returns
a reference to an internal list of alpm_depend_t structures.

References ALPM_ERR_OK, and ASSERT.

Referenced by check_conflict().

◆ alpm_pkg_get_db()

alpm_db_t * alpm_pkg_get_db ( alpm_pkg_t * pkg)

Returns the database containing pkg.

Returns a pointer to the alpm_db_t structure the package is originating from, or NULL if the package was loaded from a file.

Parameters
pkga pointer to package
Returns
a pointer to the DB containing pkg, or NULL.

References ALPM_ERR_OK, ALPM_PKG_FROM_FILE, and ASSERT.

Referenced by _cache_changelog_open(), _cache_mtree_open(), check_keyring(), check_literal(), check_validity(), download_files(), and find_dl_candidates().

◆ alpm_pkg_get_depends()

alpm_list_t * alpm_pkg_get_depends ( alpm_pkg_t * pkg)

Returns the list of package dependencies as alpm_depend_t.

Parameters
pkga pointer to package
Returns
a reference to an internal list of alpm_depend_t structures.

References ALPM_ERR_OK, and ASSERT.

Referenced by alpm_checkdeps(), and find_requiredby().

◆ alpm_pkg_get_desc()

const char * alpm_pkg_get_desc ( alpm_pkg_t * pkg)

Returns the package description.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_filename()

const char * alpm_pkg_get_filename ( alpm_pkg_t * pkg)

Gets the name of the file from which the package was loaded.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_files()

alpm_filelist_t * alpm_pkg_get_files ( alpm_pkg_t * pkg)

Returns the list of files installed by pkg.

The filenames are relative to the install root, and do not include leading slashes.

Parameters
pkga pointer to package
Returns
a pointer to a filelist object containing a count and an array of package file objects

References ALPM_ERR_OK, and ASSERT.

Referenced by alpm_db_find_file_owners(), calculate_installed_size(), calculate_removed_size(), dir_belongsto_pkgs(), remove_package_files(), should_skip_file(), and unlink_file().

◆ alpm_pkg_get_groups()

alpm_list_t * alpm_pkg_get_groups ( alpm_pkg_t * pkg)

Returns the list of package groups.

Parameters
pkga pointer to package
Returns
a pointer to an internal list of strings.

References ALPM_ERR_OK, and ASSERT.

Referenced by alpm_pkg_should_ignore(), and load_grpcache().

◆ alpm_pkg_get_handle()

alpm_handle_t * alpm_pkg_get_handle ( alpm_pkg_t * pkg)

Gets the handle of a package.

Parameters
pkga pointer to package
Returns
the alpm handle that the package belongs to

References ASSERT.

◆ alpm_pkg_get_installdate()

alpm_time_t alpm_pkg_get_installdate ( alpm_pkg_t * pkg)

Returns the install timestamp of the package.

Parameters
pkga pointer to package
Returns
the timestamp of the install time

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_isize()

off_t alpm_pkg_get_isize ( alpm_pkg_t * pkg)

Returns the installed size of the package.

Parameters
pkga pointer to package
Returns
the total size of files installed by the package.

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_licenses()

alpm_list_t * alpm_pkg_get_licenses ( alpm_pkg_t * pkg)

Returns the list of package licenses.

Parameters
pkga pointer to package
Returns
a pointer to an internal list of strings.

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_makedepends()

alpm_list_t * alpm_pkg_get_makedepends ( alpm_pkg_t * pkg)

Returns a list of package make dependencies.

Parameters
pkga pointer to package
Returns
a reference to an internal list of alpm_depend_t structures.

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_md5sum()

const char * alpm_pkg_get_md5sum ( alpm_pkg_t * pkg)

Returns the package's MD5 checksum as a string.

The returned string is a sequence of 32 lowercase hexadecimal digits.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_name()

const char * alpm_pkg_get_name ( alpm_pkg_t * pkg)

Returns the package name.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_optdepends()

alpm_list_t * alpm_pkg_get_optdepends ( alpm_pkg_t * pkg)

Returns the list of package optional dependencies.

Parameters
pkga pointer to package
Returns
a reference to an internal list of alpm_depend_t structures.

References ALPM_ERR_OK, and ASSERT.

Referenced by find_requiredby(), and remove_notify_needed_optdepends().

◆ alpm_pkg_get_origin()

alpm_pkgfrom_t alpm_pkg_get_origin ( alpm_pkg_t * pkg)

Returns the origin of the package.

Returns
an alpm_pkgfrom_t constant, -1 on error

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_packager()

const char * alpm_pkg_get_packager ( alpm_pkg_t * pkg)

Returns the packager's name.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_provides()

alpm_list_t * alpm_pkg_get_provides ( alpm_pkg_t * pkg)

Returns the list of packages provided by pkg.

Parameters
pkga pointer to package
Returns
a reference to an internal list of alpm_depend_t structures.

References ALPM_ERR_OK, and ASSERT.

Referenced by resolvedep().

◆ alpm_pkg_get_reason()

alpm_pkgreason_t alpm_pkg_get_reason ( alpm_pkg_t * pkg)

Returns the package installation reason.

Parameters
pkga pointer to package
Returns
an enum member giving the install reason.

References ALPM_ERR_OK, and ASSERT.

Referenced by alpm_pkg_set_reason(), check_replacers(), and commit_single_pkg().

◆ alpm_pkg_get_replaces()

alpm_list_t * alpm_pkg_get_replaces ( alpm_pkg_t * pkg)

Returns the list of packages to be replaced by pkg.

Parameters
pkga pointer to package
Returns
a reference to an internal list of alpm_depend_t structures.

References ALPM_ERR_OK, and ASSERT.

Referenced by check_replacers().

◆ alpm_pkg_get_sha256sum()

const char * alpm_pkg_get_sha256sum ( alpm_pkg_t * pkg)

Returns the package's SHA256 checksum as a string.

The returned string is a sequence of 64 lowercase hexadecimal digits.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_sig()

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.

Parameters
pkga pointer to package.
sigoutput parameter for signature data. Callee function allocates a buffer needed for the signature data. Caller is responsible for freeing this buffer.
sig_lenoutput parameter for the signature data length.
Returns
0 on success, negative number on error.

References alpm_decode_signature(), ALPM_ERR_OK, ALPM_ERR_PKG_NOT_FOUND, ALPM_ERR_SIG_INVALID, ALPM_ERR_SIG_MISSING, ALPM_LOG_DEBUG, ASSERT, FREE, GOTO_ERR, and RET_ERR.

Referenced by check_keyring().

◆ alpm_pkg_get_size()

off_t alpm_pkg_get_size ( alpm_pkg_t * pkg)

Returns the size of the package.

This is only available for sync database packages and package files, not those loaded from the local database.

Parameters
pkga pointer to package
Returns
the size of the package in bytes.

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_url()

const char * alpm_pkg_get_url ( alpm_pkg_t * pkg)

Returns the package URL.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_validation()

int alpm_pkg_get_validation ( alpm_pkg_t * pkg)

Returns the method used to validate a package during install.

Parameters
pkga pointer to package
Returns
an enum member giving the validation method

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_version()

const char * alpm_pkg_get_version ( alpm_pkg_t * pkg)

Returns the package version as a string.

This includes all available epoch, version, and pkgrel components. Use alpm_pkg_vercmp() to compare version strings if necessary.

Parameters
pkga pointer to package
Returns
a reference to an internal string

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_get_xdata()

alpm_list_t * alpm_pkg_get_xdata ( alpm_pkg_t * pkg)

Gets the extended data field of a package.

Parameters
pkga pointer to package
Returns
a reference to a list of alpm_pkg_xdata_t objects

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_has_scriptlet()

int alpm_pkg_has_scriptlet ( alpm_pkg_t * pkg)

Returns whether the package has an install scriptlet.

Returns
0 if FALSE, TRUE otherwise

References ALPM_ERR_OK, and ASSERT.

Referenced by commit_single_pkg().

◆ alpm_pkg_load()

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.

If full is false, the archive is read only until all necessary metadata is found. If it is true, the entire archive is read, which serves as a verification of integrity and the filelist can be created. The allocated structure should be freed using alpm_pkg_free().

Parameters
handlethe context handle
filenamelocation of the package tarball
fullwhether to stop the load after metadata is read or continue through the full archive
levelwhat level of package signature checking to perform on the package; note that this must be a '.sig' file type verification
pkgaddress of the package pointer
Returns
0 on success, -1 on error (pm_errno is set accordingly)

References _, ALPM_ERR_WRONG_ARGS, alpm_extract_keyid(), ALPM_LOG_ERROR, ALPM_SIG_PACKAGE, ASSERT, CHECK_HANDLE, alpm_list_t::data, FREELIST, level, alpm_list_t::next, read_sigfile(), and RET_ERR.

◆ alpm_pkg_mtree_close()

int alpm_pkg_mtree_close ( const alpm_pkg_t * pkg,
struct archive * archive )

Close a package mtree file.

Parameters
pkgthe local package to close the mtree of
archivethe archive to close

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_mtree_next()

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.

Parameters
pkgthe package that the mtree file is being read from
archivethe archive structure reading from the mtree file
entryan archive_entry to store the entry header information
Returns
0 on success, 1 if end of archive is reached, -1 otherwise.

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_mtree_open()

struct archive * alpm_pkg_mtree_open ( alpm_pkg_t * pkg)

Open a package mtree file for reading.

Parameters
pkgthe local package to read the mtree of
Returns
an archive structure for the package mtree file

References ALPM_ERR_OK, and ASSERT.

◆ alpm_pkg_set_reason()

int alpm_pkg_set_reason ( alpm_pkg_t * pkg,
alpm_pkgreason_t reason )

Set install reason for a package in the local database.

The provided package object must be from the local database or this method will fail. The write to the local database is performed immediately.

Parameters
pkgthe package to update
reasonthe new install reason
Returns
0 on success, -1 on error (pm_errno is set accordingly)

References ALPM_ERR_DB_WRITE, ALPM_ERR_WRONG_ARGS, ALPM_LOG_DEBUG, ALPM_PKG_FROM_LOCALDB, alpm_pkg_get_reason(), ASSERT, INFRQ_DESC, and RET_ERR.

◆ alpm_pkg_should_ignore()

int alpm_pkg_should_ignore ( alpm_handle_t * handle,
alpm_pkg_t * pkg )

Test if a package should be ignored.

Checks if the package is ignored via IgnorePkg, or if the package is in a group ignored via IgnoreGroup.

Parameters
handlethe context handle
pkgthe package to test
Returns
1 if the package should be ignored, 0 otherwise

References alpm_list_find(), alpm_pkg_get_groups(), alpm_list_t::data, and alpm_list_t::next.

Referenced by alpm_find_group_pkgs(), check_literal(), check_replacers(), and resolvedep().

◆ alpm_pkg_vercmp()

int alpm_pkg_vercmp ( const char * a,
const char * b )

Compare two version strings and determine which one is 'newer'.

Returns a value comparable to the way strcmp works. Returns 1 if a is newer than b, 0 if a and b are the same version, or -1 if b is newer than a.

Different epoch values for version strings will override any further comparison. If no epoch is provided, 0 is assumed.

Keep in mind that the pkgrel is only compared if it is available on both versions handed to this function. For example, comparing 1.5-1 and 1.5 will yield 0; comparing 1.5-1 and 1.5-2 will yield -1 as expected. This is mainly for supporting versioned dependencies that do not include the pkgrel.

References parseEVR(), and rpmvercmp().

Referenced by dep_vercmp().