libalpm
Arch Linux Package Manager Library
Functions | Variables
package.c File Reference
#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 "delta.h"
#include "handle.h"
#include "deps.h"
Include dependency graph for lib/libalpm/package.c:

Go to the source code of this file.

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_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_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_list_talpm_pkg_get_deltas (alpm_pkg_t *pkg)
 Returns the list of available deltas for 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_talpm_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_talpm_pkg_compute_requiredby (alpm_pkg_t *pkg)
 Compute the packages requiring a given package.
alpm_file_t_alpm_file_copy (alpm_file_t *dest, const alpm_file_t *src)
int _alpm_files_cmp (const void *f1, const void *f2)
alpm_pkg_t_alpm_pkg_new (void)
int _alpm_pkg_dup (alpm_pkg_t *pkg, alpm_pkg_t **new_ptr)
 Duplicate a package data struct.
void _alpm_pkg_free (alpm_pkg_t *pkg)
void _alpm_pkg_free_trans (alpm_pkg_t *pkg)
int _alpm_pkg_compare_versions (alpm_pkg_t *spkg, alpm_pkg_t *localpkg)
int _alpm_pkg_cmp (const void *p1, const void *p2)
alpm_pkg_t_alpm_pkg_find (alpm_list_t *haystack, const char *needle)
int _alpm_pkg_should_ignore (alpm_handle_t *handle, alpm_pkg_t *pkg)
 Test if a package should be ignored.

Variables

struct pkg_operations default_pkg_ops
 The standard package operations struct.

Function Documentation

alpm_file_t* _alpm_file_copy ( alpm_file_t dest,
const alpm_file_t src 
)

Definition at line 434 of file lib/libalpm/package.c.

References _alpm_file_t::mode, _alpm_file_t::name, _alpm_file_t::size, and STRDUP.

Referenced by _alpm_pkg_dup().

Here is the caller graph for this function:

int _alpm_files_cmp ( const void *  f1,
const void *  f2 
)

Definition at line 446 of file lib/libalpm/package.c.

References _alpm_file_t::name.

int _alpm_pkg_cmp ( const void *  p1,
const void *  p2 
)

Definition at line 642 of file lib/libalpm/package.c.

References __alpm_pkg_t::name.

Referenced by _alpm_outerconflicts(), and _alpm_sync_prepare().

Here is the caller graph for this function:

int _alpm_pkg_compare_versions ( alpm_pkg_t spkg,
alpm_pkg_t localpkg 
)

Definition at line 635 of file lib/libalpm/package.c.

References alpm_pkg_vercmp(), and __alpm_pkg_t::version.

Referenced by _alpm_resolvedeps(), alpm_add_pkg(), and alpm_sync_newversion().

Here is the call graph for this function:

Here is the caller graph for this function:

int _alpm_pkg_dup ( alpm_pkg_t pkg,
alpm_pkg_t **  new_ptr 
)

Duplicate a package data struct.

Parameters:
pkgthe package to duplicate
new_ptrlocation to store duplicated package pointer
Returns:
0 on success, -1 on fatal error, 1 on non-fatal error

Definition at line 477 of file lib/libalpm/package.c.

References _, _alpm_backup_dup(), _alpm_delta_dup(), _alpm_file_copy(), _alpm_log(), _alpm_pkg_free(), ALPM_ERR_MEMORY, ALPM_ERR_PKG_INVALID, ALPM_ERR_WRONG_ARGS, alpm_list_add(), alpm_list_strdup(), ALPM_LOG_WARNING, __alpm_pkg_t::arch, __alpm_pkg_t::backup, __alpm_pkg_t::builddate, CALLOC, __alpm_pkg_t::conflicts, _alpm_filelist_t::count, __alpm_list_t::data, __alpm_pkg_t::db, __alpm_pkg_t::deltas, __alpm_pkg_t::depends, __alpm_pkg_t::desc, __alpm_pkg_t::file, __alpm_pkg_t::filename, __alpm_pkg_t::files, _alpm_filelist_t::files, pkg_operations::force_load, __alpm_pkg_t::groups, __alpm_pkg_t::handle, __alpm_pkg_t::infolevel, __alpm_pkg_t::installdate, __alpm_pkg_t::isize, __alpm_pkg_t::licenses, MALLOC, __alpm_pkg_t::md5sum, __alpm_pkg_t::name, __alpm_pkg_t::name_hash, __alpm_list_t::next, __alpm_pkg_t::ops, __alpm_pkg_t::optdepends, __alpm_pkg_t::origin, __alpm_pkg_t::origin_data, __alpm_pkg_t::packager, PKG_FROM_FILE, __alpm_handle_t::pm_errno, __alpm_pkg_t::provides, __alpm_pkg_t::reason, __alpm_pkg_t::replaces, RET_ERR, __alpm_pkg_t::scriptlet, __alpm_pkg_t::sha256sum, __alpm_pkg_t::size, STRDUP, __alpm_pkg_t::url, and __alpm_pkg_t::version.

Referenced by _alpm_db_add_pkgincache(), _alpm_recursedeps(), _alpm_sync_prepare(), and alpm_remove_pkg().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 652 of file lib/libalpm/package.c.

References _alpm_hash_sdbm(), __alpm_list_t::data, __alpm_pkg_t::name, __alpm_pkg_t::name_hash, and __alpm_list_t::next.

Referenced by _alpm_resolvedeps(), _alpm_sync_prepare(), alpm_add_pkg(), alpm_checkdeps(), alpm_find_group_pkgs(), alpm_remove_pkg(), and alpm_sync_sysupgrade().

Here is the call graph for this function:

Here is the caller graph for this function:

void _alpm_pkg_free ( alpm_pkg_t pkg)

Definition at line 619 of file lib/libalpm/package.c.

References _alpm_pkg_free(), alpm_list_free(), __alpm_pkg_t::origin, PKG_FROM_FILE, and __alpm_pkg_t::removes.

Referenced by _alpm_trans_free().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 453 of file lib/libalpm/package.c.

References CALLOC.

Referenced by _alpm_pkg_load_internal().

Here is the caller graph for this function:

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

Definition at line 690 of file lib/libalpm/package.c.

References _alpm_fnmatch(), alpm_list_find(), alpm_pkg_get_groups(), __alpm_list_t::data, __alpm_handle_t::ignoregroup, __alpm_handle_t::ignorepkg, __alpm_pkg_t::name, and __alpm_list_t::next.

Referenced by alpm_find_group_pkgs().

Here is the call graph for this function:

Here is the caller graph for this function: