libalpm
Arch Linux Package Manager Library

Functions dealing with libalpm's dependency and conflict information. More...

Collaboration diagram for Dependency:

Data Structures

struct  alpm_depend_t
 The basic dependency type. More...
 
struct  alpm_depmissing_t
 Missing dependency. More...
 
struct  alpm_conflict_t
 A conflict that has occurred between two packages. More...
 
struct  alpm_fileconflict_t
 File conflict. More...
 

Enumerations

enum  alpm_depmod_t {
  ALPM_DEP_MOD_ANY = 1 , ALPM_DEP_MOD_EQ , ALPM_DEP_MOD_GE , ALPM_DEP_MOD_LE ,
  ALPM_DEP_MOD_GT , ALPM_DEP_MOD_LT
}
 Types of version constraints in dependency specs. More...
 
enum  alpm_fileconflicttype_t { ALPM_FILECONFLICT_TARGET = 1 , ALPM_FILECONFLICT_FILESYSTEM }
 File conflict type. More...
 

Functions

alpm_list_talpm_checkdeps (alpm_handle_t *handle, alpm_list_t *pkglist, alpm_list_t *remove, alpm_list_t *upgrade, int reversedeps)
 Checks dependencies and returns missing ones in a list.
 
alpm_pkg_t * alpm_find_satisfier (alpm_list_t *pkgs, const char *depstring)
 Find a package satisfying a specified dependency.
 
alpm_pkg_t * alpm_find_dbs_satisfier (alpm_handle_t *handle, alpm_list_t *dbs, const char *depstring)
 Find a package satisfying a specified dependency.
 
alpm_list_talpm_checkconflicts (alpm_handle_t *handle, alpm_list_t *pkglist)
 Check the package conflicts in a database.
 
char * alpm_dep_compute_string (const alpm_depend_t *dep)
 Returns a newly allocated string representing the dependency information.
 
alpm_depend_talpm_dep_from_string (const char *depstring)
 Return a newly allocated dependency information parsed from a string should be used to free the dependency .
 
void alpm_dep_free (alpm_depend_t *dep)
 Free a dependency info structure.
 
void alpm_fileconflict_free (alpm_fileconflict_t *conflict)
 Free a fileconflict and its members.
 
void alpm_depmissing_free (alpm_depmissing_t *miss)
 Free a depmissing and its members.
 
void alpm_conflict_free (alpm_conflict_t *conflict)
 Free a conflict and its members.
 

Detailed Description

Functions dealing with libalpm's dependency and conflict information.


Data Structure Documentation

◆ alpm_depend_t

struct alpm_depend_t

The basic dependency type.

This type is used throughout libalpm, not just for dependencies but also conflicts and providers.

Data Fields
char * desc A description of why this dependency is needed (optional)
alpm_depmod_t mod How the version should match against the provider.
char * name Name of the provider to satisfy this dependency.
unsigned long name_hash A hash of name (used internally to speed up conflict checks)
char * version Version of the provider to match against (optional)

◆ alpm_depmissing_t

struct alpm_depmissing_t

Missing dependency.

Collaboration diagram for alpm_depmissing_t:
Data Fields
char * causingpkg If the depmissing was caused by a conflict, the name of the package that would be installed, causing the satisfying package to be removed.
alpm_depend_t * depend The dependency that was wanted.
char * target Name of the package that has the dependency.

◆ alpm_conflict_t

struct alpm_conflict_t

A conflict that has occurred between two packages.

Collaboration diagram for alpm_conflict_t:
Data Fields
alpm_pkg_t * package1 The first package.
alpm_pkg_t * package2 The second package.
alpm_depend_t * reason The conflict.

◆ alpm_fileconflict_t

struct alpm_fileconflict_t

File conflict.

A conflict that has happened due to a two packages containing the same file, or a package contains a file that is already on the filesystem and not owned by that package.

Data Fields
char * ctarget The name of the package that also owns the file if there is one.
char * file The name of the file that the package conflicts with.
char * target The name of the package that caused the conflict.
alpm_fileconflicttype_t type The type of conflict.

Enumeration Type Documentation

◆ alpm_depmod_t

Types of version constraints in dependency specs.

Enumerator
ALPM_DEP_MOD_ANY 

No version constraint.

ALPM_DEP_MOD_EQ 

Test version equality (package=x.y.z)

ALPM_DEP_MOD_GE 

Test for at least a version (package>=x.y.z)

ALPM_DEP_MOD_LE 

Test for at most a version (package<=x.y.z)

ALPM_DEP_MOD_GT 

Test for greater than some version (package>x.y.z)

ALPM_DEP_MOD_LT 

Test for less than some version (package<x.y.z)

◆ alpm_fileconflicttype_t

File conflict type.

Whether the conflict results from a file existing on the filesystem, or with another target in the transaction.

Enumerator
ALPM_FILECONFLICT_TARGET 

The conflict results with a another target in the transaction.

ALPM_FILECONFLICT_FILESYSTEM 

The conflict results from a file existing on the filesystem.

Function Documentation

◆ alpm_checkconflicts()

alpm_list_t * alpm_checkconflicts ( alpm_handle_t * handle,
alpm_list_t * pkglist )

Check the package conflicts in a database.

Parameters
handlethe context handle
pkglistthe list of packages to check
Returns
an alpm_list_t of alpm_conflict_t

References CHECK_HANDLE.

