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

lib/depends.c File Reference

More...

#include "system.h"
#include <rpmlib.h>
#include <rpmmacro.h>
#include "depends.h"
#include "rpmdb.h"
#include "debug.h"

Go to the source code of this file.

Data Structures

struct  orderListIndex
struct  badDeps_s

Typedefs

typedef int(* dbrecMatch_t )(Header h, const char *reqName, const char *reqEVR, int reqFlags)

Functions

int headerNVR (Header h, const char **np, const char **vp, const char **rp)
char * printDepend (const char *depend, const char *key, const char *keyEVR, int keyFlags)
 Return formatted dependency string.

void alFreeIndex (availableList al)
 Destroy available item index.

void alCreate (availableList al)
 Initialize available packckages, items, and directories list.

void alFree (availableList al)
 Free available packages, items, and directories members.

int dirInfoCompare (const void *one, const void *two)
 Compare two directory info entries by name (qsort/bsearch).

availablePackagealAddPackage (availableList al, Header h, const void *key, FD_t fd, rpmRelocation *relocs)
 Add package to available list.

int indexcmp (const void *one, const void *two)
 Compare two available index entries by name (qsort/bsearch).

void alMakeIndex (availableList al)
 Generate index for available list.

void parseEVR (char *evr, const char **ep, const char **vp, const char **rp)
 Split EVR into epoch, version, and release components.

int rpmRangesOverlap (const char *AName, const char *AEVR, int AFlags, const char *BName, const char *BEVR, int BFlags)
int rangeMatchesDepFlags (Header h, const char *reqName, const char *reqEVR, int reqFlags)
int headerMatchesDepFlags (Header h, const char *reqName, const char *reqEVR, int reqFlags)
rpmTransactionSet rpmtransCreateSet (rpmdb rpmdb, const char *rootDir)
int intcmp (const void *a, const void *b)
 Compare removed package instances (qsort/bsearch).

int removePackage (rpmTransactionSet ts, int dboffset, int depends)
 Add removed package instance to ordered transaction set.

int rpmtransAddPackage (rpmTransactionSet ts, Header h, FD_t fd, const void *key, int upgrade, rpmRelocation *relocs)
void rpmtransAvailablePackage (rpmTransactionSet ts, Header h, const void *key)
int rpmtransRemovePackage (rpmTransactionSet ts, int dboffset)
rpmTransactionSet rpmtransFree (rpmTransactionSet ts)
rpmDependencyConflict rpmdepFreeConflicts (rpmDependencyConflict conflicts, int numConflicts)
availablePackage ** alAllFileSatisfiesDepend (const availableList al, const char *keyType, const char *fileName)
 Check added package file lists for package(s) that provide a file.

availablePackage ** alAllSatisfiesDepend (const availableList al, const char *keyType, const char *keyDepend, const char *keyName, const char *keyEVR, int keyFlags)
 Check added package file lists for package(s) that have a provide.

availablePackagealSatisfiesDepend (const availableList al, const char *keyType, const char *keyDepend, const char *keyName, const char *keyEVR, int keyFlags)
 Check added package file lists for first package that has a provide.

int unsatisfiedDepend (rpmTransactionSet ts, const char *keyType, const char *keyDepend, const char *keyName, const char *keyEVR, int keyFlags, struct availablePackage ***suggestion)
 Check key for an unsatisfied dependency.

int checkPackageDeps (rpmTransactionSet ts, problemsSet psp, Header h, const char *keyName, uint_32 multiLib)
 Check header requires/conflicts against against installed+added packages.

int checkPackageSet (rpmTransactionSet ts, problemsSet psp, const char *key, rpmdbMatchIterator mi)
 Check dependency against installed packages.

int checkDependentPackages (rpmTransactionSet ts, problemsSet psp, const char *key)
 Erasing: check name/provides/filename key against requiredby matches.

int checkDependentConflicts (rpmTransactionSet ts, problemsSet psp, const char *key)
 Adding: check name/provides key against conflicts matches.

int ignoreDep (const struct availablePackage *p, const struct availablePackage *q)
 Check for dependency relations to be ignored.

void markLoop (tsortInfo tsi, struct availablePackage *q)
 Recursively mark all nodes with their predecessors.

const char *const  identifyDepend (int_32 f)
const char * zapRelation (struct availablePackage *q, struct availablePackage *p, int zap, int *nzaps)
 Find (and eliminate co-requisites) "q <- p" relation in dependency loop.

