libalpm
Arch Linux Package Manager Library
package.c File Reference
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "package.h"
#include "alpm_list.h"
#include "log.h"
#include "util.h"
#include "db.h"
#include "handle.h"
#include "deps.h"
Include dependency graph for package.c:

Macros

#define EPKGMETA(error)
 

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.
 
static const char * _pkg_get_base (alpm_pkg_t *pkg)
 
static const char * _pkg_get_desc (alpm_pkg_t *pkg)
 
static const char * _pkg_get_url (alpm_pkg_t *pkg)
 
static alpm_time_t _pkg_get_builddate (alpm_pkg_t *pkg)
 
static alpm_time_t _pkg_get_installdate (alpm_pkg_t *pkg)
 
static const char * _pkg_get_packager (alpm_pkg_t *pkg)
 
static const char * _pkg_get_arch (alpm_pkg_t *pkg)
 
static off_t _pkg_get_isize (alpm_pkg_t *pkg)
 
static alpm_pkgreason_t _pkg_get_reason (alpm_pkg_t *pkg)
 
static int _pkg_get_validation (alpm_pkg_t *pkg)
 
static int _pkg_has_scriptlet (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_licenses (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_groups (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_depends (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_optdepends (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_checkdepends (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_makedepends (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_conflicts (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_provides (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_replaces (alpm_pkg_t *pkg)
 
static alpm_filelist_t_pkg_get_files (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_backup (alpm_pkg_t *pkg)
 
static alpm_list_t_pkg_get_xdata (alpm_pkg_t *pkg)
 
static void * _pkg_changelog_open (alpm_pkg_t UNUSED *pkg)
 
static size_t _pkg_changelog_read (void UNUSED *ptr, size_t UNUSED size, const alpm_pkg_t UNUSED *pkg, UNUSED void *fp)
 
static int _pkg_changelog_close (const alpm_pkg_t UNUSED *pkg, void UNUSED *fp)
 
static struct archive * _pkg_mtree_open (alpm_pkg_t UNUSED *pkg)
 
static int _pkg_mtree_next (const alpm_pkg_t UNUSED *pkg, struct archive UNUSED *archive, struct archive_entry UNUSED **entry)
 
static int _pkg_mtree_close (const alpm_pkg_t UNUSED *pkg, struct archive UNUSED *archive)
 
static int _pkg_force_load (alpm_pkg_t UNUSED *pkg)
 
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.
 
alpm_handle_t * alpm_pkg_get_handle (alpm_pkg_t *pkg)
 Gets the handle of a package.
 
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)
 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.
 
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.
 
int alpm_pkg_get_validation (alpm_pkg_t *pkg)
 Returns the method used to validate a package during install.
 
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.
 
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.
 
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.
 
int alpm_pkg_has_scriptlet (alpm_pkg_t *pkg)
 Returns whether the package has an install scriptlet.
 
alpm_list_talpm_pkg_get_xdata (alpm_pkg_t *pkg)
 Gets the extended data field of a package.
 
static void find_requiredby (alpm_pkg_t *pkg, alpm_db_t *db, alpm_list_t **reqs, int optional)
 
static alpm_list_tcompute_requiredby (alpm_pkg_t *pkg, int optional)
 
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.
 
static alpm_list_tlist_depdup (alpm_list_t *old)
 
static void free_deplist (alpm_list_t *deps)
 
alpm_pkg_t * alpm_pkg_find (alpm_list_t *haystack, const char *needle)
 Find a package in a list by name.
 
int alpm_pkg_should_ignore (alpm_handle_t *handle, alpm_pkg_t *pkg)
 Test if a package should be ignored.
 

Variables

const struct pkg_operations default_pkg_ops
 The standard package operations struct.
 

Macro Definition Documentation

◆ EPKGMETA

#define EPKGMETA ( error)
Value:
do { \
error_found = -1; \
_alpm_log(pkg->handle, ALPM_LOG_ERROR, error, pkg->name, pkg->version); \
} while(0)
@ ALPM_LOG_ERROR
Error.
Definition alpm.h:1496
#define error(...)

Function Documentation

◆ _pkg_changelog_close()

static int _pkg_changelog_close ( const alpm_pkg_t UNUSED * pkg,
void UNUSED * fp )
static

◆ _pkg_changelog_open()

static void * _pkg_changelog_open ( alpm_pkg_t UNUSED * pkg)
static

◆ _pkg_changelog_read()

static size_t _pkg_changelog_read ( void UNUSED * ptr,
size_t UNUSED size,
const alpm_pkg_t UNUSED * pkg,
UNUSED void * fp )
static

◆ _pkg_force_load()

static int _pkg_force_load ( alpm_pkg_t UNUSED * pkg)
static

◆ _pkg_get_arch()

static const char * _pkg_get_arch ( alpm_pkg_t * pkg)
static

◆ _pkg_get_backup()

static alpm_list_t * _pkg_get_backup ( alpm_pkg_t * pkg)
static

◆ _pkg_get_base()

static const char * _pkg_get_base ( alpm_pkg_t * pkg)
static

◆ _pkg_get_builddate()

static alpm_time_t _pkg_get_builddate ( alpm_pkg_t * pkg)
static

◆ _pkg_get_checkdepends()

static alpm_list_t * _pkg_get_checkdepends ( alpm_pkg_t * pkg)
static

◆ _pkg_get_conflicts()

static alpm_list_t * _pkg_get_conflicts ( alpm_pkg_t * pkg)
static

◆ _pkg_get_depends()

static alpm_list_t * _pkg_get_depends ( alpm_pkg_t * pkg)
static

◆ _pkg_get_desc()

static const char * _pkg_get_desc ( alpm_pkg_t * pkg)
static

◆ _pkg_get_files()

static alpm_filelist_t * _pkg_get_files ( alpm_pkg_t * pkg)
static

◆ _pkg_get_groups()

static alpm_list_t * _pkg_get_groups ( alpm_pkg_t * pkg)
static

◆ _pkg_get_installdate()

static alpm_time_t _pkg_get_installdate ( alpm_pkg_t * pkg)
static

◆ _pkg_get_isize()

static off_t _pkg_get_isize ( alpm_pkg_t * pkg)
static

◆ _pkg_get_licenses()

static alpm_list_t * _pkg_get_licenses ( alpm_pkg_t * pkg)
static

◆ _pkg_get_makedepends()

static alpm_list_t * _pkg_get_makedepends ( alpm_pkg_t * pkg)
static

◆ _pkg_get_optdepends()

static alpm_list_t * _pkg_get_optdepends ( alpm_pkg_t * pkg)
static

◆ _pkg_get_packager()

static const char * _pkg_get_packager ( alpm_pkg_t * pkg)
static

◆ _pkg_get_provides()

static alpm_list_t * _pkg_get_provides ( alpm_pkg_t * pkg)
static

◆ _pkg_get_reason()

static alpm_pkgreason_t _pkg_get_reason ( alpm_pkg_t * pkg)
static

◆ _pkg_get_replaces()

static alpm_list_t * _pkg_get_replaces ( alpm_pkg_t * pkg)
static

◆ _pkg_get_url()

static const char * _pkg_get_url ( alpm_pkg_t * pkg)
static

◆ _pkg_get_validation()

static int _pkg_get_validation ( alpm_pkg_t * pkg)
static

◆ _pkg_get_xdata()

static alpm_list_t * _pkg_get_xdata ( alpm_pkg_t * pkg)
static

◆ _pkg_has_scriptlet()

static int _pkg_has_scriptlet ( alpm_pkg_t * pkg)
static

◆ _pkg_mtree_close()

static int _pkg_mtree_close ( const alpm_pkg_t UNUSED * pkg,
struct archive UNUSED * archive )
static

◆ _pkg_mtree_next()

static int _pkg_mtree_next ( const alpm_pkg_t UNUSED * pkg,
struct archive UNUSED * archive,
struct archive_entry UNUSED ** entry )
static

◆ _pkg_mtree_open()

static struct archive * _pkg_mtree_open ( alpm_pkg_t UNUSED * pkg)
static

◆ compute_requiredby()

◆ find_requiredby()

static void find_requiredby ( alpm_pkg_t * pkg,
alpm_db_t * db,
alpm_list_t ** reqs,
int optional )
static

◆ free_deplist()

static void free_deplist ( alpm_list_t * deps)
static

◆ list_depdup()

static alpm_list_t * list_depdup ( alpm_list_t * old)
static

Variable Documentation

◆ default_pkg_ops

const struct pkg_operations default_pkg_ops

The standard package operations struct.

Get fields directly from the struct itself with no abstraction layer or any type of lazy loading.

Referenced by get_file_pkg_ops(), and get_sync_pkg_ops().