Main Page Modules Data Structures File List Data Fields Globals Related Pages

# lib/depends.c File Reference

More...

`#include "system.h"`
`#include <rpmcli.h>`
`#include <rpmmacro.h>`
`#include "rpmdb.h"`
`#include "rpmds.h"`
`#include "rpmfi.h"`
`#include "rpmte.h"`
`#include "rpmts.h"`
`#include "debug.h"`

Go to the source code of this file.

## Data Structures

struct | badDeps_s
struct | orderListIndex_s

## Defines

#define | _RPMTE_INTERNAL
#define | _RPMTS_INTERNAL

## Typedefs

typedef orderListIndex_s * | orderListIndex

## Functions

int | intcmp (const void *a, const void *b)
| Compare removed package instances (qsort/bsearch). More...
int | removePackage (rpmts ts, Header h, int dboffset, alKey depends)
| Add removed package instance to ordered transaction set. More...
int | rpmtsAddInstallElement (rpmts ts, Header h, fnpyKey key, int upgrade, rpmRelocation *relocs)
int | rpmtsAddEraseElement (rpmts ts, Header h, int dboffset)
int | unsatisfiedDepend (rpmts ts, rpmds dep, int adding)
| Check dep for an unsatisfied dependency. More...
int | checkPackageDeps (rpmts ts, const char *pkgNEVR, rpmds requires, rpmds conflicts, const char *depName, uint_32 multiLib, int adding)
| Check added requires/conflicts against against installed+added packages. More...
int | checkPackageSet (rpmts ts, const char *dep, rpmdbMatchIterator mi, int adding)
| Check dependency against installed packages. More...
int | checkDependentPackages (rpmts ts, const char *dep)
| Check to-be-erased dependencies against installed requires. More...
int | checkDependentConflicts (rpmts ts, const char *dep)
| Check to-be-added dependencies against installed conflicts. More...
void | freeBadDeps (void)
int | ignoreDep (const rpmte p, const rpmte q)
| Check for dependency relations to be ignored. More...
void | markLoop (tsortInfo tsi, rpmte q)
| Recursively mark all nodes with their predecessors. More...
const char *const | identifyDepend (int_32 f)
const char * | zapRelation (rpmte q, rpmte p, rpmds requires, int zap, int *nzaps)
| Find (and eliminate co-requisites) "q <- p" relation in dependency loop. More...
int | addRelation (rpmts ts, rpmte p, unsigned char *selected, rpmds requires)
| Record next "q <- p" relation (i.e. More...
int | orderListIndexCmp (const void *one, const void *two)
| Compare ordered list entries by index (qsort/bsearch). More...
void | addQ (rpmte p, rpmte *qp, rpmte *rp)
| Add element to list sorting by tsi_qcnt. More...
int | rpmtsOrder (rpmts ts)
int | rpmtsCheck (rpmts ts)

## Variables

int | _cacheDependsRC = 1
const char * | rpmNAME = PACKAGE
const char * | rpmEVR = VERSION
int | rpmFLAGS = RPMSENSE_EQUAL
int | badDepsInitialized = 0
badDeps_s * | badDeps = NULL

## Detailed Description

Definition in file depends.c.

## Define Documentation

#define _RPMTE_INTERNAL

| Definition at line 16 of file depends.c.

#define _RPMTS_INTERNAL

| Definition at line 19 of file depends.c.

## Typedef Documentation

typedef struct orderListIndex_s* orderListIndex

| Definition at line 33 of file depends.c.

## Function Documentation

void addQ | ( | rpmte | p,
|  | rpmte * | qp,
|  | rpmte * | rp
| ) | `[static]`

Add element to list sorting by tsi_qcnt.

Parameters:

  p | new element

Return values:

  qp | address of first element
  rp | address of last element

Definition at line 1104 of file depends.c.

References rpmte, and rpmteTSI.

Referenced by rpmtsOrder.

int addRelation | ( | rpmts | ts,
|  | rpmte | p,
|  | unsigned char * | selected,
|  | rpmds | requires
| ) | `[inline, static]`

Record next "q <- p" relation (i.e.

"p" requires "q").

Parameters:

  ts | transaction set
  p | predecessor (i.e. package that "Requires: q")
  selected | boolean package selected array
  requires | relation

Returns:
  0 always

Definition at line 1004 of file depends.c.

References alKey, ignoreDep, RPMAL_NOMATCH, rpmalSatisfiesDepend, rpmds, rpmdsIx, rpmdsN, rpmte, rpmteAddedKey, rpmteDepth, rpmteSetDepth, rpmteTSI, rpmteType, rpmts, rpmtsi, rpmtsiFree, rpmtsiInit, rpmtsiNext, TR_REMOVED, tsortInfo, and xcalloc.

Referenced by rpmtsOrder.

int checkDependentConflicts | ( | rpmts | ts,
|  | const char * | dep
| ) | `[static]`

Check to-be-added dependencies against installed conflicts.

Parameters:

  ts | transaction set
  dep | conflicts name

Returns:
  0 no problems found

Definition at line 737 of file depends.c.

References checkPackageSet, RPMTAG_CONFLICTNAME, rpmts, rpmtsGetRdb, and rpmtsInitIterator.

Referenced by rpmtsCheck.

int checkDependentPackages | ( | rpmts | ts,
|  | const char * | dep
| ) | `[static]`

Check to-be-erased dependencies against installed requires.

Parameters:

  ts | transaction set
  dep | requires name

Returns:
  0 no problems found

Definition at line 722 of file depends.c.

References checkPackageSet, RPMTAG_REQUIRENAME, rpmts, and rpmtsInitIterator.

Referenced by rpmtsCheck.

int checkPackageDeps | ( | rpmts | ts,
|  | const char * | pkgNEVR,
|  | rpmds | requires,
|  | rpmds | conflicts,
|  | const char * | depName,
|  | uint_32 | multiLib,
|  | int | adding
| ) | `[static]`

Check added requires/conflicts against against installed+added packages.

Parameters:

  ts | transaction set
  pkgNEVR | package name-version-release
  requires | Requires: dependencies (or NULL)
  conflicts | Conflicts: dependencies (or NULL)
  depName | dependency name to filter (or NULL)
  multiLib | skip multilib colored dependencies?
  adding | dependency is from added package set?

Returns:
  0 no problems found

Definition at line 576 of file depends.c.

References int_32, isDependsMULTILIB, rpmalAllSatisfiesDepend, rpmds, rpmdsFlags, rpmdsInit, rpmdsN, rpmdsNext, rpmdsProblem, rpmts, uint_32, and unsatisfiedDepend.

Referenced by checkPackageSet, and rpmtsCheck.

int checkPackageSet | ( | rpmts | ts,
|  | const char * | dep,
|  | rpmdbMatchIterator | mi,
|  | int | adding
| ) | `[static]`

Check dependency against installed packages.

Adding: check name/provides dep against each conflict match, Erasing: check name/provides/filename dep against each requiredby match.

Parameters:

  ts | transaction set
  dep | dependency name
  mi | rpm database iterator
  adding | dependency is from added package set?

Returns:
  0 no problems found

Definition at line 680 of file depends.c.

References _free, checkPackageDeps, hGetNEVR, rpmdbFreeIterator, rpmdbNextIterator, rpmdbPruneIterator, rpmds, rpmdsFree, rpmdsNew, rpmdsSetNoPromote, RPMTAG_CONFLICTNAME, RPMTAG_REQUIRENAME, and rpmts.

Referenced by checkDependentConflicts, and checkDependentPackages.

void freeBadDeps | ( | void |  | ) | `[static]`

| Definition at line 799 of file depends.c. References _free, badDepsInitialized, badDeps_s::pname, and badDeps_s::qname. Referenced by rpmtsOrder.

const char* const identifyDepend | ( | int_32 | f | ) | `[inline, static]`

| Definition at line 901 of file depends.c. References _notpre, int_32, isLegacyPreReq, RPMSENSE_FIND_REQUIRES, RPMSENSE_SCRIPT_POST, RPMSENSE_SCRIPT_POSTUN, RPMSENSE_SCRIPT_PRE, RPMSENSE_SCRIPT_PREUN, and RPMSENSE_SCRIPT_VERIFY.

int ignoreDep | ( | const rpmte | p,
|  | const rpmte | q
| ) | `[static]`

Check for dependency relations to be ignored.

Parameters:

  p | successor element (i.e. with Requires: )
  q | predecessor element (i.e. with Provides: )

Returns:
  1 if dependency is to be ignored.

Definition at line 821 of file depends.c.

References _, _free, badDepsInitialized, badDeps_s::pname, poptParseArgvString, badDeps_s::qname, rpmExpand, rpmte, rpmteN, xcalloc, and xstrdup.

Referenced by addRelation.

int intcmp | ( | const void * | a,
|  | const void * | b
| ) | `[static]`

Compare removed package instances (qsort/bsearch).

Parameters:

  a | 1st instance address
  b | 2nd instance address

Returns:
  result of comparison

Definition at line 62 of file depends.c.

Referenced by removePackage.

void markLoop | ( | tsortInfo | tsi,
|  | rpmte | q
| ) | `[static]`

Recursively mark all nodes with their predecessors.

Parameters:

  tsi | successor chain
  q | predecessor

Definition at line 880 of file depends.c.

References rpmte, rpmteTSI, and tsortInfo.

Referenced by rpmtsOrder.

int orderListIndexCmp | ( | const void * | one,
|  | const void * | two
| ) | `[static]`

Compare ordered list entries by index (qsort/bsearch).

Parameters:

  one | 1st ordered list entry
  two | 2nd ordered list entry

Returns:
  result of comparison

Definition at line 1087 of file depends.c.

References orderListIndexCmp.

Referenced by orderListIndexCmp, and rpmtsOrder.

int removePackage | ( | rpmts | ts,
|  | Header | h,
|  | int | dboffset,
|  | alKey | depends
| ) | `[static]`

Add removed package instance to ordered transaction set.

Parameters:

  ts | transaction set
  h | header
  dboffset | rpm database instance
  depends | installed package of pair (or RPMAL_NOMATCH on erase)

Returns:
  0 on success

Definition at line 79 of file depends.c.

References alKey, intcmp, rpmte, rpmteNew, rpmts, TR_REMOVED, and xrealloc.

Referenced by rpmtsAddEraseElement, and rpmtsAddInstallElement.

int unsatisfiedDepend | ( | rpmts | ts,
|  | rpmds | dep,
|  | int | adding
| ) | `[static]`

Check dep for an unsatisfied dependency.

Parameters:

  ts | transaction set
  dep | dependency
  adding | dependency is from added package set?

Returns:
  0 if satisfied, 1 if not satisfied, 2 if error

Definition at line 334 of file depends.c.

References _, _cacheDependsRC, alloca, _dbiIndex::dbi_txnid, dbiCclose, dbiCopen, dbiGet, dbiOpen, dbiPut, int_32, rpmalMakeIndex, rpmalSatisfiesDepend, rpmCheckRpmlibProvides, rpmdbFreeIterator, RPMDBI_DEPENDS, rpmdbNextIterator, rpmdbPruneIterator, rpmds, rpmdsAnyMatchesDep, rpmdsDNEVR, rpmdsFlags, rpmdsN, rpmdsNotify, rpmGetVar, RPMSENSE_SENSEMASK, RPMTAG_BASENAMES, RPMTAG_NAME, RPMTAG_PROVIDENAME, RPMTRANS_FLAG_NOSUGGEST, rpmts, rpmtsFlags, rpmtsGetRdb, rpmtsInitIterator, RPMVAR_PROVIDES, and xisspace.

Referenced by checkPackageDeps.

const char* zapRelation | ( | rpmte | q,
|  | rpmte | p,
|  | rpmds | requires,
|  | int | zap,
|  | int * | nzaps
| ) | `[static]`

Find (and eliminate co-requisites) "q <- p" relation in dependency loop.

Search all successors of q for instance of p. Format the specific relation, (e.g. p contains "Requires: q"). Unlink and free co-requisite (i.e. pure Requires: dependencies) successor node(s).

Parameters:

  q | sucessor (i.e. package required by p)
  p | predecessor (i.e. package that "Requires: q")
  requires | relation
  zap | max. no. of co-requisites to remove (-1 is all)?

Return values:

  nzaps | address of no. of relations removed

Returns:
  (possibly NULL) formatted "q <- p" releation (malloc'ed)

Definition at line 937 of file depends.c.

References _, _free, identifyDepend, int_32, rpmds, rpmdsFlags, rpmdsNewDNEVR, rpmdsSetIx, RPMSENSE_PREREQ, rpmte, rpmteNEVR, rpmteTSI, and tsortInfo.

Referenced by rpmtsOrder.

## Variable Documentation

int _cacheDependsRC = 1

| Definition at line 45 of file depends.c. Referenced by hGetNEVR, and unsatisfiedDepend.

struct badDeps_s* badDeps = NULL`[static]`

| Definition at line 793 of file depends.c.

int badDepsInitialized = 0`[static]`

| Definition at line 790 of file depends.c. Referenced by freeBadDeps, and ignoreDep.

const char* rpmEVR = VERSION

| Definition at line 51 of file depends.c.

int rpmFLAGS = RPMSENSE_EQUAL

| Definition at line 54 of file depends.c.

const char* rpmNAME = PACKAGE

| Definition at line 48 of file depends.c.