int addRelation (const rpmTransactionSet ts, struct availablePackage *p, unsigned char *selected, int j)
 Record next "q <- p" relation (i.e.

int orderListIndexCmp (const void *one, const void *two)
 Compare ordered list entries by index (qsort/bsearch).

void addQ (struct availablePackage *p, struct availablePackage **qp, struct availablePackage **rp)
 Add element to list sorting by initial successor count.

int rpmdepOrder (rpmTransactionSet ts)
int rpmdbCloseDBI (rpmdb db, int rpmtag)
 Close a single database index.

int rpmdepCheck (rpmTransactionSet ts, rpmDependencyConflict *conflicts, int *numConflicts)

Variables

int _depends_debug = 0
int _cacheDependsRC = 1
const char * rpmNAME = PACKAGE
const char * rpmEVR = VERSION
int rpmFLAGS = RPMSENSE_EQUAL
badDeps_sbadDeps = NULL


Detailed Description

Definition in file depends.c.


Typedef Documentation

typedef int(* dbrecMatch_t)(Header h, const char *reqName, const char * reqEVR, int reqFlags)
 

Definition at line 606 of file depends.c.


Function Documentation

void addQ struct availablePackage p,
struct availablePackage **  qp,
struct availablePackage **  rp
[static]
 

Add element to list sorting by initial successor count.

Parameters:
p new element
Return values:
qp address of first element
rp address of last element

Definition at line 1884 of file depends.c.

References availablePackage::tsi, tsortInfo_s::tsi_qcnt, and tsortInfo_s::tsi_reqx.

Referenced by rpmdepOrder().

int addRelation const rpmTransactionSet  ts,
struct availablePackage p,
unsigned char *  selected,
int  j
[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
j relation index
Returns:
0 always

Definition at line 1818 of file depends.c.

References rpmTransactionSet_s::addedPackages, alSatisfiesDepend(), availablePackage::depth, ignoreDep(), availableList_s::list, availablePackage::requireFlags, availablePackage::requires, availablePackage::requiresEVR, rpmTransactionSet, availablePackage::tsi, tsortInfo_s::tsi_next, tsortInfo_s::tsi_qcnt, tsortInfo, and xmalloc().

Referenced by rpmdepOrder().

struct availablePackage* alAddPackage availableList  al,
Header  h,
const void *  key,
FD_t  fd,
rpmRelocation relocs
[static]
 

Add package to available list.

Parameters:
al available list
h package header
key package private data
fd package file handle
relocs package file relocations
Returns:
available package pointer

Definition at line 241 of file depends.c.

References alFreeIndex(), alloca(), availableList_s::alloced, availableList, availableList_s::delta, dirInfo, dirInfoCompare(), dirInfo_s::dirName, dirInfo_s::dirNameLen, availableList_s::dirs, FD_t, fdLink, dirInfo_s::files, availablePackage::h, Header, headerLink(), headerNVR(), HFD_t, HGE_t, int_32, availableList_s::list, availablePackage::name, availableList_s::numDirs, dirInfo_s::numFiles, rpmRelocation_s::oldPath, rpmRelocation, RPMTAG_BASENAMES, RPMTAG_DIRINDEXES, RPMTAG_DIRNAMES, RPMTAG_EPOCH, RPMTAG_FILEFLAGS, RPMTAG_MULTILIBS, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_REQUIREFLAGS, RPMTAG_REQUIRENAME, RPMTAG_REQUIREVERSION, rpmTagType, rpmVersionCompare(), availableList_s::size, uint_32, xmalloc(), xrealloc(), and xstrdup().

Referenced by rpmtransAddPackage(), and rpmtransAvailablePackage().

struct availablePackage** alAllFileSatisfiesDepend const availableList  al,
const char *  keyType,
const char *  fileName
[static]
 

Check added package file lists for package(s) that provide a file.

Parameters:
al available list
keyType type of dependency
fileName file name to search for
Returns:
available package pointer

Definition at line 963 of file depends.c.

References _, _free(), availableList, dirInfo, dirInfoCompare(), dirInfo_s::dirName, dirInfo_s::dirNameLen, availableList_s::dirs, isFileMULTILIB, availableList_s::list, availablePackage::multiLib, availableList_s::numDirs, RPMMESS_DEBUG, rpmMessage, xrealloc(), and xstrdup().

Referenced by alAllSatisfiesDepend().

struct availablePackage** alAllSatisfiesDepend const availableList  al,
const char *  keyType,
const char *  keyDepend,
const char *  keyName,
const char *  keyEVR,
int  keyFlags
[static]
 

Check added package file lists for package(s) that have a provide.

Parameters:
al available list
keyType type of dependency
keyDepend dependency string representation
keyName dependency name string
keyEVR dependency [epoch:]version[-release] string
keyFlags dependency logical range qualifiers
Returns:
available package pointer

Definition at line 1078 of file depends.c.

References _, alAllFileSatisfiesDepend(), availableList, availableIndexEntry::entry, availableIndexEntry::entryLen, availableIndex::index, availableList_s::index, indexcmp(), RPMMESS_DEBUG, rpmMessage, rpmRangesOverlap(), availableIndex::size, and xrealloc().

Referenced by alSatisfiesDepend(), and unsatisfiedDepend().

void alCreate availableList  al  )  [static]
 

Initialize available packckages, items, and directories list.

Parameters:
al available list

Definition at line 144 of file depends.c.

References availableList_s::alloced, availableList, availableList_s::delta, availableList_s::dirs, availableIndex::index, availableList_s::index, availableList_s::list, availableList_s::numDirs, availableIndex::size, availableList_s::size, and xcalloc().

Referenced by rpmtransCreateSet().

void alFree availableList  al  )  [static]
 