◆ alpm_checkdeps()

alpm_list_t * alpm_checkdeps ( alpm_handle_t * handle,
alpm_list_t * pkglist,
alpm_list_t * remove,
alpm_list_t * upgrade,
int reversedeps )

Checks dependencies and returns missing ones in a list.

Dependencies can include versions with depmod operators.

Parameters
handlethe context handle
pkglistthe list of local packages
removean alpm_list_t* of packages to be removed
upgradean alpm_list_t* of packages to be upgraded (remove-then-upgrade)
reversedepshandles the backward dependencies
Returns
an alpm_list_t* of alpm_depmissing_t pointers.

References alpm_dep_compute_string(), ALPM_DEP_MOD_ANY, alpm_list_add(), alpm_list_free(), ALPM_LOG_DEBUG, alpm_pkg_find(), alpm_pkg_get_depends(), CHECK_HANDLE, alpm_list_t::data, depmiss_new(), find_dep_satisfier(), alpm_depend_t::mod, alpm_depend_t::name, alpm_list_t::next, and no_dep_version().

Referenced by remove_prepare_cascade(), and remove_prepare_keep_needed().

◆ alpm_conflict_free()

void alpm_conflict_free ( alpm_conflict_t * conflict)

Free a conflict and its members.

Parameters
conflictthe conflict to free

References ASSERT, FREE, alpm_conflict_t::package1, and alpm_conflict_t::package2.

Referenced by add_conflict(), and conflict_new().

◆ alpm_dep_compute_string()

char * alpm_dep_compute_string ( const alpm_depend_t * dep)

Returns a newly allocated string representing the dependency information.

Parameters
depa dependency info structure
Returns
a formatted string, e.g. "glibc>=2.12"

References ALPM_DEP_MOD_ANY, ALPM_DEP_MOD_EQ, ALPM_DEP_MOD_GE, ALPM_DEP_MOD_GT, ALPM_DEP_MOD_LE, ALPM_DEP_MOD_LT, ASSERT, alpm_depend_t::desc, MALLOC, alpm_depend_t::mod, alpm_depend_t::name, and alpm_depend_t::version.

Referenced by add_conflict(), alpm_checkdeps(), remove_notify_needed_optdepends(), and write_deps().

◆ alpm_dep_free()

◆ alpm_dep_from_string()

alpm_depend_t * alpm_dep_from_string ( const char * depstring)

Return a newly allocated dependency information parsed from a string should be used to free the dependency .

Parameters
depstringa formatted string, e.g. "glibc=2.12"
Returns
a dependency info structure

References alpm_dep_free(), ALPM_DEP_MOD_ANY, ALPM_DEP_MOD_EQ, ALPM_DEP_MOD_GE, ALPM_DEP_MOD_GT, ALPM_DEP_MOD_LE, ALPM_DEP_MOD_LT, CALLOC, alpm_depend_t::desc, error, alpm_depend_t::mod, alpm_depend_t::name, alpm_depend_t::name_hash, STRDUP, STRNDUP, and alpm_depend_t::version.

Referenced by alpm_find_dbs_satisfier(), alpm_find_satisfier(), and parse_descfile().

◆ alpm_depmissing_free()

void alpm_depmissing_free ( alpm_depmissing_t * miss)

Free a depmissing and its members.

Parameters
missthe depmissing to free

References alpm_dep_free(), ASSERT, alpm_depmissing_t::causingpkg, alpm_depmissing_t::depend, FREE, and alpm_depmissing_t::target.

Referenced by depmiss_new(), remove_prepare_cascade(), and remove_prepare_keep_needed().

◆ alpm_fileconflict_free()

void alpm_fileconflict_free ( alpm_fileconflict_t * conflict)

Free a fileconflict and its members.

Parameters
conflictthe fileconflict to free

References ASSERT, alpm_fileconflict_t::ctarget, alpm_fileconflict_t::file, FREE, and alpm_fileconflict_t::target.

Referenced by add_fileconflict().

◆ alpm_find_dbs_satisfier()

alpm_pkg_t * alpm_find_dbs_satisfier ( alpm_handle_t * handle,
alpm_list_t * dbs,
const char * depstring )

Find a package satisfying a specified dependency.

First look for a literal, going through each db one by one. Then look for providers. The first satisfyer that belongs to an installed package is returned. If no providers belong to an installed package then an alpm_question_select_provider_t is created to select the provider. The dependency can include versions with depmod operators.

Parameters
handlethe context handle
dbsan alpm_list_t* of alpm_db_t where the satisfyer will be searched
depstringpackage or provision name, versioned or not
Returns
a alpm_pkg_t* satisfying depstring

References alpm_dep_free(), alpm_dep_from_string(), ALPM_ERR_WRONG_ARGS, ASSERT, CHECK_HANDLE, resolvedep(), and RET_ERR.

◆ alpm_find_satisfier()

alpm_pkg_t * alpm_find_satisfier ( alpm_list_t * pkgs,
const char * depstring )

Find a package satisfying a specified dependency.

The dependency can include versions with depmod operators.

Parameters
pkgsan alpm_list_t* of alpm_pkg_t where the satisfyer will be searched
depstringpackage or provision name, versioned or not
Returns
a alpm_pkg_t* satisfying depstring

References alpm_dep_free(), alpm_dep_from_string(), and find_dep_satisfier().

Referenced by remove_notify_needed_optdepends().