rpm 5.3.7
Defines | Functions | Variables

lib/depends.c File Reference

#include "system.h"
#include <rpmio.h>
#include <rpmiotypes.h>
#include <rpmcb.h>
#include <rpmbf.h>
#include <rpmmacro.h>
#include <envvar.h>
#include <ugid.h>
#include <rpmtag.h>
#include <rpmdb.h>
#include <rpmds.h>
#include <rpmfi.h>
#include <rpmte.h>
#include <rpmcli.h>
#include "debug.h"
Include dependency graph for depends.c:

Go to the source code of this file.

Defines

#define _RPMDB_INTERNAL
#define _RPMEVR_INTERNAL
#define _RPMTE_INTERNAL
#define _RPMTS_INTERNAL
#define CACHE_DEPENDENCY_RESULT   1

Functions

static int uintcmp (const void *a, const void *b)
 Compare removed package instances (qsort/bsearch).
static int removePackage (rpmts ts, Header h, uint32_t hdrNum, int *indexp, alKey depends)
 Add removed package instance to ordered transaction set.
static int rpmHeadersIdentical (Header first, Header second)
 Are two headers identical?
static int rpmtsAddUpgrades (rpmts ts, rpmte p, rpmuint32_t hcolor, Header h)
 Add upgrade erasures to a transaction set.
static int chkSuffix (const char *fn, const char *suffix)
 Check string for a suffix.
static int rpmtsEraseDebuginfo (rpmts ts, rpmte p, Header h, alKey pkgKey)
 Add unreferenced debuginfo erasures to a transaction set.
static int rpmtsAddObsoletes (rpmts ts, rpmte p, rpmuint32_t hcolor)
 Add Obsoletes: erasures to a 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, uint32_t hdrNum)
 Add package to be erased to transaction set.
void rpmnsClean (void)
 Clean global name space dependency sets.
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, rpmds dirnames, rpmds linktos, const char *depName, rpmuint32_t tscolor, int adding)
 Check added requires/conflicts against against installed+added packages.
static int checkPackageSet (rpmts ts, const char *depName, rpmmi mi, int adding)
 Check dependency against installed packages.
static int checkDependentPackages (rpmts ts, const char *depName)
 Check to-be-erased dependencies against installed requires.
static int checkDependentConflicts (rpmts ts, const char *depName)
 Check to-be-added dependencies against installed conflicts.
int _rpmtsCheck (rpmts ts)

Variables

int _cacheDependsRC = 1
const char * rpmNAME = PACKAGE
const char * rpmEVR = VERSION
int rpmFLAGS = RPMSENSE_EQUAL
static rpmTag _upgrade_tag
static rpmTag _debuginfo_tag
static rpmTag _obsolete_tag
static char * sysinfo_path = NULL
static rpmds rpmlibP = NULL
rpmds cpuinfoP = NULL
static rpmds getconfP = NULL
static rpmds unameP = NULL
int(* rpmtsCheck )(rpmts ts) = _rpmtsCheck
 Perform dependency resolution on the transaction set.

Detailed Description

Definition in file depends.c.


Define Documentation

#define _RPMDB_INTERNAL

Definition at line 16 of file depends.c.

#define _RPMEVR_INTERNAL

Definition at line 19 of file depends.c.

#define _RPMTE_INTERNAL

Definition at line 23 of file depends.c.

#define _RPMTS_INTERNAL

Definition at line 25 of file depends.c.

#define CACHE_DEPENDENCY_RESULT   1

Definition at line 35 of file depends.c.


Function Documentation

int _rpmtsCheck ( rpmts  ts)
static int checkDependentConflicts ( rpmts  ts,
const char *  depName 
) [static]

Check to-be-added dependencies against installed conflicts.

Parameters:
tstransaction set
depNameconflicts name
Returns:
0 no problems found

Definition at line 1855 of file depends.c.

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

Referenced by _rpmtsCheck().

static int checkDependentPackages ( rpmts  ts,
const char *  depName 
) [static]

Check to-be-erased dependencies against installed requires.

Parameters:
tstransaction set
depNamerequires name
Returns:
0 no problems found

Definition at line 1834 of file depends.c.

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

Referenced by _rpmtsCheck().

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

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

Parameters:
tstransaction set
pkgNEVRApackage name-version-release.arch
requiresRequires: dependencies (or NULL)
conflictsConflicts: dependencies (or NULL)
dirnamesDirnames: dependencies (or NULL)
linktosFilelinktos: dependencies (or NULL)
depNamedependency name to filter (or NULL)
tscolorcolor bits for transaction set (0 disables)
addingdependency is from added package set?
Returns:
0 = deps ok, 1 = dep problems, 2 = error

Definition at line 1554 of file depends.c.

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

Referenced by _rpmtsCheck(), and checkPackageSet().

