libalpm_packages(3)

๐Ÿ“ฆ
version 7.1.0.r9.g54d9411 ยท 3 versions
, in arch rolling, epel 10, fedora 43, fedora 44

๐Ÿ’– libalpm_packages ๐Ÿ’–

okay so bestie, welcome to the libalpm_packages page โ€” straight out of the Library Functions Manual (libalpm_packages(3), iykyk). this is the whole package-handling corner of libalpm and honestly? it's giving main character energy. ๐ŸŽ€


โœจ NAME โœจ

libalpm_packages โ€” Package Functions

  • Functions to manipulate libalpm packages ๐Ÿซถ

โœจ SYNOPSIS โœจ

๐Ÿฆ‹ Data Structures ๐Ÿฆ‹

  • struct alpm_pkg_xdata_t โ€” the extended data type used to store non-standard package data fields.

๐ŸŽ€ Typedefs ๐ŸŽ€

  • typedef struct _alpm_pkg_t alpm_pkg_t โ€” a package.

๐ŸŒธ Enumerations ๐ŸŒธ

  • enum alpm_pkgreason_t { ALPM_PKG_REASON_EXPLICIT = 0, ALPM_PKG_REASON_DEPEND = 1, ALPM_PKG_REASON_UNKNOWN = 2 } โ€” 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.

๐Ÿ”ฅ 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_t * alpm_pkg_compute_requiredby (alpm_pkg_t *pkg) โ€” computes the list of packages requiring a given package.
  • alpm_list_t * alpm_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 these functions hand back points to internal structures that libalpm allocated itself.

bestie, do not free them, do not modify them, in any way. that's the rule. ๐Ÿ’…

for loaded packages, they get freed when alpm_pkg_free is called. for database packages, they get 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_t * alpm_pkg_get_licenses (alpm_pkg_t *pkg) โ€” returns the list of package licenses.
  • alpm_list_t * alpm_pkg_get_groups (alpm_pkg_t *pkg) โ€” returns the list of package groups.
  • alpm_list_t * alpm_pkg_get_depends (alpm_pkg_t *pkg) โ€” returns the list of package dependencies as alpm_depend_t.
  • alpm_list_t * alpm_pkg_get_optdepends (alpm_pkg_t *pkg) โ€” returns the list of package optional dependencies.
  • alpm_list_t * alpm_pkg_get_checkdepends (alpm_pkg_t *pkg) โ€” returns a list of package check dependencies.
  • alpm_list_t * alpm_pkg_get_makedepends (alpm_pkg_t *pkg) โ€” returns a list of package make dependencies.
  • alpm_list_t * alpm_pkg_get_conflicts (alpm_pkg_t *pkg) โ€” returns the list of packages conflicting with pkg.
  • alpm_list_t * alpm_pkg_get_provides (alpm_pkg_t *pkg) โ€” returns the list of packages provided by pkg.
  • alpm_list_t * alpm_pkg_get_replaces (alpm_pkg_t *pkg) โ€” returns the list of packages to be replaced by pkg.
  • alpm_filelist_t * alpm_pkg_get_files (alpm_pkg_t *pkg) โ€” returns the list of files installed by pkg.
  • alpm_list_t * alpm_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 the detached signature file.
  • int alpm_pkg_get_validation (alpm_pkg_t *pkg) โ€” returns the method used to validate a package during install.
  • alpm_list_t * alpm_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 ๐Ÿ’œ

struct alpm_pkg_xdata_t

the extended data type used to store non-standard package data fields. it's the lil bonus bucket. ๐Ÿ“

Data Fields:

  • char * name
  • char * value

๐Ÿงš Typedef Documentation ๐Ÿงš

typedef struct _alpm_pkg_t alpm_pkg_t

a package. a package can be loaded from disk via alpm_pkg_load, or it can be retrieved from a database. packages that came from databases are automatically freed when the database is unregistered โ€” no takebacks needed. packages loaded from a file? those you must free manually, bestie, nobody's gonna do it for you. ๐Ÿ˜ญ

and once you've got one, you can query it for metadata, or add it to a transaction to be added to or removed from the system. iconic. โœจ


