dpkg 1.21.11
Data Structures | Macros | Enumerations | Functions
Version handling
Collaboration diagram for Version handling:

Data Structures

struct  dpkg_version
 Data structure representing a Debian version. More...
 

Macros

#define DPKG_VERSION_OBJECT(e, v, r)    (struct dpkg_version){ .epoch = (e), .version = (v), .revision = (r) }
 Compound literal for a dpkg_version. More...
 
#define DPKG_VERSION_INIT    DPKG_VERSION_OBJECT(0, NULL, NULL)
 

Enumerations

enum  dpkg_relation {
  DPKG_RELATION_NONE = 0 , DPKG_RELATION_EQ = DPKG_BIT(0) , DPKG_RELATION_LT = DPKG_BIT(1) , DPKG_RELATION_LE = DPKG_RELATION_LT | DPKG_RELATION_EQ ,
  DPKG_RELATION_GT = DPKG_BIT(2) , DPKG_RELATION_GE = DPKG_RELATION_GT | DPKG_RELATION_EQ
}
 Enum constants for the supported relation operations that can be done on Debian versions. More...
 

Functions

void dpkg_version_blank (struct dpkg_version *version)
 Turn the passed version into an empty version. More...
 
bool dpkg_version_is_informative (const struct dpkg_version *version)
 Test if a version is not empty. More...
 
int dpkg_version_compare (const struct dpkg_version *a, const struct dpkg_version *b)
 Compares two Debian versions. More...
 
bool dpkg_version_relate (const struct dpkg_version *a, enum dpkg_relation rel, const struct dpkg_version *b)
 Check if two versions have a certain relation. More...
 

Detailed Description

Macro Definition Documentation

◆ DPKG_VERSION_INIT

#define DPKG_VERSION_INIT    DPKG_VERSION_OBJECT(0, NULL, NULL)

◆ DPKG_VERSION_OBJECT

#define DPKG_VERSION_OBJECT (   e,
  v,
 
)     (struct dpkg_version){ .epoch = (e), .version = (v), .revision = (r) }

Compound literal for a dpkg_version.

Enumeration Type Documentation

◆ dpkg_relation

Enum constants for the supported relation operations that can be done on Debian versions.

Enumerator
DPKG_RELATION_NONE 

The “none” relation, sentinel value.

DPKG_RELATION_EQ 

Equality relation (‘=’).

DPKG_RELATION_LT 

Less than relation (‘<<’).

DPKG_RELATION_LE 

Less than or equal to relation (‘<=’).

DPKG_RELATION_GT 

Greater than relation (‘>>’).

DPKG_RELATION_GE 

Greater than or equal to relation (‘>=’).

Function Documentation

◆ dpkg_version_blank()

void dpkg_version_blank ( struct dpkg_version version)

Turn the passed version into an empty version.

This can be used to ensure the version is properly initialized.

Parameters
versionThe version to clear.

Referenced by cmpversions(), pkg_blank(), and pkgbin_blank().

Here is the caller graph for this function:

◆ dpkg_version_compare()

int dpkg_version_compare ( const struct dpkg_version a,
const struct dpkg_version b 
)

Compares two Debian versions.

This function follows the convention of the comparator functions used by qsort().

See also
deb-version(5)
Parameters
aThe first version.
bThe second version.
Return values
0If a and b are equal.
<0If a is smaller than b.
>0If a is greater than b.

References dpkg_version::epoch.

Referenced by cmpversions(), deferred_configure(), dpkg_version_relate(), and wanttoinstall().

Here is the caller graph for this function:

◆ dpkg_version_is_informative()

bool dpkg_version_is_informative ( const struct dpkg_version version)

Test if a version is not empty.

Parameters
versionThe version to test.
Return values
trueIf the version is informative (i.e. not an empty version).
falseIf the version is empty.

Referenced by cmpversions(), depisok(), pkg_is_informative(), w_configversion(), and w_version().

Here is the caller graph for this function:

◆ dpkg_version_relate()

bool dpkg_version_relate ( const struct dpkg_version a,
enum dpkg_relation  rel,
const struct dpkg_version b 
)

Check if two versions have a certain relation.

Parameters
aThe first version.
relThe relation.
bThe second version.
Return values
trueIf rel is DPKG_RELATION_NONE or the expression “a rel b” is true.
falseOtherwise.
Warning
If rel is not a valid relation, this function will terminate the program.

References DPKG_RELATION_EQ, DPKG_RELATION_GE, DPKG_RELATION_GT, DPKG_RELATION_LE, DPKG_RELATION_LT, DPKG_RELATION_NONE, dpkg_version_compare(), and internerr.

Referenced by depisok(), pkg_virtual_deppossi_satisfied(), and versionsatisfied().

Here is the call graph for this function:
Here is the caller graph for this function: