#include "system.h"
#include <rpmio.h>
#include <rpmcli.h>
#include <rpmmacro.h>
#include <envvar.h>
#include <ugid.h>
#include "rpmdb.h"
#include "rpmds.h"
#include "rpmfi.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 |
#define | _RPMEVR_INTERNAL |
#define | isAuto(_x) (1) |
Typedefs | |
typedef struct orderListIndex_s * | orderListIndex |
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, int *indexp, alKey depends) |
Add removed package instance to ordered transaction set. | |
static int | rpmHeadersIdentical (Header first, Header second) |
Are two headers identical? | |
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. | |
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, uint32_t tscolor, int adding) |
Check added requires/conflicts against against installed+added packages. | |
static int | checkPackageSet (rpmts ts, const char *depName, rpmdbMatchIterator 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. | |
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 * | identifyDepend (uint32_t f) |
static const char * | zapRelation (rpmte q, rpmte p, 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, uint32_t 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) |
Perform dependency resolution on the transaction set. | |
Variables | |
const char * | rpmNAME = PACKAGE |
const char * | rpmEVR = VERSION |
int | rpmFLAGS = RPMSENSE_EQUAL |
static rpmTag | _upgrade_tag |
static rpmTag | _obsolete_tag |
static char * | sysinfo_path = NULL |
static rpmds | rpmlibP = NULL |
static rpmds | cpuinfoP = NULL |
static rpmds | getconfP = NULL |
static rpmds | unameP = NULL |
static int | badDepsInitialized = 0 |
static struct badDeps_s * | badDeps = NULL |
static uint32_t | _autobits = 0xffffffff |
Definition in file depends.c.
#define isAuto | ( | _x | ) | (1) |
Definition at line 1932 of file depends.c.
Referenced by rpmtsOrder().
typedef struct orderListIndex_s* orderListIndex |
Add element to list sorting by tsi_qcnt.
p | new element |
*qp | first element | |
*rp | last element |
prefcolor | preferred color |
Definition at line 1875 of file depends.c.
References rpmteColor(), rpmteTSI(), rpmteType(), and TR_REMOVED.
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").
ts | transaction set | |
p | predecessor (i.e. package that "Requires: q") | |
selected | boolean package selected array | |
requires | relation |
Definition at line 1752 of file depends.c.
References ignoreDep(), RPMAL_NOMATCH, rpmalSatisfiesDepend(), rpmdsIx(), rpmdsN(), rpmdsNSType(), rpmdsTagN(), RPMNS_TYPE_ACCESS, RPMNS_TYPE_CPUINFO, RPMNS_TYPE_DIGEST, RPMNS_TYPE_DISKSPACE, RPMNS_TYPE_ENVVAR, 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, rpmteAddedKey(), rpmteDepth(), rpmteSetDepth(), rpmteTSI(), rpmteType(), rpmtsiFree, rpmtsiInit, rpmtsiNext(), TR_ADDED, TR_REMOVED, and xcalloc().
Referenced by rpmtsOrder().
static int checkDependentConflicts | ( | rpmts | ts, | |
const char * | depName | |||
) | [static] |
Check to-be-added dependencies against installed conflicts.
ts | transaction set | |
depName | conflicts name |
Definition at line 1503 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.
ts | transaction set | |
depName | requires name |
Definition at line 1482 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, | |||
uint32_t | tscolor, | |||
int | adding | |||
) | [static] |
Check added requires/conflicts against against installed+added packages.
ts | transaction set | |
pkgNEVRA | package name-version-release.arch | |
requires | Requires: dependencies (or NULL) | |
conflicts | Conflicts: dependencies (or NULL) | |
dirnames | Dirnames: dependencies (or NULL) | |
linktos | Filelinktos: 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? |
Definition at line 1223 of file depends.c.
References rpmalAllSatisfiesDepend(), rpmdsColor(), rpmdsInit(), rpmdsN(), rpmdsNext(), rpmdsProblem(), rpmpsFree(), rpmtsProblems(), and unsatisfiedDepend().
Referenced by checkPackageSet(), and rpmtsCheck().
static int checkPackageSet | ( | rpmts | ts, | |
const char * | depName, | |||
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.
ts | transaction set | |
depName | dependency name | |
mi | rpm database iterator | |
adding | dependency is from added package set? |
Definition at line 1413 of file depends.c.
References _free(), _rpmds_nopromote, alloca(), checkPackageDeps(), headerGet(), _HE_s::p, rpmdbFreeIterator(), rpmdbNextIterator(), rpmdbPruneIterator(), RPMDEPS_FLAG_NOCONFLICTS, RPMDEPS_FLAG_NOLINKTOS, RPMDEPS_FLAG_NOPARENTDIRS, RPMDEPS_FLAG_NOREQUIRES, rpmdsFree(), rpmdsNew(), rpmdsSetNoPromote(), rpmtsColor(), rpmtsDFlags(), rpmDataType_u::str, and _HE_s::tag.
Referenced by checkDependentConflicts(), and checkDependentPackages().
static void freeBadDeps | ( | void | ) | [static] |
Definition at line 1544 of file depends.c.
References _free(), badDepsInitialized, badDeps_s::pname, and badDeps_s::qname.
Referenced by rpmtsOrder().
static const char* identifyDepend | ( | uint32_t | f | ) | [inline, static] |
Definition at line 1651 of file depends.c.
Referenced by zapRelation().
Check for dependency relations to be ignored.
ts | transaction set | |
p | successor element (i.e. with Requires: ) | |
q | predecessor element (i.e. with Provides: ) |
Definition at line 1566 of file depends.c.
References _, _free(), badDepsInitialized, badDeps_s::pname, badDeps_s::qname, RPMDEPS_FLAG_ANACONDA, RPMDEPS_FLAG_DEPLOOPS, rpmExpand(), rpmlog(), RPMLOG_DEBUG, RPMLOG_WARNING, rpmteN(), rpmtsDFlags(), xcalloc(), and xstrdup().
Referenced by addRelation().
static int intcmp | ( | const void * | a, | |
const void * | b | |||
) | [static] |
Compare removed package instances (qsort/bsearch).
a | 1st instance address | |
b | 2nd instance address |
Definition at line 69 of file depends.c.
Referenced by removePackage().
Recursively mark all nodes with their predecessors.
tsi | successor chain | |
q | predecessor |
Definition at line 1627 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).
one | 1st ordered list entry | |
two | 2nd ordered list entry |
Definition at line 1858 of file depends.c.
Referenced by rpmtsOrder().
Add removed package instance to ordered transaction set.
ts | transaction set | |
h | header | |
dboffset | rpm database instance |
*indexp | removed element index (if not NULL) |
depends | installed package of pair (or RPMAL_NOMATCH on erase) |
Definition at line 87 of file depends.c.
References intcmp(), rpmteNew(), TR_REMOVED, and xrealloc().
Referenced by rpmtsAddEraseElement(), and rpmtsAddInstallElement().
Are two headers identical?
first | first header | |
second | second header |
Definition at line 146 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 rpmtsAddInstallElement().
void rpmnsClean | ( | void | ) |
Clean global name space dependency sets.
Definition at line 553 of file depends.c.
References _free(), _sysinfo_path, cpuinfoP, getconfP, rpmdsFree(), rpmlibP, sysinfo_path, and unameP.
Referenced by rpmcliFini().
Check dep for an unsatisfied dependency.
ts | transaction set | |
dep | dependency | |
adding | dependency is from added package set? |
Definition at line 572 of file depends.c.
References _, _free(), _rpmds_nopromote, alloca(), argvAdd(), argvFree(), argvSplit(), cpuinfoP, __db_dbt::data, DB_SET, DB_WRITECURSOR, dbiOpen(), errno, Fclose(), Ferror(), Fopen(), Fread(), getconfP, gidToGname(), gnameToGid(), headerIsEntry(), PGPHASHALGO_MD5, pgpHashAlgoStringToNumber(), R_OK, rpmalMakeIndex(), rpmalSatisfiesDepend(), rpmdbFreeIterator(), RPMDBI_DEPENDS, rpmdbNextIterator(), rpmdbPruneIterator(), 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(), rpmlibP, 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, rpmnsProbeSignature(), RPMRC_OK, RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, RPMSENSE_NOTEQUAL, RPMSENSE_SENSEMASK, rpmtsDFlags(), rpmtsGetRdb(), rpmtsInitDSI(), rpmtsInitIterator(), __db_dbt::size, SYSCONFIGDIR, sysinfo_path, uidToUname(), unameP, unameToUid(), X_OK, xisdigit(), and xstrdup().
Referenced by checkPackageDeps().
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).
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)? |
nzaps | address of no. of relations removed |
msglvl | message level at which to spew |
Definition at line 1686 of file depends.c.
References _, _free(), identifyDepend(), rpmdsFlags(), rpmdsNewDNEVR(), rpmdsSetIx(), rpmlog(), rpmteDS(), rpmteNEVRA(), and rpmteTSI().
Referenced by rpmtsOrder().
uint32_t _autobits = 0xffffffff [static] |
Definition at line 1931 of file depends.c.
Referenced by rpmtsOrder().
rpmTag _obsolete_tag [static] |
Definition at line 183 of file depends.c.
Referenced by rpmtsAddInstallElement().
rpmTag _upgrade_tag [static] |
Definition at line 181 of file depends.c.
Referenced by rpmtsAddInstallElement().
int badDepsInitialized = 0 [static] |
Definition at line 1535 of file depends.c.
Referenced by freeBadDeps(), and ignoreDep().
Definition at line 547 of file depends.c.
Referenced by rpmnsClean(), and unsatisfiedDepend().
Definition at line 549 of file depends.c.
Referenced by rpmnsClean(), and unsatisfiedDepend().
const char* rpmEVR = VERSION |
Definition at line 58 of file depends.c.
Referenced by printVersion().
Definition at line 545 of file depends.c.
Referenced by rpmnsClean(), and unsatisfiedDepend().
char* sysinfo_path = NULL [static] |
Definition at line 542 of file depends.c.
Referenced by rpmnsClean(), and unsatisfiedDepend().
Definition at line 551 of file depends.c.
Referenced by rpmnsClean(), and unsatisfiedDepend().