๐ŸŒธ Enumeration Type Documentation ๐ŸŒธ

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

enum alpm_pkgreason_t

package install reasons. why is this thing here, fr fr ๐Ÿค”

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.

enum alpm_pkgvalidation_t

method used to validate a package. the vibe check, basically. โœ…

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 ๐Ÿ”ฅ

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

fetch a list of remote packages. go get 'em. ๐Ÿƒโ€โ™€๏ธ

Parameters

  • handle โ€” the context handle
  • urls โ€” list of package URLs to download
  • fetched โ€” list of filepaths to the fetched packages, each item corresponds to one in the urls list. this is an output parameter, so the caller should provide a pointer to an empty list (*fetched === NULL) and the callee fills the list with data. don't you dare pre-fill it. ๐Ÿ™ˆ

Returns

0 on success or -1 on failure

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

close a package changelog for reading. bye bestie ๐Ÿ‘‹

Parameters

  • pkg โ€” the package to close the changelog of (either file or db)
  • fp โ€” the 'file stream' to the package changelog to close

Returns

0 on success, -1 on error

void * alpm_pkg_changelog_open (alpm_pkg_t * pkg)

open a package changelog for reading. it's similar to fopen in functionality, except that the returned 'file stream' could really be from an archive as well as from the database. plot twist. ๐Ÿ˜ฎ

Parameters

  • pkg โ€” the package to read the changelog of (either file or db)

Returns

a 'file stream' to the package changelog

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 an amount of data to read. if an error occurs, pm_errno will be set. ๐Ÿ‘€

Parameters

  • ptr โ€” a buffer to fill with raw changelog data
  • size โ€” the size of the buffer
  • pkg โ€” the package that the changelog is being read from
  • fp โ€” a 'file stream' to the package changelog

Returns

the number of characters read, or 0 if there is no more data or an error occurred.

int alpm_pkg_checkmd5sum (alpm_pkg_t * pkg)

check the integrity (with md5) of a package from the sync cache. ๐Ÿ”

Parameters

  • pkg โ€” package pointer
  • Returns โ€” 0 when it slays (success), -1 when it doesn't (error, and pm_errno gets set accordingly). ๐Ÿ’…