Free available packages, items, and directories members.

Parameters:
al available list

Definition at line 162 of file depends.c.

References _free(), alFreeIndex(), availableList_s::alloced, availableList, dirInfo_s::dirName, availableList_s::dirs, fdFree, dirInfo_s::files, headerFree(), HFD_t, availableList_s::list, rpmRelocation_s::newPath, availableList_s::numDirs, rpmRelocation_s::oldPath, rpmRelocation, availableList_s::size, tsortInfo_s::tsi_next, and tsortInfo.

Referenced by rpmtransFree().

void alFreeIndex availableList  al  )  [static]
 

Destroy available item index.

Parameters:
al available list

Definition at line 131 of file depends.c.

References _free(), availableList, availableIndex::index, availableList_s::index, and availableIndex::size.

Referenced by alAddPackage(), and alFree().

void alMakeIndex availableList  al  )  [static]
 

Generate index for available list.

Parameters:
al available list

Definition at line 444 of file depends.c.

References availableList, availableList_s::index, indexcmp(), isDependsMULTILIB, availableList_s::list, availablePackage::multiLib, availablePackage::provideFlags, availablePackage::provides, availablePackage::providesCount, availableIndex::size, availableList_s::size, and xcalloc().

Referenced by rpmdepCheck(), and rpmdepOrder().

struct availablePackage* alSatisfiesDepend const availableList  al,
const char *  keyType,
const char *  keyDepend,
const char *  keyName,
const char *  keyEVR,
int  keyFlags
[inline, static]
 

Check added package file lists for first package that has a provide.

Todo:
Eliminate.
Parameters:
al available list
keyType type of dependency
keyDepend dependency string representation
keyName dependency name string
keyEVR dependency [epoch:]version[-release] string
keyFlags dependency logical range qualifiers
Returns:
available package pointer

Definition at line 1159 of file depends.c.

References _free(), alAllSatisfiesDepend(), and availableList.

Referenced by addRelation(), and unsatisfiedDepend().

int checkDependentConflicts rpmTransactionSet  ts,
problemsSet  psp,
const char *  key
[static]
 

Adding: check name/provides key against conflicts matches.

Parameters:
ts transaction set
psp dependency problems
key conflicts name
Returns:
0 no problems found

Definition at line 1599 of file depends.c.

References checkPackageSet(), problemsSet, rpmTransactionSet_s::rpmdb, rpmdbInitIterator(), RPMTAG_CONFLICTNAME, and rpmTransactionSet.

Referenced by rpmdepCheck().

int checkDependentPackages rpmTransactionSet  ts,
problemsSet  psp,
const char *  key
[static]
 

Erasing: check name/provides/filename key against requiredby matches.

Parameters:
ts transaction set
psp dependency problems
key requires name
Returns:
0 no problems found

Definition at line 1583 of file depends.c.

References checkPackageSet(), problemsSet, rpmTransactionSet_s::rpmdb, rpmdbInitIterator(), RPMTAG_REQUIRENAME, and rpmTransactionSet.

Referenced by rpmdepCheck().

int checkPackageDeps rpmTransactionSet  ts,
problemsSet  psp,
Header  h,
const char *  keyName,
uint_32  multiLib
[static]
 

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

Parameters:
ts transaction set
psp dependency problems
h header to check
keyName dependency name
multiLib skip multilib colored dependencies?
Returns:
0 no problems found

Definition at line 1371 of file depends.c.

