lib/depends.c File Reference

#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  orderListIndex_s
struct  badDeps_s

Defines

#define _RPMTE_INTERNAL
#define _RPMTS_INTERNAL

Typedefs

typedef orderListIndex_sorderListIndex

Functions

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

Variables

int _cacheDependsRC = 1
const char * rpmNAME = PACKAGE
const char * rpmEVR = VERSION
int rpmFLAGS = RPMSENSE_EQUAL
static int badDepsInitialized = 0
static struct badDeps_sbadDeps = 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

static void addQ ( rpmte  p,
rpmte qp,
rpmte rp,
uint_32  prefcolor 
) [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 1161 of file depends.c.

References rpmteColor(), and rpmteTSI().

Referenced by rpmtsOrder().

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

References ignoreDep(), RPMAL_NOMATCH, rpmalSatisfiesDepend(), rpmdsIx(), rpmdsN(), rpmteAddedKey(), rpmteDepth(), rpmteSetDepth(), rpmteTSI(), rpmteType(), rpmtsiFree, rpmtsiInit, rpmtsiNext(), TR_REMOVED, and xcalloc().

Referenced by rpmtsOrder().

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

References checkPackageSet(), RPMTAG_CONFLICTNAME, rpmtsGetRdb(), and rpmtsInitIterator().

Referenced by rpmtsCheck().

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

References checkPackageSet(), RPMTAG_REQUIRENAME, and rpmtsInitIterator().

Referenced by rpmtsCheck().

static int checkPackageDeps ( rpmts  ts,
const char *  pkgNEVRA,
rpmds  requires,
rpmds  conflicts,
const char *  depName,
uint_32  tscolor,
int  adding 
) [static]

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

Parameters:
ts transaction set
pkgNEVRA package name-version-release.arch
requires Requires: dependencies (or NULL)
conflicts Conflicts: dependencies (or NULL)
depName dependency name to filter (or NULL)
tscolor color bits for transaction set (0 disables)
adding dependency is from added package set?
Returns:
0 no problems found

Definition at line 649 of file depends.c.

References rpmalAllSatisfiesDepend(), rpmdsColor(), rpmdsInit(), rpmdsN(), rpmdsNext(), rpmdsProblem(), and unsatisfiedDepend().

Referenced by checkPackageSet(), and rpmtsCheck().

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

References _free(), _rpmds_nopromote, checkPackageDeps(), hGetNEVRA(), rpmdbFreeIterator(), rpmdbNextIterator(), rpmdbPruneIterator(), rpmdsFree(), rpmdsNew(), rpmdsSetNoPromote(), RPMTAG_CONFLICTNAME, and RPMTAG_REQUIRENAME.

Referenced by checkDependentConflicts(), and checkDependentPackages().

static void freeBadDeps ( void   )  [static]

Definition at line 846 of file depends.c.

References _free(), badDeps, badDepsInitialized, badDeps_s::pname, and badDeps_s::qname.

Referenced by rpmtsOrder().

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

Definition at line 952 of file depends.c.

References _notpre, isLegacyPreReq, RPMSENSE_FIND_REQUIRES, RPMSENSE_SCRIPT_POST, RPMSENSE_SCRIPT_POSTUN, RPMSENSE_SCRIPT_PRE, RPMSENSE_SCRIPT_PREUN, and RPMSENSE_SCRIPT_VERIFY.

Referenced by zapRelation().

static int ignoreDep ( const rpmts  ts,
const rpmte  p,
const rpmte  q 
) [static]

Check for dependency relations to be ignored.

Parameters:
ts transaction set
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 869 of file depends.c.

References _, _free(), badDeps, badDepsInitialized, badDeps_s::pname, badDeps_s::qname, rpmExpand(), RPMMESS_DEBUG, RPMMESS_WARNING, rpmMessage, rpmteN(), RPMTRANS_FLAG_ANACONDA, RPMTRANS_FLAG_DEPLOOPS, rpmtsFlags(), xcalloc(), and xstrdup().

Referenced by addRelation().

static 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().

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

Recursively mark all nodes with their predecessors.

Parameters:
tsi successor chain
q predecessor

Definition at line 931 of file depends.c.

References rpmteTSI().

Referenced by rpmtsOrder().

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

Referenced by rpmtsOrder().

static 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 intcmp(), rpmteNew(), TR_REMOVED, and xrealloc().

Referenced by rpmtsAddEraseElement(), and rpmtsAddInstallElement().

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

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

Referenced by checkPackageDeps().

static const char* zapRelation ( rpmte  q,
rpmte  p,
rpmds  requires,
int  zap,
int *  nzaps,
int  msglvl 
) [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
Parameters:
msglvl message level at which to spew
Returns:
(possibly NULL) formatted "q <- p" releation (malloc'ed)

Definition at line 989 of file depends.c.

References _, _free(), identifyDepend(), rpmdsFlags(), rpmdsNewDNEVR(), rpmdsSetIx(), rpmMessage, RPMSENSE_PREREQ, rpmteNEVRA(), and rpmteTSI().

Referenced by rpmtsOrder().


Variable Documentation

int _cacheDependsRC = 1

Definition at line 45 of file depends.c.

Referenced by rpmtsCheck(), and unsatisfiedDepend().

struct badDeps_s* badDeps = NULL [static]

Definition at line 840 of file depends.c.

Referenced by freeBadDeps(), and ignoreDep().

int badDepsInitialized = 0 [static]

Definition at line 837 of file depends.c.

Referenced by freeBadDeps(), and ignoreDep().

const char* rpmEVR = VERSION

Definition at line 51 of file depends.c.

Referenced by printVersion().

int rpmFLAGS = RPMSENSE_EQUAL

Definition at line 54 of file depends.c.

const char* rpmNAME = PACKAGE

Definition at line 48 of file depends.c.


Generated on Fri Oct 12 08:44:55 2007 for rpm by  doxygen 1.5.2