static int checkPackageSet ( rpmts  ts,
const char *  depName,
rpmmi  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:
tstransaction set
depNamedependency name
mirpm database iterator
addingdependency is from added package set?
Returns:
0 no problems found

Definition at line 1761 of file depends.c.

References _free(), _rpmds_nopromote, alloca(), checkPackageDeps(), headerGet(), _HE_s::p, RPMDEPS_FLAG_NOCONFLICTS, RPMDEPS_FLAG_NOLINKTOS, RPMDEPS_FLAG_NOPARENTDIRS, RPMDEPS_FLAG_NOREQUIRES, rpmdsFree(), rpmdsNew(), rpmdsSetNoPromote(), rpmmiFree(), rpmmiNext(), rpmmiPrune(), rpmtsColor(), rpmtsDFlags(), rpmDataType_u::str, and _HE_s::tag.

Referenced by checkDependentConflicts(), and checkDependentPackages().

static int chkSuffix ( const char *  fn,
const char *  suffix 
) [inline, static]

Check string for a suffix.

Parameters:
fnstring
suffixsuffix
Returns:
1 if string ends with suffix

Definition at line 310 of file depends.c.

Referenced by mtreeCWalk(), mtreeVWalk(), rpmtsAddInstallElement(), and rpmtsEraseDebuginfo().

static int removePackage ( rpmts  ts,
Header  h,
uint32_t  hdrNum,
int *  indexp,
alKey  depends 
) [static]

Add removed package instance to ordered transaction set.

Parameters:
tstransaction set
hheader
hdrNumrpm database instance
Return values:
*indexpremoved element index (if not NULL)
Parameters:
dependsinstalled package of pair (or RPMAL_NOMATCH on erase)
Returns:
0 on success

Definition at line 74 of file depends.c.

References rpmfiFC(), rpmteFI(), rpmteNew(), TR_REMOVED, uintcmp(), and xrealloc().

Referenced by rpmtsAddEraseElement(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), and rpmtsEraseDebuginfo().

static int rpmHeadersIdentical ( Header  first,
Header  second 
) [static]

Are two headers identical?

Parameters:
firstfirst header
secondsecond header
Returns:
1 if headers are identical, 0 otherwise

Definition at line 145 of file depends.c.

References _free(), alloca(), headerGet(), _HE_s::p, rpmdsCompare(), rpmdsFree(), rpmdsThis(), RPMSENSE_EQUAL, RPMTAG_HDRID, rpmDataType_u::str, and _HE_s::tag.

Referenced by rpmtsAddUpgrades(), and rpmtsEraseDebuginfo().

void rpmnsClean ( void  )

Clean global name space dependency sets.

Definition at line 842 of file depends.c.

References _free(), _sysinfo_path, and rpmdsFree().

Referenced by rpmcliFini().

static int rpmtsAddObsoletes ( rpmts  ts,
rpmte  p,
rpmuint32_t  hcolor 
) [static]

Add Obsoletes: erasures to a transaction set.

Parameters:
tstransaction set
ptransaction element
hcolorheader color
Returns:
0 on success

Definition at line 414 of file depends.c.

References _free(), _obsolete_tag, _rpmds_nopromote, D_, hGetColor(), removePackage(), rpmdsAnyMatchesDep(), rpmdsColor(), rpmdsDNEVR(), rpmdsEVR(), rpmdsFree(), rpmdsInit(), rpmdsLink(), rpmdsN(), rpmdsNext(), rpmExpand(), rpmlog(), RPMLOG_DEBUG, rpmmiFree(), rpmmiInstance(), rpmmiNext(), rpmmiPrune(), rpmteAddedKey(), rpmteChain(), rpmteDS(), rpmteN(), rpmteNEVRA(), rpmtsColor(), and rpmtsInitIterator().

Referenced by rpmtsAddInstallElement().

static int rpmtsAddUpgrades ( rpmts  ts,
rpmte  p,
rpmuint32_t  hcolor,
Header  h 
) [static]

Add upgrade erasures to a transaction set.

Parameters:
tstransaction set
ptransaction element
hcolorheader color
hheader
Returns:
0 on success

Definition at line 197 of file depends.c.

References _free(), _upgrade_tag, alloca(), _HE_s::c, D_, headerGet(), hGetColor(), _HE_s::p, rpmDataType_u::ptr, removePackage(), rpmExpand(), rpmHeadersIdentical(), rpmlog(), RPMLOG_DEBUG, rpmmiFree(), rpmmiInstance(), rpmmiNext(), rpmteAddedKey(), rpmteChain(), rpmteN(), rpmteNEVRA(), rpmtsColor(), rpmtsInitIterator(), rpmDataType_u::str, _HE_s::tag, and rpmDataType_u::ui32p.

Referenced by rpmtsAddInstallElement().

static int rpmtsEraseDebuginfo ( rpmts  ts,
rpmte  p,
Header  h,
alKey  pkgKey 
) [static]

Add unreferenced debuginfo erasures to a transaction set.

Parameters:
tstransaction set
ptransaction element
hheader
pkgKeyadded package key (erasure uses RPMAL_NOKEY)
Returns:
no. of references from build set

Definition at line 326 of file depends.c.

References _debuginfo_tag, _free(), alloca(), chkSuffix(), D_, headerFree(), headerGet(), headerLink(), _HE_s::p, removePackage(), RPMAL_NOMATCH, rpmExpand(), rpmHeadersIdentical(), rpmlog(), RPMLOG_DEBUG, rpmmiFree(), rpmmiInstance(), rpmmiNext(), rpmmiPrune(), rpmteChain(), rpmteNEVRA(), rpmteSourcerpm(), rpmtsInitIterator(), rpmDataType_u::str, and _HE_s::tag.

Referenced by rpmtsAddEraseElement(), and rpmtsAddInstallElement().

static int uintcmp ( const void *  a,
const void *  b 
) [static]

Compare removed package instances (qsort/bsearch).

Parameters:
a1st instance address
b2nd instance address
Returns:
result of comparison

Definition at line 56 of file depends.c.

Referenced by removePackage().

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

Check dep for an unsatisfied dependency.

Parameters:
tstransaction set
depdependency
addingdependency is from added package set?
Returns:
0 if satisfied, 1 if not satisfied, 2 if error

Definition at line 867 of file depends.c.

References _, _cacheDependsRC, _free(), _rpmds_nopromote, alloca(), argvAdd(), argvFree(), argvSplit(), __db_dbt::data, DB_SET, DB_WRITECURSOR, dbiOpen(), errno, Fclose(), Ferror(), Fopen(), Fread(), gidToGname(), gnameToGid(), headerIsEntry(), PGPHASHALGO_ERROR, PGPHASHALGO_MD5, pgpHashAlgoStringToNumber(), rpmQVKArguments_s::qva_flags, rpmQVKArguments_s::qva_mode, R_OK, rpmalMakeIndex(), rpmalSatisfiesDepend(), RPMDBI_DEPENDS, RPMDBI_PACKAGES, RPMDEPS_FLAG_NOSUGGEST, RPMDIGEST_NONE, rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), rpmdsAnyMatchesDep(), rpmdsCpuinfo(), rpmdsDNEVR(), rpmdsELF(), rpmdsEVR(), rpmdsFlags(), rpmdsFree(), rpmdsFreePRCO(), rpmdsFromPRCO(), rpmdsGetconf(), rpmdsMergePRCO(), rpmdsN(), rpmdsNegateRC(), rpmdsNewPRCO(), rpmdsNotify(), rpmdsNSType(), rpmdsRpmlib(), rpmdsSearch(), rpmdsSingle(), rpmdsTagN(), rpmdsUname(), rpmExpand(), rpmExpandNumeric(), rpmGetPath(), rpmioAccess(), rpmmiFree(), rpmmiNext(), rpmmiPrune(), RPMNS_TYPE_ACCESS, RPMNS_TYPE_CPUINFO, RPMNS_TYPE_DIGEST, RPMNS_TYPE_DISKSPACE, RPMNS_TYPE_ENVVAR, RPMNS_TYPE_FUNCTION, RPMNS_TYPE_GETCONF, RPMNS_TYPE_GNUPG, RPMNS_TYPE_GROUP, RPMNS_TYPE_MACRO, RPMNS_TYPE_MOUNTED, RPMNS_TYPE_RPMLIB, RPMNS_TYPE_RUNNING, RPMNS_TYPE_SANITY, RPMNS_TYPE_SIGNATURE, RPMNS_TYPE_SONAME, RPMNS_TYPE_UNAME, RPMNS_TYPE_USER, RPMNS_TYPE_VCHECK, RPMNS_TYPE_VERIFY, rpmnsProbeSignature(), RPMRC_OK, RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, RPMSENSE_NOTEQUAL, RPMSENSE_SENSEMASK, rpmtsDFlags(), rpmtsGetRdb(), rpmtsInitDSI(), rpmtsInitIterator(), rpmtsPRCO(), showVerifyPackage(), __db_dbt::size, SYSCONFIGDIR, uidToUname(), unameToUid(), VERIFY_ALL, VERIFY_DEPS, VERIFY_SCRIPT, X_OK, xisdigit(), and xstrdup().

Referenced by checkPackageDeps().


Variable Documentation

int _cacheDependsRC = 1

Definition at line 38 of file depends.c.

Referenced by _rpmtsCheck(), and unsatisfiedDepend().

Definition at line 185 of file depends.c.

Referenced by rpmtsEraseDebuginfo().

Definition at line 187 of file depends.c.

Referenced by rpmtsAddObsoletes().

rpmTag _upgrade_tag [static]

Definition at line 183 of file depends.c.

Referenced by rpmtsAddUpgrades().

rpmds cpuinfoP = NULL

Definition at line 836 of file depends.c.

Referenced by rpmShowRC().

rpmds getconfP = NULL [static]

Definition at line 838 of file depends.c.

const char* rpmEVR = VERSION

Definition at line 45 of file depends.c.

Referenced by printVersion().

int rpmFLAGS = RPMSENSE_EQUAL

Definition at line 48 of file depends.c.

rpmds rpmlibP = NULL [static]

Definition at line 834 of file depends.c.

const char* rpmNAME = PACKAGE

Definition at line 42 of file depends.c.

char* sysinfo_path = NULL [static]

Definition at line 831 of file depends.c.

rpmds unameP = NULL [static]

Definition at line 840 of file depends.c.