References _, _free(), problemsSet_s::alloced, rpmDependencyConflict_s::byHeader, rpmDependencyConflict_s::byName, rpmDependencyConflict_s::byRelease, rpmDependencyConflict_s::byVersion, Header, headerLink(), headerNVR(), HFD_t, HGE_t, int_32, isDependsMULTILIB, rpmDependencyConflict_s::needsFlags, rpmDependencyConflict_s::needsName, rpmDependencyConflict_s::needsVersion, problemsSet_s::num, printDepend(), problemsSet_s::problems, problemsSet, RPM_STRING_ARRAY_TYPE, rpmDependencyConflict, RPMMESS_DEBUG, rpmMessage, RPMTAG_CONFLICTFLAGS, RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION, RPMTAG_REQUIREFLAGS, RPMTAG_REQUIRENAME, RPMTAG_REQUIREVERSION, rpmTagType, rpmTransactionSet, rpmDependencyConflict_s::sense, rpmDependencyConflict_s::suggestedPackages, uint_32, unsatisfiedDepend(), xmalloc(), xrealloc(), and xstrdup().

Referenced by checkPackageSet(), and rpmdepCheck().

int checkPackageSet rpmTransactionSet  ts,
problemsSet  psp,
const char *  key,
rpmdbMatchIterator  mi
[static]
 

Check dependency against installed packages.

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

Parameters:
ts transaction set
psp dependency problems
key dependency name
mi rpm database iterator
Returns:
0 no problems found

Definition at line 1556 of file depends.c.

References checkPackageDeps(), Header, rpmTransactionSet_s::numRemovedPackages, problemsSet, rpmTransactionSet_s::removedPackages, rpmdbFreeIterator(), rpmdbNextIterator(), rpmdbPruneIterator(), and rpmTransactionSet.

Referenced by checkDependentConflicts(), and checkDependentPackages().

int dirInfoCompare const void *  one,
const void *  two
[static]
 

Compare two directory info entries by name (qsort/bsearch).

Parameters:
one 1st directory info
two 2nd directory info
Returns:
result of comparison

Definition at line 218 of file depends.c.

References dirInfo, dirInfo_s::dirName, and dirInfo_s::dirNameLen.

Referenced by alAddPackage(), and alAllFileSatisfiesDepend().

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

Definition at line 1728 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.

Referenced by zapRelation().

int ignoreDep const struct availablePackage p,
const struct availablePackage q
[static]
 

Check for dependency relations to be ignored.

Parameters:
p successor package (i.e. with Requires: )
q predecessor package (i.e. with Provides: )
Returns:
1 if dependency is to be ignored.

Definition at line 1659 of file depends.c.

References _, _free(), badDeps, availablePackage::name, badDeps_s::pname, poptParseArgvString(), rpmExpand(), RPMMESS_DEBUG, rpmMessage, xcalloc(), and xstrdup().

Referenced by addRelation().

int indexcmp const void *  one,
const void *  two
[static]
 

Compare two available index entries by name (qsort/bsearch).

Parameters:
one 1st available index entry
two 2nd available index entry
Returns:
result of comparison

Definition at line 428 of file depends.c.

Referenced by alAllSatisfiesDepend(), and alMakeIndex().

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 748 of file depends.c.

Referenced by removePackage().

void markLoop tsortInfo  tsi,
struct availablePackage q
[static]
 

Recursively mark all nodes with their predecessors.

Parameters:
tsi successor chain
q predecessor

Definition at line 1711 of file depends.c.

References tsortInfo_s::tsi_next, tsortInfo_s::tsi_pkg, and tsortInfo.

Referenced by rpmdepOrder().

int orderListIndexCmp const void *  one,
const void *  two
[static]
 

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

Parameters:
a 1st ordered list entry
b 2nd ordered list entry
Returns:
result of comparison

Definition at line 1871 of file depends.c.

Referenced by rpmdepOrder().

void parseEVR char *  evr,
const char **  ep,
const char **  vp,
const char **  rp
[static]
 

Split EVR into epoch, version, and release components.

Parameters:
evr [epoch:]version[-release] string
Return values:
*ep pointer to epoch
*vp pointer to version
*rp pointer to release

Definition at line 489 of file depends.c.

References xisdigit().

Referenced by rpmRangesOverlap().

char* printDepend const char *  depend,
const char *  key,
const char *  keyEVR,
int  keyFlags
[static]
 

Return formatted dependency string.

