---
name: "libalpm_depends"
section: "3"
platform: "linux"
package: "pacman"
version: "7.1.0.r9.g54d9411-3"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libalpm_depends"
---

# libalpm\_depends(3)

Dependency - Functions dealing with libalpm's dependency and conflict information.

## NAME

libalpm\_depends - Dependency

 \- Functions dealing with libalpm's dependency and conflict information.

## SYNOPSIS

### Data Structures

struct **alpm\_depend\_t**\
 The basic dependency type.  struct **alpm\_depmissing\_t**\
 Missing dependency.  struct **alpm\_conflict\_t**\
 A conflict that has occurred between two packages.  struct **alpm\_fileconflict\_t**\
 File conflict.

### 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.  enum **alpm\_fileconflicttype\_t** { **ALPM\_FILECONFLICT\_TARGET** = 1, **ALPM\_FILECONFLICT\_FILESYSTEM** }\
 File conflict type.

### Functions

**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.  **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\_t** \* **alpm\_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\_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** .  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

## 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). \

## struct alpm\_depmissing\_t

Missing dependency.

**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. \

## struct alpm\_conflict\_t

A conflict that has occurred between two packages.

**Data Fields:**

**alpm\_pkg\_t** \* *package1* The first package. \

**alpm\_pkg\_t** \* *package2* The second package. \

**alpm\_depend\_t** \* *reason* The conflict. \

## 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

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

### enum 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\_list\_t \* alpm\_checkconflicts (alpm\_handle\_t \* handle, alpm\_list\_t \* pkglist)

Check the package conflicts in a database.

**Parameters**

*handle* the context handle \
 *pkglist* the list of packages to check

**Returns**

an **alpm\_list\_t** of **alpm\_conflict\_t**

References **alpm\_checkconflicts()**.

Referenced by **alpm\_checkconflicts()**.

### 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**

*handle* the context handle \
 *pkglist* the list of local packages \
 *remove* an alpm\_list\_t\* of packages to be removed \
 *upgrade* an alpm\_list\_t\* of packages to be upgraded (remove-then-upgrade) \
 *reversedeps* handles the backward dependencies

**Returns**

an alpm\_list\_t\* of **alpm\_depmissing\_t** pointers.

References **alpm\_checkdeps()**.

Referenced by **alpm\_checkdeps()**.

### void alpm\_conflict\_free (alpm\_conflict\_t \* conflict)

Free a conflict and its members.

**Parameters**

*conflict* the conflict to free

References **alpm\_conflict\_free()**.

Referenced by **alpm\_conflict\_free()**.

### char \* alpm\_dep\_compute\_string (const alpm\_depend\_t \* dep)

Returns a newly allocated string representing the dependency information.

**Parameters**

*dep* a dependency info structure

**Returns**

a formatted string, e.g. "glibc\>=2.12"

References **alpm\_dep\_compute\_string()**.

Referenced by **alpm\_dep\_compute\_string()**.

### void alpm\_dep\_free (alpm\_depend\_t \* dep)

Free a dependency info structure.

**Parameters**

*dep* struct to free

References **alpm\_dep\_free()**.

Referenced by **alpm\_dep\_free()**.

### 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**

*depstring* a formatted string, e.g. "glibc=2.12"

**Returns**

a dependency info structure

References **alpm\_dep\_from\_string()**.

Referenced by **alpm\_dep\_from\_string()**.

### void alpm\_depmissing\_free (alpm\_depmissing\_t \* miss)

Free a depmissing and its members.

**Parameters**

*miss* the depmissing to free

References **alpm\_depmissing\_free()**.

Referenced by **alpm\_depmissing\_free()**.

### void alpm\_fileconflict\_free (alpm\_fileconflict\_t \* conflict)

Free a fileconflict and its members.

**Parameters**

*conflict* the fileconflict to free

References **alpm\_fileconflict\_free()**.

Referenced by **alpm\_fileconflict\_free()**.

### 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**

*handle* the context handle \
 *dbs* an alpm\_list\_t\* of **alpm\_db\_t** where the satisfyer will be searched \
 *depstring* package or provision name, versioned or not

**Returns**

a alpm\_pkg\_t\* satisfying depstring

References **alpm\_find\_dbs\_satisfier()**.

Referenced by **alpm\_find\_dbs\_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**

*pkgs* an alpm\_list\_t\* of **alpm\_pkg\_t** where the satisfyer will be searched \
 *depstring* package or provision name, versioned or not

**Returns**

a alpm\_pkg\_t\* satisfying depstring

References **alpm\_find\_satisfier()**.

Referenced by **alpm\_find\_satisfier()**.

## Author

Generated automatically by Doxygen for libalpm from the source code.