๐ŸŒˆ alpm_list_t * alpm_pkg_compute_optionalfor (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_compute_optionalfor (alpm_pkg_t * pkg)

Computes the list of packages that optionally require a given package. Bestie, the thing this hands back is a newly allocated list of package names (char*), and you โ€” yes you, the caller โ€” have to free it. No one else is coming to clean that up for you. ๐Ÿงนโœจ

Parameters

  • pkg โ€” a package

Returns

  • the list of packages optionally requiring pkg ๐Ÿซถ

๐ŸŒธ alpm_list_t * alpm_pkg_compute_requiredby (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_compute_requiredby (alpm_pkg_t * pkg)

Computes the list of packages that actually require a given package โ€” the hard requirement girlies, not the optional ones. Same deal as above: the return value is a newly allocated list of package names (char*) and it should be freed by the caller. Periodt. ๐Ÿ’–

Parameters

  • pkg โ€” a package

Returns

  • the list of packages requiring pkg ๐Ÿ”ฅ

๐Ÿฆ‹ off_t alpm_pkg_download_size (alpm_pkg_t * newpkg)

off_t alpm_pkg_download_size (alpm_pkg_t * newpkg)

Tells you how many bytes of files are gonna get downloaded to install a package. Like, the actual download weight. ๐Ÿ“ฆโฌ‡๏ธ

Parameters

  • newpkg โ€” the new package to upgrade to

Returns

  • the size of the download ๐Ÿ“

๐Ÿ’œ alpm_pkg_t * alpm_pkg_find (alpm_list_t * haystack, const char * needle)

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

Find a package in a list, by name. Classic needle-in-a-haystack situation but the haystack is a list of packages and honestly it's giving search energy. ๐Ÿ”

Parameters

  • haystack โ€” a list of alpm_pkg_t
  • needle โ€” the package name

Returns

  • a pointer to the package if found, or NULL ๐Ÿ˜ญ

๐ŸŽ€ int alpm_pkg_free (alpm_pkg_t * pkg)

int alpm_pkg_free (alpm_pkg_t * pkg)

Frees a package. Heads up though: only packages loaded with alpm_pkg_load can be freed by you. Packages that came from databases? Those get freed by libalpm itself when they're unregistered. So don't go freeing things that aren't yours to free, bestie, that's not the vibe. ๐Ÿ™ˆ

Parameters

  • pkg โ€” package pointer to free

Returns

  • 0 on success, -1 on error (pm_errno is set accordingly)

โœจ const char * alpm_pkg_get_arch (alpm_pkg_t * pkg)

const char * alpm_pkg_get_arch (alpm_pkg_t * pkg)

Returns the architecture the package was built for. ๐Ÿ—๏ธ

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

๐ŸŒˆ alpm_list_t * alpm_pkg_get_backup (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_backup (alpm_pkg_t * pkg)

Returns the list of files that get backed up when installing pkg. Keep those safe, they're precious. ๐Ÿ’พ

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to a list of alpm_backup_t objects

๐ŸŒธ const char * alpm_pkg_get_base (alpm_pkg_t * pkg)

const char * alpm_pkg_get_base (alpm_pkg_t * pkg)

Returns the package base name. The main character it was built from. ๐Ÿ‘‘

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

๐Ÿฆ‹ const char * alpm_pkg_get_base64_sig (alpm_pkg_t * pkg)

const char * alpm_pkg_get_base64_sig (alpm_pkg_t * pkg)

Returns the base64 encoded package signature. Encoded and ready. ๐Ÿ”

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

๐Ÿ’œ alpm_time_t alpm_pkg_get_builddate (alpm_pkg_t * pkg)

alpm_time_t alpm_pkg_get_builddate (alpm_pkg_t * pkg)

Returns the build timestamp of the package โ€” when it was born, basically. ๐ŸŽ‚

Parameters

  • pkg โ€” a pointer to package

Returns

  • the timestamp of the build time โฐ

๐ŸŽ€ alpm_list_t * alpm_pkg_get_checkdepends (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_checkdepends (alpm_pkg_t * pkg)

Returns a list of package check dependencies. The ones you need for testing, iykyk. ๐Ÿงช

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal list of alpm_depend_t structures

โœจ alpm_list_t * alpm_pkg_get_conflicts (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_conflicts (alpm_pkg_t * pkg)

Returns the list of packages that conflict with pkg. It's giving drama, but the technical kind. ๐Ÿ’€

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal list of alpm_depend_t structures

๐ŸŒˆ alpm_db_t * alpm_pkg_get_db (alpm_pkg_t * pkg)

alpm_db_t * alpm_pkg_get_db (alpm_pkg_t * pkg)

Returns the database containing pkg. Specifically it hands you a pointer to the alpm_db_t structure the package is originating from โ€” or NULL if the package was loaded from a file. So if you get NULL, don't panic, it just means the package isn't a database girlie. ๐Ÿ—„๏ธ

Parameters

  • pkg โ€” a pointer to package

Returns

  • a pointer to the DB containing pkg, or NULL.

๐ŸŒธ alpm_list_t * alpm_pkg_get_depends (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_depends (alpm_pkg_t * pkg)

Returns the list of package dependencies as alpm_depend_t. The whole squad it needs. ๐Ÿ’…

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal list of alpm_depend_t structures

๐Ÿฆ‹ const char * alpm_pkg_get_desc (alpm_pkg_t * pkg)

const char * alpm_pkg_get_desc (alpm_pkg_t * pkg)

Returns the package description. The little bio. ๐Ÿ“

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

๐Ÿ’œ const char * alpm_pkg_get_filename (alpm_pkg_t * pkg)

const char * alpm_pkg_get_filename (alpm_pkg_t * pkg)

Gets the name of the file from which the package was loaded. Where it came from. ๐Ÿ“

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

๐ŸŽ€ alpm_filelist_t * alpm_pkg_get_files (alpm_pkg_t * pkg)

alpm_filelist_t * alpm_pkg_get_files (alpm_pkg_t * pkg)

Returns the list of files installed by pkg. Important detail: the filenames are relative to the install root, and they do not include leading slashes. So no / at the front, okay bestie? ๐Ÿšซ

Parameters

  • pkg โ€” a pointer to package

Returns

  • a pointer to a filelist object containing a count and an array of package file objects

โœจ alpm_list_t * alpm_pkg_get_groups (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_groups (alpm_pkg_t * pkg)

Returns the list of package groups. The cliques it runs with. ๐Ÿ‘ฏ

Parameters

  • pkg โ€” a pointer to package

Returns

  • a pointer to an internal list of strings.

๐ŸŒˆ alpm_handle_t * alpm_pkg_get_handle (alpm_pkg_t * pkg)

alpm_handle_t * alpm_pkg_get_handle (alpm_pkg_t * pkg)

Gets the handle of a package. Every package has a home handle and this is how you find it. ๐Ÿ 

Parameters

  • pkg โ€” a pointer to package

Returns

  • the alpm handle that the package belongs to

๐ŸŒธ alpm_time_t alpm_pkg_get_installdate (alpm_pkg_t * pkg)

alpm_time_t alpm_pkg_get_installdate (alpm_pkg_t * pkg)

Returns the install timestamp of the package โ€” when it actually moved in. ๐Ÿ“ฆ๐Ÿก

Parameters

  • pkg โ€” a pointer to package

Returns

  • the timestamp of the install time โฐ

๐Ÿฆ‹ off_t alpm_pkg_get_isize (alpm_pkg_t * pkg)

off_t alpm_pkg_get_isize (alpm_pkg_t * pkg)

Returns the installed size of the package. How much space it's taking up once it's settled in. ๐Ÿ“

Parameters

  • pkg โ€” a pointer to package

Returns

  • the total size of files installed by the package.

๐Ÿ’œ alpm_list_t * alpm_pkg_get_licenses (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_licenses (alpm_pkg_t * pkg)

Returns the list of package licenses. Legal girlie behavior. โš–๏ธ

Parameters

  • pkg โ€” a pointer to package

Returns

  • a pointer to an internal list of strings.

๐ŸŽ€ alpm_list_t * alpm_pkg_get_makedepends (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_makedepends (alpm_pkg_t * pkg)

Returns a list of package make dependencies. The build-time besties. ๐Ÿ”จ

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal list of alpm_depend_t structures

โœจ const char * alpm_pkg_get_md5sum (alpm_pkg_t * pkg)

const char * alpm_pkg_get_md5sum (alpm_pkg_t * pkg)

Returns the package's MD5 checksum as a string. Fun fact: the returned string is a sequence of 32 lowercase hexadecimal digits. Count them if you want, they're all there. ๐Ÿ”ข

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

๐ŸŒˆ const char * alpm_pkg_get_name (alpm_pkg_t * pkg)

const char * alpm_pkg_get_name (alpm_pkg_t * pkg)

Returns the package name. The whole identity. ๐Ÿชช

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

๐ŸŒธ alpm_list_t * alpm_pkg_get_optdepends (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_optdepends (alpm_pkg_t * pkg)

Returns the list of package optional dependencies. The "would be nice but not required" girlies. ๐Ÿซถ

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal list of alpm_depend_t structures

๐Ÿฆ‹ alpm_pkgfrom_t alpm_pkg_get_origin (alpm_pkg_t * pkg)

alpm_pkgfrom_t alpm_pkg_get_origin (alpm_pkg_t * pkg)

Returns the origin of the package. Where it's from, its lore. ๐ŸŒ

Returns

  • an alpm_pkgfrom_t constant, -1 on error

๐Ÿ’œ const char * alpm_pkg_get_packager (alpm_pkg_t * pkg)

const char * alpm_pkg_get_packager (alpm_pkg_t * pkg)

Returns the packager's name. Credit where credit is due. ๐Ÿ†

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

๐ŸŽ€ alpm_list_t * alpm_pkg_get_provides (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_provides (alpm_pkg_t * pkg)

Returns the list of packages provided by pkg. It's giving "I can be that for you". ๐Ÿ’โ€โ™€๏ธ

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal list of alpm_depend_t structures

โœจ alpm_pkgreason_t alpm_pkg_get_reason (alpm_pkg_t * pkg)

alpm_pkgreason_t alpm_pkg_get_reason (alpm_pkg_t * pkg)

Returns the package installation reason. Why is it here? We asked, and it answered. ๐Ÿง

Parameters

  • pkg โ€” a pointer to package

Returns

  • an enum member giving the install reason.

๐ŸŒˆ alpm_list_t * alpm_pkg_get_replaces (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_replaces (alpm_pkg_t * pkg)

Returns the list of packages to be replaced by pkg. Out with the old, in with the new. ๐Ÿ”„

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal list of alpm_depend_t structures

๐ŸŒธ const char * alpm_pkg_get_sha256sum (alpm_pkg_t * pkg)

const char * alpm_pkg_get_sha256sum (alpm_pkg_t * pkg)

Returns the package's SHA256 checksum as a string. And because more digits = more drama, this one is a sequence of 64 lowercase hexadecimal digits. Double the MD5, double the fun. ๐Ÿ”

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

๐Ÿฆ‹ int alpm_pkg_get_sig (alpm_pkg_t * pkg, unsigned char ** sig, size_t * sig_len)

int alpm_pkg_get_sig (alpm_pkg_t * pkg, unsigned char ** sig, size_t * sig_len)

Extracts the package signature โ€” either from the embedded package signature, or if that's absent, it reads the data from the detached signature file instead. Either way, you're getting that signature. ๐Ÿ”

Parameters

  • pkg โ€” a pointer to package.
  • sig โ€” output parameter for signature data. The callee function allocates a buffer needed for the signature data. Caller is responsible for freeing this buffer. Yes, that means you. ๐Ÿ‘€
  • sig_len โ€” output parameter for the signature data length.

Returns

  • 0 on success, a negative number on error.

๐Ÿ’œ off_t alpm_pkg_get_size (alpm_pkg_t * pkg)

off_t alpm_pkg_get_size (alpm_pkg_t * pkg)

Returns the size of the package. But heads up: this is only available for sync database packages and package files โ€” not those loaded from the local database. So if you're getting nothing, that's why, bestie. ๐Ÿšซ

Parameters

  • pkg โ€” a pointer to package

Returns

  • the size of the package in bytes.

๐ŸŽ€ const char * alpm_pkg_get_url (alpm_pkg_t * pkg)

const char * alpm_pkg_get_url (alpm_pkg_t * pkg)

Returns the package URL. The link in the bio. ๐Ÿ”—

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

โœจ int alpm_pkg_get_validation (alpm_pkg_t * pkg)

int alpm_pkg_get_validation (alpm_pkg_t * pkg)

Returns the method used to validate a package during install. The vibe check it passes through. โœ…

Parameters

  • pkg โ€” a pointer to package

Returns

  • an enum member giving the validation method

๐ŸŒˆ const char * alpm_pkg_get_version (alpm_pkg_t * pkg)

const char * alpm_pkg_get_version (alpm_pkg_t * pkg)

Returns the package version as a string. Key detail: this includes all available epoch, version, and pkgrel components. And if you need to compare version strings, use alpm_pkg_vercmp() for that, don't try to do it yourself. ๐Ÿ”ข

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to an internal string

๐ŸŒธ alpm_list_t * alpm_pkg_get_xdata (alpm_pkg_t * pkg)

alpm_list_t * alpm_pkg_get_xdata (alpm_pkg_t * pkg)

Gets the extended data field of a package. The bonus content. ๐ŸŒŸ

Parameters

  • pkg โ€” a pointer to package

Returns

  • a reference to a list of alpm_pkg_xdata_t objects

๐Ÿฆ‹ int alpm_pkg_has_scriptlet (alpm_pkg_t * pkg)

int alpm_pkg_has_scriptlet (alpm_pkg_t * pkg)

Returns whether the package has an install scriptlet. Yes or no, does it have a little script moment. ๐Ÿ“œ

Returns

  • 0 if FALSE, TRUE otherwise

๐Ÿ’œ int alpm_pkg_load (alpm_handle_t * handle, const char * filename, int full, int level, alpm_pkg_t ** pkg)

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. โœจ Here's the tea: if full is false, the archive is read only until all necessary metadata is found. If it's true, the entire archive is read โ€” which serves as a verification of integrity and the filelist can be created. And the allocated structure? Free it using alpm_pkg_free(). Don't leave it hanging. ๐Ÿซถ

Parameters

  • handle โ€” the context handle
  • filename โ€” location of the package tarball
  • full โ€” whether to stop the load after metadata is read, or continue through the full archive
  • level โ€” what level of package signature checking to perform on the package; note that this must be a .sig file type verification
  • pkg โ€” address of the package pointer

Returns

  • 0 on success, -1 on error (pm_errno is set accordingly)

๐ŸŽ€ int alpm_pkg_mtree_close (const alpm_pkg_t * pkg, struct archive * archive)

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

Close a package mtree file. Wrapping it up, saying goodbye. ๐Ÿ‘‹

Parameters

  • pkg โ€” the local package to close the mtree of
  • archive โ€” the archive to close

โœจ int alpm_pkg_mtree_next (const alpm_pkg_t * pkg, struct archive * archive, struct archive_entry ** entry)

int alpm_pkg_mtree_next (const alpm_pkg_t * pkg, struct archive * archive, struct archive_entry ** entry)

Read the next entry from a package mtree file. Next, please. โžก๏ธ

๐Ÿ’– Parameters ๐Ÿ’–

  • pkg โ€” the package that the mtree file is being read from ๐ŸŽ€
  • archive โ€” the archive structure reading from the mtree file
  • entry โ€” an archive_entry to store the entry header information

๐Ÿ’– Returns ๐Ÿ’–

0 on success, 1 if end of archive is reached, -1 otherwise. Slay.


๐ŸŒธ struct archive * alpm_pkg_mtree_open (alpm_pkg_t * pkg) ๐ŸŒธ

Open a package mtree file for reading. bestie we are literally opening the thing. ๐Ÿ”“

Parameters

  • pkg โ€” the local package to read the mtree of

Returns

an archive structure for the package mtree file. it's giving "here's your handle, go wild" โœจ


๐Ÿฆ‹ int alpm_pkg_set_reason (alpm_pkg_t * pkg, alpm_pkgreason_t reason) ๐Ÿฆ‹

Set install reason for a package in the local database.

๐Ÿšจ okay so this is the important bit: the provided package object must be from the local database or this method will fail. no cap.

The write to the local database is performed immediately. like, no queue, no vibe check, it just goes. ๐Ÿ’…

Parameters

  • pkg โ€” the package to update
  • reason โ€” the new install reason

Returns

0 on success, -1 on error (pm_errno is set accordingly). if you get -1, go read pm_errno, she's trying to tell you something ๐Ÿ˜ญ


๐ŸŒˆ int alpm_pkg_should_ignore (alpm_handle_t * handle, alpm_pkg_t * pkg) ๐ŸŒˆ

Test if a package should be ignored. ๐Ÿ”

She checks if the package is ignored via IgnorePkg, or if the package is in a group ignored via IgnoreGroup. two whole ways to get ignored, main character energy fr.

Parameters

  • handle โ€” the context handle
  • pkg โ€” the package to test

Returns

1 if the package should be ignored, 0 otherwise. simple as that. periodt. ๐Ÿ’–


โญ 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. So: 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. classic three-way girlie behavior, we love her.

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. iykyk ๐Ÿ™ˆ

๐Ÿงš Author ๐Ÿงš

Generated automatically by Doxygen for libalpm from the source code.


and that's the whole page bestie!! ๐Ÿซถ this one came from the libalpm source and she's dated with the libalpm version stamp, and the footer literally just says libalpm + libalpm_packages(3) like a lil name tag at the bottom of the page. so iconic of her honestly. go forth and vercmp responsibly ๐Ÿ’…โœจ๐ŸŒธ