Parameters:
depend type of dependency ("R" == Requires, "C" == Conflcts)
key dependency name string
keyEVR dependency [epoch:]version[-release] string
keyFlags dependency logical range qualifiers
Returns:
formatted dependency (malloc'ed)

Definition at line 62 of file depends.c.

References RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, RPMSENSE_SENSEMASK, and xmalloc().

Referenced by checkPackageDeps(), rpmRangesOverlap(), and zapRelation().

int rangeMatchesDepFlags Header  h,
const char *  reqName,
const char *  reqEVR,
int  reqFlags
[static]
 

Definition at line 609 of file depends.c.

References Header, HFD_t, HGE_t, int_32, rpmRangesOverlap(), RPMSENSE_SENSEMASK, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, and rpmTagType.

Referenced by unsatisfiedDepend().

int removePackage rpmTransactionSet  ts,
int  dboffset,
int  depends
[static]
 

Add removed package instance to ordered transaction set.

Parameters:
ts transaction set
dboffset rpm database instance
depends installed package of pair (or -1 on erase)
Returns:
0 on success

Definition at line 763 of file depends.c.

References rpmTransactionSet_s::allocedRemovedPackages, rpmTransactionSet_s::delta, intcmp(), rpmTransactionSet_s::numRemovedPackages, rpmTransactionSet_s::order, rpmTransactionSet_s::orderAlloced, rpmTransactionSet_s::orderCount, rpmTransactionSet_s::removedPackages, rpmTransactionSet, transactionElement_s::type, transactionElement_s::u, and xrealloc().

Referenced by rpmtransAddPackage(), and rpmtransRemovePackage().

int rpmdbCloseDBI rpmdb  db,
int  rpmtag
[static]
 

Close a single database index.

Parameters:
db rpm database
rpmtag rpm tag
Returns:
0 on success

Definition at line 2231 of file depends.c.

References dbiClose(), dbiTags, and dbiTagsMax.

Referenced by rpmdepCheck().

int unsatisfiedDepend rpmTransactionSet  ts,
const char *  keyType,
const char *  keyDepend,
const char *  keyName,
const char *  keyEVR,
int  keyFlags,
struct availablePackage ***  suggestion
[static]
 

Check key for an unsatisfied dependency.

Todo:
Eliminate rpmrc provides.
Parameters:
al available list
keyType type of dependency
keyDepend dependency string representation
keyName dependency name string
keyEVR dependency [epoch:]version[-release] string
keyFlags dependency logical range qualifiers
Return values:
suggestion possible package(s) to resolve dependency
Returns:
0 if satisfied, 1 if not satisfied, 2 if error

Definition at line 1188 of file depends.c.

References _, _cacheDependsRC, rpmTransactionSet_s::addedPackages, alAllSatisfiesDepend(), alSatisfiesDepend(), rpmTransactionSet_s::availablePackages, DBC, DBI_WRITECURSOR, dbiCclose(), dbiCopen(), dbiGet(), dbiIndex, dbiOpen(), dbiPut(), Header, rpmTransactionSet_s::numRemovedPackages, rangeMatchesDepFlags(), rpmTransactionSet_s::removedPackages, rpmCheckRpmlibProvides(), rpmTransactionSet_s::rpmdb, rpmdbFreeIterator(), RPMDBI_DEPENDS, rpmdbInitIterator(), rpmdbNextIterator(), rpmdbPruneIterator(), rpmGetVar(), RPMMESS_DEBUG, rpmMessage, RPMSENSE_SENSEMASK, RPMTAG_BASENAMES, RPMTAG_NAME, RPMTAG_PROVIDENAME, rpmTransactionSet, RPMVAR_PROVIDES, and xisspace().

Referenced by checkPackageDeps().

const char* zapRelation struct availablePackage q,
struct availablePackage p,
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")
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 1760 of file depends.c.

References _, _free(), identifyDepend(), availablePackage::name, printDepend(), availablePackage::release, availablePackage::requireFlags, availablePackage::requires, availablePackage::requiresEVR, RPMMESS_DEBUG, rpmMessage, RPMSENSE_PREREQ, availablePackage::tsi, tsortInfo_s::tsi_next, tsortInfo, and availablePackage::version.

Referenced by rpmdepOrder().


Variable Documentation

int _cacheDependsRC = 1 [static]
 

Definition at line 29 of file depends.c.

Referenced by rpmdepCheck(), and unsatisfiedDepend().

int _depends_debug = 0 [static]
 

Definition at line 6 of file depends.c.

struct badDeps_s* badDeps = NULL [static]
 

Definition at line 1649 of file depends.c.

Referenced by ignoreDep().

const char* rpmEVR = VERSION
 

Definition at line 526 of file depends.c.

Referenced by printVersion().

int rpmFLAGS = RPMSENSE_EQUAL
 

Definition at line 527 of file depends.c.

const char* rpmNAME = PACKAGE
 

Definition at line 525 of file depends.c.


Generated on Thu Apr 29 08:02:37 2004 for rpm by doxygen 1.3.6