libalpm
Arch Linux Package Manager Library
|
Functions to manipulate libalpm packages. More...
Functions | |
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. | |
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_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_base64_sig (alpm_pkg_t *pkg) |
Retuns the base64 encoded package signature. | |
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_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_list_t * | alpm_pkg_get_deltas (alpm_pkg_t *pkg) |
Returns the list of available deltas for 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. | |
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. | |
int | alpm_pkg_has_scriptlet (alpm_pkg_t *pkg) |
Returns whether the package has an install scriptlet. | |
alpm_list_t * | alpm_pkg_compute_requiredby (alpm_pkg_t *pkg) |
Compute the packages requiring a given package. | |
Variables | |
struct pkg_operations | default_pkg_ops |
The standard package operations struct. |
Functions to manipulate libalpm packages.
int alpm_pkg_changelog_close | ( | const alpm_pkg_t * | pkg, |
void * | fp | ||
) |
Close a package changelog for reading.
Definition at line 369 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::changelog_close, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_changelog().
void* alpm_pkg_changelog_open | ( | alpm_pkg_t * | pkg | ) |
Open a package changelog for reading.
Definition at line 352 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::changelog_open, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_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'.
Definition at line 360 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::changelog_read, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_changelog().
int alpm_pkg_checkmd5sum | ( | alpm_pkg_t * | pkg | ) |
Check the integrity (with md5) of a package from the sync cache.
Definition at line 57 of file lib/libalpm/package.c.
References _alpm_filecache_find(), _alpm_test_checksum(), ALPM_CSUM_MD5, ALPM_ERR_PKG_INVALID, ALPM_ERR_WRONG_ARGS, ASSERT, __alpm_pkg_t::filename, __alpm_pkg_t::handle, __alpm_pkg_t::md5sum, __alpm_pkg_t::origin, PKG_FROM_SYNCDB, __alpm_handle_t::pm_errno, and RET_ERR.
alpm_list_t* alpm_pkg_compute_requiredby | ( | alpm_pkg_t * | pkg | ) |
Compute the packages requiring a given package.
Computes the list of packages requiring a given package.
Definition at line 403 of file lib/libalpm/package.c.
References _alpm_str_cmp(), alpm_list_count(), alpm_list_msort(), ASSERT, __alpm_list_t::data, __alpm_pkg_t::db, __alpm_handle_t::db_local, DB_STATUS_LOCAL, __alpm_handle_t::dbs_sync, __alpm_pkg_t::handle, __alpm_list_t::next, __alpm_pkg_t::origin, __alpm_pkg_t::origin_data, PKG_FROM_FILE, __alpm_handle_t::pm_errno, and __alpm_db_t::status.
Referenced by dump_pkg_full().
int alpm_pkg_free | ( | alpm_pkg_t * | pkg | ) |
Free a package.
Definition at line 44 of file lib/libalpm/package.c.
References _alpm_pkg_free(), ASSERT, __alpm_pkg_t::origin, and PKG_FROM_FILE.
Referenced by main(), pacman_query(), and pacman_upgrade().
const char* alpm_pkg_get_arch | ( | alpm_pkg_t * | pkg | ) |
Returns the architecture for which the package was built.
pkg | a pointer to package |
Definition at line 243 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_arch, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
alpm_list_t* alpm_pkg_get_backup | ( | alpm_pkg_t * | pkg | ) |
Returns the list of files backed up when installing pkg.
The elements of the returned list have the form "<filename>\t<md5sum>", where the given md5sum is that of the file as provided by the package.
pkg | a pointer to package |
Definition at line 334 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_backup, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by _alpm_needbackup(), and dump_pkg_backups().
const char* alpm_pkg_get_base64_sig | ( | alpm_pkg_t * | pkg | ) |
Retuns the base64 encoded package signature.
pkg | a pointer to package |
Definition at line 236 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::base64_sig, __alpm_pkg_t::handle, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
alpm_time_t alpm_pkg_get_builddate | ( | alpm_pkg_t * | pkg | ) |
Returns the build timestamp of the package.
pkg | a pointer to package |
Definition at line 201 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_builddate, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
alpm_list_t* alpm_pkg_get_conflicts | ( | alpm_pkg_t * | pkg | ) |
Returns the list of packages conflicting with pkg.
pkg | a pointer to package |
Definition at line 299 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_conflicts, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
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.
pkg | a pointer to package |
Definition at line 341 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::db, __alpm_pkg_t::handle, __alpm_pkg_t::origin, __alpm_pkg_t::origin_data, PKG_FROM_FILE, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full(), print_packages(), and select_display().
alpm_list_t* alpm_pkg_get_deltas | ( | alpm_pkg_t * | pkg | ) |
Returns the list of available deltas for pkg.
pkg | a pointer to package |
Definition at line 320 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::deltas, __alpm_pkg_t::handle, and __alpm_handle_t::pm_errno.
alpm_list_t* alpm_pkg_get_depends | ( | alpm_pkg_t * | pkg | ) |
Returns the list of package dependencies as alpm_depend_t.
pkg | a pointer to package |
Definition at line 285 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_depends, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by alpm_checkdeps(), and dump_pkg_full().
const char* alpm_pkg_get_desc | ( | alpm_pkg_t * | pkg | ) |
Returns the package description.
pkg | a pointer to package |
Definition at line 187 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_desc, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by _alpm_db_search(), and dump_pkg_full().
const char* alpm_pkg_get_filename | ( | alpm_pkg_t * | pkg | ) |
Gets the name of the file from which the package was loaded.
pkg | a pointer to package |
Definition at line 159 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::filename, __alpm_pkg_t::handle, and __alpm_handle_t::pm_errno.
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.
pkg | a pointer to package |
Definition at line 327 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_files, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by _alpm_db_find_fileconflicts(), and dump_pkg_files().
alpm_list_t* alpm_pkg_get_groups | ( | alpm_pkg_t * | pkg | ) |
Returns the list of package groups.
pkg | a pointer to package |
Definition at line 278 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_groups, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by _alpm_db_search(), _alpm_pkg_should_ignore(), and dump_pkg_full().
Returns the install timestamp of the package.
pkg | a pointer to package |
Definition at line 208 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_installdate, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
off_t alpm_pkg_get_isize | ( | alpm_pkg_t * | pkg | ) |
Returns the installed size of the package.
pkg | a pointer to package |
Definition at line 257 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_isize, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
alpm_list_t* alpm_pkg_get_licenses | ( | alpm_pkg_t * | pkg | ) |
Returns the list of package licenses.
pkg | a pointer to package |
Definition at line 271 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_licenses, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
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.
pkg | a pointer to package |
Definition at line 222 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::handle, __alpm_pkg_t::md5sum, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
const char* alpm_pkg_get_name | ( | alpm_pkg_t * | pkg | ) |
Returns the package name.
pkg | a pointer to package |
Definition at line 166 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::handle, __alpm_pkg_t::name, and __alpm_handle_t::pm_errno.
Referenced by cb_event(), cb_question(), display_new_optdepends(), display_optdepends(), display_targets(), dump_pkg_changelog(), dump_pkg_files(), dump_pkg_full(), main(), pacman_remove(), print_packages(), and select_display().
alpm_list_t* alpm_pkg_get_optdepends | ( | alpm_pkg_t * | pkg | ) |
Returns the list of package optional dependencies.
pkg | a pointer to package |
Definition at line 292 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_optdepends, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by display_new_optdepends(), display_optdepends(), and dump_pkg_full().
alpm_pkgfrom_t alpm_pkg_get_origin | ( | alpm_pkg_t * | pkg | ) |
Returns the origin of the package.
Definition at line 180 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::handle, __alpm_pkg_t::origin, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
const char* alpm_pkg_get_packager | ( | alpm_pkg_t * | pkg | ) |
Returns the packager's name.
pkg | a pointer to package |
Definition at line 215 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_packager, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
alpm_list_t* alpm_pkg_get_provides | ( | alpm_pkg_t * | pkg | ) |
Returns the list of packages provided by pkg.
pkg | a pointer to package |
Definition at line 306 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_provides, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by _alpm_db_search(), _alpm_depcmp(), and dump_pkg_full().
Returns the package installation reason.
pkg | a pointer to package |
Definition at line 264 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_reason, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by alpm_db_set_pkgreason(), and dump_pkg_full().
alpm_list_t* alpm_pkg_get_replaces | ( | alpm_pkg_t * | pkg | ) |
Returns the list of packages to be replaced by pkg.
pkg | a pointer to package |
Definition at line 313 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_replaces, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
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.
pkg | a pointer to package |
Definition at line 229 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::handle, __alpm_handle_t::pm_errno, and __alpm_pkg_t::sha256sum.
Referenced by dump_pkg_full().
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.
pkg | a pointer to package |
Definition at line 250 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::handle, __alpm_handle_t::pm_errno, and __alpm_pkg_t::size.
Referenced by dump_pkg_full().
const char* alpm_pkg_get_url | ( | alpm_pkg_t * | pkg | ) |
Returns the package URL.
pkg | a pointer to package |
Definition at line 194 of file lib/libalpm/package.c.
References ASSERT, pkg_operations::get_url, __alpm_pkg_t::handle, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by dump_pkg_full().
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.
pkg | a pointer to package |
Definition at line 173 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::handle, __alpm_handle_t::pm_errno, and __alpm_pkg_t::version.
Referenced by cb_event(), cb_question(), dump_pkg_full(), and print_packages().
int alpm_pkg_has_scriptlet | ( | alpm_pkg_t * | pkg | ) |
Returns whether the package has an install scriptlet.
Definition at line 376 of file lib/libalpm/package.c.
References ASSERT, __alpm_pkg_t::handle, pkg_operations::has_scriptlet, __alpm_pkg_t::ops, and __alpm_handle_t::pm_errno.
Referenced by _alpm_remove_single_package(), and dump_pkg_full().
struct pkg_operations default_pkg_ops |
{ .get_desc = _pkg_get_desc, .get_url = _pkg_get_url, .get_builddate = _pkg_get_builddate, .get_installdate = _pkg_get_installdate, .get_packager = _pkg_get_packager, .get_arch = _pkg_get_arch, .get_isize = _pkg_get_isize, .get_reason = _pkg_get_reason, .has_scriptlet = _pkg_has_scriptlet, .get_licenses = _pkg_get_licenses, .get_groups = _pkg_get_groups, .get_depends = _pkg_get_depends, .get_optdepends = _pkg_get_optdepends, .get_conflicts = _pkg_get_conflicts, .get_provides = _pkg_get_provides, .get_replaces = _pkg_get_replaces, .get_files = _pkg_get_files, .get_backup = _pkg_get_backup, .changelog_open = _pkg_changelog_open, .changelog_read = _pkg_changelog_read, .changelog_close = _pkg_changelog_close, .force_load = _pkg_force_load, }
The standard package operations struct.
Get fields directly from the struct itself with no abstraction layer or any type of lazy loading.
Definition at line 128 of file lib/libalpm/package.c.