rpm  5.4.15
Data Structures | Macros | Enumerations | Functions | Variables
rpmds.c File Reference
#include "system.h"
#include <rpmiotypes.h>
#include <rpmio_internal.h>
#include <rpmcb.h>
#include <rpmmacro.h>
#include <argv.h>
#include <set.h>
#include <rpmtypes.h>
#include <rpmtag.h>
#include <rpmds.h>
#include "debug.h"
Include dependency graph for rpmds.c:

Go to the source code of this file.

Data Structures

struct  cpuinfo_s
 
struct  rpmlibProvides_s
 
struct  _conf_s
 

Macros

#define DT_GNU_HASH   0x6ffffef5
 
#define _RPMIOB_INTERNAL
 
#define _RPMDS_INTERNAL
 
#define _RPMEVR_INTERNAL
 
#define _RPMPRCO_INTERNAL
 
#define _isspace(_c)   ((_c) == ' ' || (_c) == '\t' || (_c) == '\r' || (_c) == '\n')
 
#define _PROC_CPUINFO   "/proc/cpuinfo"
 
#define _ETC_RPM_SYSINFO   SYSCONFIGDIR "/sysinfo"
 
#define _GETCONF_PATH   "/"
 
#define _SBIN_LDCONFIG_P   "/sbin/ldconfig -p"
 
#define _LD_SO_CACHE   "/etc/ld.so.cache"
 
#define _PERL_PROVIDES   "/usr/bin/find /usr/lib/perl5 | /usr/lib/rpm/perl.prov"
 

Enumerations

enum  _conf_e { SYSCONF, CONFSTR, PATHCONF }
 

Functions

static const char * rpmdsTagName (rpmTag tagN)
 Return dependency set type string. More...
 
const char * rpmdsType (const rpmds ds)
 Return current dependency type name. More...
 
static void rpmdsFini (void *_ds)
 
static rpmds rpmdsGetPool (rpmioPool pool)
 
static const char ** rpmdsDupArgv (const char **argv, int argc)
 
rpmds rpmdsNew (Header h, rpmTag tagN, int flags)
 Create and load a dependency set. More...
 
const char * rpmdsNewN (rpmds ds)
 Return N string, expanded if necessary. More...
 
char * rpmdsNewDNEVR (const char *dspfx, rpmds ds)
 Return new formatted dependency string. More...
 
rpmds rpmdsThis (Header h, rpmTag tagN, evrFlags Flags)
 Create, load and initialize a dependency for this header. More...
 
rpmds rpmdsSingle (rpmTag tagN, const char *N, const char *EVR, evrFlags Flags)
 Create, load and initialize a dependency set of size 1. More...
 
int rpmdsCount (const rpmds ds)
 Return dependency set count. More...
 
int rpmdsIx (const rpmds ds)
 Return dependency set index. More...
 
int rpmdsSetIx (rpmds ds, int ix)
 Set dependency set index. More...
 
const char * rpmdsDNEVR (const rpmds ds)
 Return current formatted dependency string. More...
 
const char * rpmdsN (const rpmds ds)
 Return current dependency name. More...
 
const char * rpmdsEVR (const rpmds ds)
 Return current dependency epoch-version-release. More...
 
evrFlags rpmdsFlags (const rpmds ds)
 Return current dependency flags. More...
 
rpmTag rpmdsTagN (const rpmds ds)
 Return current dependency type. More...
 
const char * rpmdsA (const rpmds ds)
 Return current dependency arch. More...
 
time_t rpmdsBT (const rpmds ds)
 Return dependency build time. More...
 
time_t rpmdsSetBT (const rpmds ds, time_t BT)
 Set dependency build time. More...
 
nsType rpmdsNSType (const rpmds ds)
 Return dependency class type. More...
 
int rpmdsNoPromote (const rpmds ds)
 Return current "Don't promote Epoch:" flag. More...
 
int rpmdsSetNoPromote (rpmds ds, int nopromote)
 Set "Don't promote Epoch:" flag. More...
 
void * rpmdsSetEVRparse (rpmds ds, int(*EVRparse)(const char *evrstr, EVR_t evr))
 
void * rpmdsSetEVRcmp (rpmds ds, int(*EVRcmp)(const char *a, const char *b))
 Set EVR comparison function. More...
 
rpmuint32_t rpmdsColor (const rpmds ds)
 Return current dependency color. More...
 
rpmuint32_t rpmdsSetColor (const rpmds ds, rpmuint32_t color)
 Set current dependency color. More...
 
void * rpmdsExclude (const rpmds ds)
 Return dependency exclude patterns. More...
 
int rpmdsNExclude (const rpmds ds)
 Return no. More...
 
void * rpmdsInclude (const rpmds ds)
 Return dependency include patterns. More...
 
int rpmdsNInclude (const rpmds ds)
 Return no. More...
 
rpmuint32_t rpmdsRefs (const rpmds ds)
 Return current dependency file refs. More...
 
rpmuint32_t rpmdsSetRefs (const rpmds ds, rpmuint32_t refs)
 Set current dependency file refs. More...
 
rpmint32_t rpmdsResult (const rpmds ds)
 Return current dependency comparison result. More...
 
rpmint32_t rpmdsSetResult (const rpmds ds, rpmint32_t result)
 Set current dependency comparison result. More...
 
void rpmdsNotify (rpmds ds, const char *where, int rc)
 Notify of results of dependency match. More...
 
int rpmdsNext (rpmds ds)
 Return next dependency set iterator index. More...
 
rpmds rpmdsInit (rpmds ds)
 Initialize dependency set iterator. More...
 
static rpmds rpmdsDup (const rpmds ods)
 
int rpmdsFind (rpmds ds, const rpmds ods)
 Find a dependency set element using binary search. More...
 
int rpmdsMerge (rpmds *dsp, rpmds ods)
 Merge a dependency set maintaining (N,EVR,Flags) sorted order. More...
 
int rpmdsSearch (rpmds ds, rpmds ods)
 Search a sorted dependency set for an element that overlaps. More...
 
static void rpmdsNSAdd (rpmds *dsp, const char *NS, const char *N, const char *EVR, evrFlags Flags)
 Merge a single provides, wrapping N as "NS(N)". More...
 
static int rpmdsCpuinfoCtagFlags (const char *name)
 Return dependency format to use for a cpuinfo line. More...
 
int rpmdsCpuinfo (rpmds *dsp, const char *fn)
 Load /proc/cpuinfo provides into a dependency set. More...
 
int rpmdsRpmlib (rpmds *dsp, void *tblp)
 Load rpmlib provides into a dependency set. More...
 
static int rpmdsSysinfoFile (rpmPRCO PRCO, const char *fn, rpmTag tagN)
 Merge contents of a sysinfo tag file into sysinfo dependencies. More...
 
int rpmdsSysinfo (rpmPRCO PRCO, const char *fn)
 Load sysinfo dependencies into a dependency set. More...
 
int rpmdsGetconf (rpmds *dsp, const char *path)
 Load getconf provides into a dependency set. More...
 
int rpmdsMergePRCO (void *context, rpmds ds)
 Merge provides/requires/conflicts/obsoletes dependencies. More...
 
rpmPRCO rpmdsFreePRCO (rpmPRCO PRCO)
 Free dependency set(s) container. More...
 
rpmPRCO rpmdsNewPRCO (Header h)
 Create dependency set(s) container. More...
 
rpmds rpmdsFromPRCO (rpmPRCO PRCO, rpmTag tagN)
 Retrieve a dependency set from container. More...
 
int rpmdsELF (const char *fn, int flags, int(*add)(void *context, rpmds ds), void *context)
 Return a soname dependency constructed from an elf string. More...
 
int rpmdsLdconfig (rpmPRCO PRCO, const char *fn)
 Load /etc/ld.so.cache provides into a dependency set. More...
 
int rpmdsUname (rpmds *dsp, const struct utsname *un)
 
int rpmdsPipe (rpmds *dsp, rpmTag tagN, const char *cmd)
 Load provides from a pipe into a dependency set. More...
 
static int rpmdsNAcmp (rpmds A, rpmds B)
 
static const char * rpmdsEVRorder (void)
 Return precedence permutation string. More...
 
int rpmdsCompare (const rpmds A, const rpmds B)
 Compare two versioned dependency ranges, looking for overlap. More...
 
int rpmdsMatch (const rpmds A, rpmds B)
 Compare A against every member of B, looking for 1st match. More...
 
void rpmdsProblem (rpmps ps, const char *pkgNEVR, const rpmds ds, const fnpyKey *suggestedKeys, int adding)
 Report a Requires: or Conflicts: dependency problem. More...
 
int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
 Compare package provides dependencies from header with a single dependency. More...
 
int rpmdsNVRMatchesDep (const Header h, const rpmds req, int nopromote)
 Compare package name-version-release from header with a single dependency. More...
 
int rpmdsNegateRC (const rpmds ds, int rc)
 Negate return code for negated comparisons. More...
 

Variables

static int _noisy_range_comparison_debug_message = 0
 Enable noisy range comparison debugging message? More...
 
int _rpmds_debug = 0
 
int _rpmds_nopromote = 1
 
int _rpmds_unspecified_epoch_noise = 0
 
rpmioPool _rpmdsPool
 
static struct cpuinfo_s ctags []
 
const char * _cpuinfo_path = NULL
 
static struct rpmlibProvides_s rpmlibProvides []
 
const char * _sysinfo_path = NULL
 
static const char * _sysinfo_tags []
 
static const struct _conf_s vars []
 
static const char * _getconf_path = NULL
 
static const char * _ldconfig_cmd = "/sbin/ldconfig -p"
 
static const char * _ldconfig_cache = NULL
 
static const char * _perldeps_cmd = NULL
 
const char * evr_tuple_order = NULL
 

Macro Definition Documentation

#define _ETC_RPM_SYSINFO   SYSCONFIGDIR "/sysinfo"

Definition at line 1737 of file rpmds.c.

Referenced by rpmdsSysinfo().

#define _GETCONF_PATH   "/"

Definition at line 2711 of file rpmds.c.

Referenced by rpmdsGetconf().

#define _isspace (   _c)    ((_c) == ' ' || (_c) == '\t' || (_c) == '\r' || (_c) == '\n')

Definition at line 113 of file rpmds.c.

Referenced by rpmdsCpuinfo(), rpmdsLdconfig(), rpmdsPipe(), and rpmdsSysinfoFile().

#define _LD_SO_CACHE   "/etc/ld.so.cache"

Definition at line 3506 of file rpmds.c.

Referenced by rpmdsLdconfig().

#define _PERL_PROVIDES   "/usr/bin/find /usr/lib/perl5 | /usr/lib/rpm/perl.prov"

Definition at line 3854 of file rpmds.c.

Referenced by rpmdsPipe().

#define _PROC_CPUINFO   "/proc/cpuinfo"

Definition at line 1310 of file rpmds.c.

Referenced by rpmdsCpuinfo().

#define _RPMDS_INTERNAL

Definition at line 96 of file rpmds.c.

#define _RPMEVR_INTERNAL

Definition at line 97 of file rpmds.c.

#define _RPMIOB_INTERNAL

Definition at line 85 of file rpmds.c.

#define _RPMPRCO_INTERNAL

Definition at line 98 of file rpmds.c.

#define _SBIN_LDCONFIG_P   "/sbin/ldconfig -p"

Definition at line 3502 of file rpmds.c.

Referenced by rpmdsLdconfig().

#define DT_GNU_HASH   0x6ffffef5

Definition at line 82 of file rpmds.c.

Referenced by rpmdsELF().

Enumeration Type Documentation

enum _conf_e
Enumerator
SYSCONF 
CONFSTR 
PATHCONF 

Definition at line 1814 of file rpmds.c.

Function Documentation

const char* rpmdsA ( const rpmds  ds)

Return current dependency arch.

Parameters
dsdependency set
Returns
current dependency arch, NULL on invalid

Definition at line 711 of file rpmds.c.

int rpmdsAnyMatchesDep ( const Header  h,
const rpmds  req,
int  nopromote 
)

Compare package provides dependencies from header with a single dependency.

Parameters
hheader
reqdependency set
nopromoteDon't promote Epoch: in comparison?
Returns
1 if any dependency overlaps, 0 otherwise

Definition at line 4228 of file rpmds.c.

References rpmdsCompare(), rpmdsFlags(), rpmdsFree(), rpmdsInit(), rpmdsNew(), rpmdsNext(), rpmdsSetNoPromote(), RPMNS_TYPE_ARCH, RPMSENSE_SENSEMASK, and RPMTAG_PROVIDENAME.

Referenced by rpmtsAddObsoletes(), rpmtsSolve(), and unsatisfiedDepend().

time_t rpmdsBT ( const rpmds  ds)

Return dependency build time.

Parameters
dsdependency set
Returns
dependency build time, 0 on invalid

Definition at line 720 of file rpmds.c.

Referenced by rpmds_BT(), rpmds_BT_get(), and rpmds_BT_set().

rpmuint32_t rpmdsColor ( const rpmds  ds)

Return current dependency color.

Parameters
dsdependency set
Returns
current dependency color (0 if not set)

Definition at line 789 of file rpmds.c.

Referenced by checkPackageDeps(), rpmalAddProvides(), rpmds_Color(), rpmds_Color_get(), rpmds_Color_set(), and rpmtsAddObsoletes().

int rpmdsCompare ( const rpmds  A,
const rpmds  B 
)

Compare two versioned dependency ranges, looking for overlap.

Parameters
A1st dependency
B2nd dependency
Returns
1 if dependencies overlap, 0 otherwise

Definition at line 4044 of file rpmds.c.

References _, _free(), alloca(), b, D_, rpmdsEVRorder(), rpmdsFlags(), rpmdsNAcmp(), rpmEVRparse(), rpmlog(), RPMLOG_DEBUG, RPMLOG_WARNING, RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, RPMSENSE_NOTEQUAL, RPMSENSE_SENSEMASK, rpmsetCmp(), rpmvercmp, and xstrdup().

Referenced by cacheStashLatest(), rpmalAllSatisfiesDepend(), rpmds_richcompare(), rpmdsAnyMatchesDep(), rpmdsMatch(), rpmdsNVRMatchesDep(), rpmdsSearch(), rpmHeadersIdentical(), and rpmtsAddInstallElement().

int rpmdsCount ( const rpmds  ds)

Return dependency set count.

Parameters
dsdependency set
Returns
current count

Definition at line 636 of file rpmds.c.

Referenced by main(), rpmalMakeIndex(), rpmds_Count(), rpmds_Count_get(), rpmds_length(), rpmfcGenerateDepends(), rpmfcPrint(), and rpmteColorDS().

int rpmdsCpuinfo ( rpmds dsp,
const char *  fn 
)

Load /proc/cpuinfo provides into a dependency set.

Return values
*dsp(loaded) depedency set
Parameters
fnpath to file (NULL uses /proc/cpuinfo)
Returns
0 on success

Definition at line 1316 of file rpmds.c.

References _cpuinfo_path, _free(), _isspace, _PROC_CPUINFO, cpuinfo_s::done, i, cpuinfo_s::name, rpmdsCpuinfoCtagFlags(), rpmdsNSAdd(), rpmExpand(), rpmiobFree(), rpmiobSlurp(), RPMSENSE_EQUAL, and xstrdup().

Referenced by main(), rpmds_Cpuinfo(), rpmShowRC(), and unsatisfiedDepend().

static int rpmdsCpuinfoCtagFlags ( const char *  name)
static

Return dependency format to use for a cpuinfo line.

Parameters
namefield name
Returns
type of format (0 == ignore, -1 == not found)

Definition at line 1291 of file rpmds.c.

References cpuinfo_s::done, flags, cpuinfo_s::flags, and cpuinfo_s::name.

Referenced by rpmdsCpuinfo().

const char* rpmdsDNEVR ( const rpmds  ds)

Return current formatted dependency string.

Parameters
dsdependency set
Returns
current dependency DNEVR, NULL on invalid

Definition at line 657 of file rpmds.c.

Referenced by missingokTag(), printDeps(), removeSillyDeps(), rpmdepPrint(), rpmds_DNEVR(), rpmds_DNEVR_get(), rpmds_print(), rpmds_subscript(), rpmdsPrint(), rpmdsPrintResults(), rpmdsProblem(), rpmfcPrint(), rpmfiBuildFDeps(), rpmShowRC(), rpmts_SolveCallback(), rpmtsAddInstallElement(), rpmtsAddObsoletes(), and unsatisfiedDepend().

static rpmds rpmdsDup ( const rpmds  ods)
static

Definition at line 954 of file rpmds.c.

References headerLink(), rpmdsDupArgv(), rpmdsGetPool(), rpmdsLink(), and xmalloc.

Referenced by rpmdsMerge().

static const char** rpmdsDupArgv ( const char **  argv,
int  argc 
)
static

Definition at line 210 of file rpmds.c.

References stpcpy(), and xmalloc.

Referenced by rpmdsDup(), rpmdsMerge(), and rpmdsNew().

int rpmdsELF ( const char *  fn,
int  flags,
int(*)(void *context, rpmds ds)  add,
void *  context 
)

Return a soname dependency constructed from an elf string.

Extract ELF dependencies from a file.

Return values
tsoname dependency
Parameters
self string (NULL uses "")
isElf64is this an ELF64 symbol?
isX32is this an X32 symbol?

Definition at line 2952 of file rpmds.c.

References _free(), data, DT_GNU_HASH, i, memchr(), name, rpmdsFree(), rpmdsSingle(), RPMELF_FLAG_SKIPPROVIDES, RPMELF_FLAG_SKIPREQUIRES, rpmExpandNumeric(), RPMSENSE_EQUAL, RPMTAG_PROVIDENAME, RPMTAG_PROVIDES, RPMTAG_REQUIRENAME, stpcpy(), and xstrdup().

Referenced by main(), rpmdsLdconfig(), rpmfcELF(), and unsatisfiedDepend().

const char* rpmdsEVR ( const rpmds  ds)

Return current dependency epoch-version-release.

Parameters
dsdependency set
Returns
current dependency EVR, NULL on invalid

Definition at line 680 of file rpmds.c.

Referenced by _rpmtsCheck(), rpmds_compare(), rpmds_EVR(), rpmds_EVR_get(), rpmds_iternext(), rpmdsProblem(), rpmfcFileDep(), rpmfcGenerateDepends(), rpmfcHelper(), rpmtsAddObsoletes(), rpmtsSolve(), runImmedTriggers(), and unsatisfiedDepend().

static const char* rpmdsEVRorder ( void  )
static

Return precedence permutation string.

Returns
precedence permutation

Definition at line 4024 of file rpmds.c.

References _free(), evr_tuple_order, rpmExpand(), and xstrdup().

Referenced by rpmdsCompare().

void* rpmdsExclude ( const rpmds  ds)

Return dependency exclude patterns.

Parameters
dsdependency set
Returns
dependency exclude patterns (NULL if not set)

Definition at line 819 of file rpmds.c.

int rpmdsFind ( rpmds  ds,
const rpmds  ods 
)

Find a dependency set element using binary search.

Parameters
dsdependency set to search
odsdependency set element to find.
Returns
dependency index (or -1 if not found)

Definition at line 998 of file rpmds.c.

Referenced by rpmds_Find(), rpmdsMerge(), and rpmfcApply().

static void rpmdsFini ( void *  _ds)
static

Definition at line 167 of file rpmds.c.

References _free(), headerFree(), and mireFreeAll().

Referenced by rpmdsGetPool().

evrFlags rpmdsFlags ( const rpmds  ds)

Return current dependency flags.

Parameters
dsdependency set
Returns
current dependency flags, 0 on invalid

Definition at line 691 of file rpmds.c.

Referenced by _rpmtsOrder(), handleOneTrigger(), missingokTag(), orgrpmAddRelation(), printDeps(), rpmds_Flags(), rpmds_Flags_get(), rpmds_iternext(), rpmdsAnyMatchesDep(), rpmdsCompare(), rpmdsNVRMatchesDep(), rpmfcFileDep(), rpmfcHelper(), rpmtsSolve(), runImmedTriggers(), unsatisfiedDepend(), and zapRelation().

rpmPRCO rpmdsFreePRCO ( rpmPRCO  PRCO)

Free dependency set(s) container.

Parameters
PRCOdependency set(s) container
Returns
NULL

Definition at line 2851 of file rpmds.c.

References _free(), and rpmdsFree().

Referenced by main(), rpmds_Ldconfig(), rpmds_Sysinfo(), rpmShowRC(), rpmteCleanDS(), rpmtsFini(), and unsatisfiedDepend().

rpmds rpmdsFromPRCO ( rpmPRCO  PRCO,
rpmTag  tagN 
)

Retrieve a dependency set from container.

Parameters
PRCOdependency set(s) container
tagNtype of dependency set
Returns
dependency set (or NULL)

Definition at line 2901 of file rpmds.c.

References RPMTAG_CONFLICTNAME, RPMTAG_DIRNAMES, RPMTAG_FILELINKTOS, RPMTAG_NAME, RPMTAG_OBSOLETENAME, RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, and RPMTAG_TRIGGERNAME.

Referenced by _orgrpmtsOrder(), _rpmtsCheck(), _rpmtsOrder(), main(), rpmds_Ldconfig(), rpmds_Sysinfo(), rpmShowRC(), rpmteDS(), and unsatisfiedDepend().

int rpmdsGetconf ( rpmds dsp,
const char *  path 
)

Load getconf provides into a dependency set.

Return values
*dsp(loaded) depedency set
Parameters
pathgetconf path (NULL uses /)
Returns
0 on success

Definition at line 2716 of file rpmds.c.

References _free(), _GETCONF_PATH, _getconf_path, _conf_s::call, _conf_s::call_name, CONFSTR, errno, EXIT_FAILURE, _conf_s::name, PATHCONF, rpmdsNSAdd(), rpmExpand(), RPMSENSE_EQUAL, SYSCONF, xmalloc, and xstrdup().

Referenced by main(), rpmds_Getconf(), rpmShowRC(), and unsatisfiedDepend().

static rpmds rpmdsGetPool ( rpmioPool  pool)
static

Definition at line 193 of file rpmds.c.

References _rpmdsPool, rpmdsFini(), rpmioGetPool(), and rpmioNewPool().

Referenced by rpmdsDup(), rpmdsNew(), rpmdsSingle(), and rpmdsThis().

void* rpmdsInclude ( const rpmds  ds)

Return dependency include patterns.

Parameters
dsdependency set
Returns
dependency include patterns (NULL if not set)

Definition at line 829 of file rpmds.c.

rpmds rpmdsInit ( rpmds  ds)
int rpmdsIx ( const rpmds  ds)

Return dependency set index.

Parameters
dsdependency set
Returns
current index

Definition at line 641 of file rpmds.c.

Referenced by addRelation(), rpmalAddProvides(), rpmalAllSatisfiesDepend(), rpmdepPrint(), rpmds_Find(), rpmds_Ix(), rpmds_Ix_get(), rpmds_Ix_set(), rpmdsPrint(), rpmdsPrintResults(), and rpmdsSearch().

int rpmdsLdconfig ( rpmPRCO  PRCO,
const char *  fn 
)

Load /etc/ld.so.cache provides into a dependency set.

Todo:
Add dependency colors, and attach to file.
Return values
*PRCOprovides/requires/conflicts/obsoletes depedency set(s)
Parameters
fncache file name (NULL uses /etc/ld.so.cache)
Returns
0 on success

Definition at line 3510 of file rpmds.c.

References _free(), _isspace, _LD_SO_CACHE, _ldconfig_cache, _SBIN_LDCONFIG_P, rpmdsELF(), rpmdsFree(), rpmdsMerge(), rpmdsMergePRCO(), rpmdsSingle(), rpmExpand(), RPMTAG_PROVIDENAME, and xstrdup().

Referenced by main(), and rpmds_Ldconfig().

int rpmdsMatch ( const rpmds  A,
rpmds  B 
)

Compare A against every member of B, looking for 1st match.

Parameters
A1st dependency
B2nd dependency
Returns
1 if some dependency overlaps, 0 otherwise

Definition at line 4188 of file rpmds.c.

References rpmdsCompare(), rpmdsInit(), and rpmdsNext().

Referenced by handleOneTrigger(), and removeSillyDeps().

int rpmdsMerge ( rpmds dsp,
rpmds  ods 
)

Merge a dependency set maintaining (N,EVR,Flags) sorted order.

Return values
*dsp(merged) dependency set
Parameters
odsdependency set to merge
Returns
0 on success

Definition at line 1030 of file rpmds.c.

References _free(), j, rpmdsDup(), rpmdsDupArgv(), rpmdsFind(), rpmdsInit(), rpmdsNext(), and xmalloc.

Referenced by rpmds_Merge(), rpmds_Sort(), rpmdsLdconfig(), rpmdsMergePRCO(), rpmdsNSAdd(), rpmdsPipe(), rpmdsRpmlib(), rpmfcGenerateDepends(), rpmfcHelper(), rpmfcMergePR(), and rpmfcSCRIPT().

int rpmdsMergePRCO ( void *  context,
rpmds  ds 
)

Merge provides/requires/conflicts/obsoletes dependencies.

Parameters
contextmerge dependency set(s) container
dsdependency set to merge
Returns
0 on success

Definition at line 2814 of file rpmds.c.

References rpmdsMerge(), rpmdsTagN(), rpmdsTagName(), RPMTAG_CONFLICTNAME, RPMTAG_DIRNAMES, RPMTAG_FILELINKTOS, RPMTAG_OBSOLETENAME, RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, and RPMTAG_TRIGGERNAME.

Referenced by main(), rpmdsLdconfig(), rpmdsSysinfoFile(), and unsatisfiedDepend().

const char* rpmdsN ( rpmds  ds)
static int rpmdsNAcmp ( rpmds  A,
rpmds  B 
)
static

Definition at line 3991 of file rpmds.c.

Referenced by rpmdsCompare().

int rpmdsNegateRC ( const rpmds  ds,
int  rc 
)

Negate return code for negated comparisons.

Parameters
dsdependency set
rcpositive return code
Returns
return code

Definition at line 4361 of file rpmds.c.

Referenced by _rpmtsCheck(), handleOneTrigger(), and unsatisfiedDepend().

rpmds rpmdsNew ( Header  h,
rpmTag  tagN,
int  flags 
)
char* rpmdsNewDNEVR ( const char *  dspfx,
rpmds  ds 
)

Return new formatted dependency string.

Parameters
dspfxformatted dependency string prefix
dsdependency set
Returns
new formatted dependency (malloc'ed)

Definition at line 434 of file rpmds.c.

References _rpmns_N_at_A, rpmdsNewN(), RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, RPMSENSE_NOTEQUAL, RPMSENSE_SENSEMASK, stpcpy(), and xmalloc.

Referenced by rpmdsNext(), rpmdsSingle(), rpmdsThis(), and zapRelation().

const char* rpmdsNewN ( rpmds  ds)

Return N string, expanded if necessary.

Parameters
dsdependency set
Returns
new N string (malloc'ed)

Definition at line 421 of file rpmds.c.

References ns, and rpmnsParse().

Referenced by rpmdsN(), and rpmdsNewDNEVR().

rpmPRCO rpmdsNewPRCO ( Header  h)

Create dependency set(s) container.

Parameters
hheader
Returns
0 on success

Definition at line 2876 of file rpmds.c.

References rpmdsNew(), RPMTAG_CONFLICTNAME, RPMTAG_DIRNAMES, RPMTAG_FILELINKTOS, RPMTAG_NAME, RPMTAG_OBSOLETENAME, RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, RPMTAG_TRIGGERNAME, and xcalloc().

Referenced by addTE(), main(), rpmds_Ldconfig(), rpmds_Sysinfo(), rpmShowRC(), rpmtsPRCO(), and unsatisfiedDepend().

int rpmdsNExclude ( const rpmds  ds)

Return no.

of dependency exclude patterns.

Parameters
dsdependency set
Returns
dependency exclude patterns (0 if not set)

Definition at line 824 of file rpmds.c.

int rpmdsNext ( rpmds  ds)
int rpmdsNInclude ( const rpmds  ds)

Return no.

of dependency include patterns.

Parameters
dsdependency set
Returns
dependency include patterns (0 if not set)

Definition at line 834 of file rpmds.c.

int rpmdsNoPromote ( const rpmds  ds)

Return current "Don't promote Epoch:" flag.

This flag controls for Epoch: promotion when a dependency set is compared. If the flag is set (for already installed packages), then an unspecified value will be treated as Epoch: 0. Otherwise (for added packages), the Epoch: portion of the comparison is skipped if the value is not specified, i.e. an unspecified Epoch: is assumed to be equal in dependency comparisons.

Parameters
dsdependency set
Returns
current "Don't promote Epoch:" flag

Definition at line 746 of file rpmds.c.

Referenced by rpmds_NoPromote_get(), and rpmds_NoPromote_set().

void rpmdsNotify ( rpmds  ds,
const char *  where,
int  rc 
)

Notify of results of dependency match.

Parameters
dsdependency set
wherewhere dependency was resolved (or NULL)
rc0 == YES, otherwise NO

Definition at line 899 of file rpmds.c.

References _, rpmdsTagName(), rpmlog(), and RPMLOG_DEBUG.

Referenced by rpmalAllFileSatisfiesDepend(), rpmalAllSatisfiesDepend(), rpmds_Notify(), and unsatisfiedDepend().

static void rpmdsNSAdd ( rpmds dsp,
const char *  NS,
const char *  N,
const char *  EVR,
evrFlags  Flags 
)
static

Merge a single provides, wrapping N as "NS(N)".

Return values
*dsp(loaded) dependency set
Parameters
NSdependency name space
Nname
EVRepoch:version-release
Flagscomparison/context flags

Definition at line 1176 of file rpmds.c.

References alloca(), rpmdsFree(), rpmdsMerge(), rpmdsSingle(), RPMTAG_PROVIDENAME, and stpcpy().

Referenced by rpmdsCpuinfo(), rpmdsGetconf(), and rpmdsUname().

nsType rpmdsNSType ( const rpmds  ds)

Return dependency class type.

Parameters
dsdependency set
Returns
dependency class type

Definition at line 738 of file rpmds.c.

References RPMNS_TYPE_UNKNOWN.

Referenced by _rpmtsCheck(), addRelation(), checkPackageDeps(), orgrpmAddRelation(), and unsatisfiedDepend().

int rpmdsNVRMatchesDep ( const Header  h,
const rpmds  req,
int  nopromote 
)

Compare package name-version-release from header with a single dependency.

Parameters
hheader
reqdependency set
nopromoteDon't promote Epoch: in comparison?
Returns
1 if dependency overlaps, 0 otherwise

Definition at line 4281 of file rpmds.c.

References _free(), alloca(), headerGet(), headerNEVRA(), _HE_s::p, rpmDataType_u::ptr, rpmdsCompare(), rpmdsFlags(), rpmdsFree(), rpmdsSetNoPromote(), rpmdsSingle(), RPMSENSE_EQUAL, RPMSENSE_SENSEMASK, RPMTAG_DISTEPOCH, RPMTAG_EPOCH, RPMTAG_PROVIDENAME, stpcpy(), rpmDataType_u::str, _HE_s::tag, rpmDataType_u::ui32p, and xstrdup().

Referenced by ensureOlder().

int rpmdsPipe ( rpmds dsp,
rpmTag  tagN,
const char *  cmd 
)

Load provides from a pipe into a dependency set.

Return values
*dsp(loaded) depedency set
Parameters
tagNrpmds tag (0 uses RPMTAG_PROVIDENAME).
cmdpopen cmd to run (NULL loads perl provides)
Returns
0 on success

Definition at line 3858 of file rpmds.c.

References _, _free(), _isspace, _PERL_PROVIDES, _perldeps_cmd, rpmdsFree(), rpmdsMerge(), rpmdsSingle(), rpmEVRflags(), rpmExpand(), RPMTAG_PROVIDENAME, xisalnum(), and xstrdup().

Referenced by main().

void rpmdsProblem ( rpmps  ps,
const char *  pkgNEVR,
const rpmds  ds,
const fnpyKey suggestedKeys,
int  adding 
)

Report a Requires: or Conflicts: dependency problem.

Parameters
pstransaction set problems
pkgNEVRpackage name/epoch/version/release
dsdependency set
suggestedKeysfilename or python object address
addingdependency problem is from added package set?

Definition at line 4200 of file rpmds.c.

References D_, key, rpmdsDNEVR(), rpmdsEVR(), rpmdsN(), rpmlog(), RPMLOG_DEBUG, RPMPROB_CONFLICT, RPMPROB_REQUIRES, rpmpsAppend(), and type.

Referenced by checkPackageDeps().

rpmuint32_t rpmdsRefs ( const rpmds  ds)

Return current dependency file refs.

Parameters
dsdependency set
Returns
current dependency file refs (0 if not set)

Definition at line 839 of file rpmds.c.

Referenced by rpmds_Refs().

rpmint32_t rpmdsResult ( const rpmds  ds)

Return current dependency comparison result.

Parameters
dsdependency set
Returns
current dependency result (0 if not set)

Definition at line 869 of file rpmds.c.

Referenced by rpmds_Result(), and rpmdsPrintResults().

int rpmdsRpmlib ( rpmds dsp,
void *  tblp 
)

Load rpmlib provides into a dependency set.

Return values
*dsp(loaded) depedency set
Parameters
tblprpmlib provides table (NULL uses internal table)
Returns
0 on success

Definition at line 1587 of file rpmds.c.

References rpmlibProvides_s::featureEVR, rpmlibProvides_s::featureFlags, rpmlibProvides_s::featureName, rpmdsFree(), rpmdsMerge(), rpmdsSingle(), rpmlibProvides, and RPMTAG_PROVIDENAME.

Referenced by main(), rpmds_new(), rpmds_Rpmlib(), rpmShowRC(), and unsatisfiedDepend().

int rpmdsSearch ( rpmds  ds,
rpmds  ods 
)

Search a sorted dependency set for an element that overlaps.

A boolean result is saved (if allocated) and accessible through rpmdsResult(ods) afterwards.

Parameters
dsdependency set to search
odsdependency set element to find.
Returns
dependency index (or -1 if not found)

Definition at line 1108 of file rpmds.c.

References i, rpmdsCompare(), rpmdsIx(), rpmdsNext(), rpmdsSetIx(), and rpmdsSetResult().

Referenced by rpmds_Search(), rpmdsPrintClosure(), rpmfcHelper(), and unsatisfiedDepend().

time_t rpmdsSetBT ( const rpmds  ds,
time_t  BT 
)

Set dependency build time.

Parameters
dsdependency set
BTbuild time
Returns
dependency build time, 0 on invalid

Definition at line 728 of file rpmds.c.

Referenced by rpmds_BT_set().

rpmuint32_t rpmdsSetColor ( const rpmds  ds,
rpmuint32_t  color 
)

Set current dependency color.

Parameters
dsdependency set
colornew dependency color
Returns
previous dependency color

Definition at line 800 of file rpmds.c.

References xcalloc().

Referenced by rpmds_Color_set(), and rpmteColorDS().

void* rpmdsSetEVRcmp ( rpmds  ds,
int(*)(const char *a, const char *b EVRcmp 
)

Set EVR comparison function.

Parameters
dsdependency set
EVRcmpEVR comparison function (NULL uses default)
Returns
previous EVR comparison function

Definition at line 778 of file rpmds.c.

void* rpmdsSetEVRparse ( rpmds  ds,
int(*)(const char *evrstr, EVR_t evr)  EVRparse 
)

Definition at line 766 of file rpmds.c.

int rpmdsSetIx ( rpmds  ds,
int  ix 
)

Set dependency set index.

Parameters
dsdependency set
ixnew index
Returns
current index

Definition at line 646 of file rpmds.c.

References i.

Referenced by rpmalAllSatisfiesDepend(), rpmds_Find(), rpmds_Ix_set(), rpmds_subscript(), rpmdsSearch(), rpmfcHelper(), rpmfcPrint(), rpmfiBuildFDeps(), and zapRelation().

int rpmdsSetNoPromote ( rpmds  ds,
int  nopromote 
)

Set "Don't promote Epoch:" flag.

Parameters
dsdependency set
nopromoteShould an unspecified Epoch: be treated as Epoch: 0?
Returns
previous "Don't promote Epoch:" flag

Definition at line 755 of file rpmds.c.

Referenced by checkPackageSet(), handleOneTrigger(), rpmds_NoPromote_set(), rpmds_SetNoPromote(), rpmdsAnyMatchesDep(), and rpmdsNVRMatchesDep().

rpmuint32_t rpmdsSetRefs ( const rpmds  ds,
rpmuint32_t  refs 
)

Set current dependency file refs.

Parameters
dsdependency set
refsnew dependency refs
Returns
previous dependency refs

Definition at line 850 of file rpmds.c.

References xcalloc().

Referenced by rpmteColorDS().

rpmint32_t rpmdsSetResult ( const rpmds  ds,
rpmint32_t  result 
)

Set current dependency comparison result.

Parameters
dsdependency set
resultnew dependency result
Returns
previous dependency result

Definition at line 880 of file rpmds.c.

References xcalloc().

Referenced by rpmdsPrintClosure(), and rpmdsSearch().

rpmds rpmdsSingle ( rpmTag  tagN,
const char *  N,
const char *  EVR,
evrFlags  Flags 
)

Create, load and initialize a dependency set of size 1.

Parameters
tagNtype of dependency
Nname
EVRepoch:version-release
Flagscomparison/context flags
Returns
new dependency set

Definition at line 609 of file rpmds.c.

References rpmdsGetPool(), rpmdsLink(), rpmdsNewDNEVR(), rpmdsTagName(), time, xcalloc(), and xmalloc.

Referenced by ensureOlder(), removeSillyDeps(), rpmds_iternext(), rpmds_Single(), rpmdsELF(), rpmdsLdconfig(), rpmdsNSAdd(), rpmdsNVRMatchesDep(), rpmdsPipe(), rpmdsRpmlib(), rpmdsSysinfoFile(), rpmfcApply(), rpmfcGenerateDepends(), rpmfcHelper(), rpmfcSCRIPT(), and unsatisfiedDepend().

int rpmdsSysinfo ( rpmPRCO  PRCO,
const char *  fn 
)

Load sysinfo dependencies into a dependency set.

Return values
*PRCOprovides/requires/conflicts/obsoletes depedency set(s)
Parameters
fnpath to file (NULL uses /etc/rpm/sysinfo)
Returns
0 on success

Definition at line 1756 of file rpmds.c.

References _ETC_RPM_SYSINFO, _free(), _sysinfo_path, alloca(), rpmdsSysinfoFile(), rpmExpand(), rpmGetPath(), RPMTAG_PROVIDENAME, Stat(), tagValue(), and xstrdup().

Referenced by main(), rpmds_Sysinfo(), rpmShowRC(), and rpmtsPRCO().

static int rpmdsSysinfoFile ( rpmPRCO  PRCO,
const char *  fn,
rpmTag  tagN 
)
static

Merge contents of a sysinfo tag file into sysinfo dependencies.

Return values
*PRCOprovides/requires/conflicts/obsoletes depedency set(s)
Parameters
fnpath to file
tagNdependency set tag
Returns
0 on success

Definition at line 1613 of file rpmds.c.

References _, _isspace, Fclose(), fdGetFILE, Ferror(), Fopen(), rpmdsFree(), rpmdsMergePRCO(), rpmdsSingle(), rpmEVRflags(), RPMTAG_DIRNAMES, RPMTAG_FILELINKTOS, RPMTAG_PROVIDENAME, and xisalnum().

Referenced by rpmdsSysinfo().

rpmTag rpmdsTagN ( const rpmds  ds)

Return current dependency type.

Parameters
dsdependency set
Returns
current dependency type, 0 on invalid

Definition at line 702 of file rpmds.c.

Referenced by addRelation(), rpmds_iternext(), rpmds_TagN(), rpmdsMergePRCO(), rpmdsType(), rpmfcFileDep(), rpmfcMergePR(), rpmtsSolve(), and unsatisfiedDepend().

static const char* rpmdsTagName ( rpmTag  tagN)
static

Return dependency set type string.

Parameters
tagNdependency set tag
Returns
dependency set type string

Definition at line 139 of file rpmds.c.

References RPMTAG_BASENAMES, RPMTAG_CONFLICTNAME, RPMTAG_DIRNAMES, RPMTAG_ENHANCESNAME, RPMTAG_FILELINKTOS, RPMTAG_OBSOLETENAME, RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, RPMTAG_SUGGESTSNAME, RPMTAG_TRIGGERNAME, and tagName().

Referenced by rpmdsMergePRCO(), rpmdsNew(), rpmdsNotify(), rpmdsSingle(), rpmdsThis(), and rpmdsType().

rpmds rpmdsThis ( Header  h,
rpmTag  tagN,
evrFlags  Flags 
)

Create, load and initialize a dependency for this header.

Parameters
hheader
tagNtype of dependency
Flagscomparison flags
Returns
new dependency set

Definition at line 513 of file rpmds.c.

References _free(), alloca(), headerGet(), headerNEVRA(), _HE_s::p, rpmDataType_u::ptr, rpmdsGetPool(), rpmdsLink(), rpmdsNewDNEVR(), rpmdsTagName(), RPMTAG_ARCH, RPMTAG_BUILDTIME, RPMTAG_DISTEPOCH, RPMTAG_EPOCH, RPMTAG_NAME, RPMTAG_PROVIDENAME, stpcpy(), rpmDataType_u::str, _HE_s::tag, rpmDataType_u::ui32p, xmalloc, and xstrdup().

Referenced by cacheStashLatest(), hdr_dsOfHeader(), parseSpec(), rpmdsNew(), rpmHeadersIdentical(), and rpmtsAddInstallElement().

const char* rpmdsType ( const rpmds  ds)

Return current dependency type name.

Parameters
dsdependency set
Returns
current dependency type name

Definition at line 162 of file rpmds.c.

References rpmdsTagN(), and rpmdsTagName().

Referenced by rpmdepPrint(), rpmds_Type_get(), rpmdsPrint(), and rpmdsPrintResults().

int rpmdsUname ( rpmds dsp,
const struct utsname *  un 
)

Definition at line 3814 of file rpmds.c.

References rpmdsNSAdd(), and RPMSENSE_EQUAL.

Referenced by main(), rpmds_Uname(), rpmShowRC(), and unsatisfiedDepend().

Variable Documentation

const char* _cpuinfo_path = NULL

Definition at line 1314 of file rpmds.c.

Referenced by rpmdsCpuinfo().

const char* _getconf_path = NULL
static

Definition at line 2713 of file rpmds.c.

Referenced by rpmdsGetconf().

const char* _ldconfig_cache = NULL
static

Definition at line 3508 of file rpmds.c.

Referenced by rpmdsLdconfig().

const char* _ldconfig_cmd = "/sbin/ldconfig -p"
static

Definition at line 3504 of file rpmds.c.

int _noisy_range_comparison_debug_message = 0
static

Enable noisy range comparison debugging message?

Definition at line 120 of file rpmds.c.

const char* _perldeps_cmd = NULL
static

Definition at line 3856 of file rpmds.c.

Referenced by rpmdsPipe().

int _rpmds_debug = 0

Definition at line 123 of file rpmds.c.

Referenced by rpmds_alloc(), rpmds_Debug(), rpmds_free(), rpmds_init(), and rpmds_new().

int _rpmds_nopromote = 1
int _rpmds_unspecified_epoch_noise = 0

Definition at line 130 of file rpmds.c.

Referenced by showVerifyPackage().

rpmioPool _rpmdsPool

Definition at line 191 of file rpmds.c.

Referenced by rpmdsGetPool().

const char* _sysinfo_path = NULL

Definition at line 1741 of file rpmds.c.

Referenced by rpmdsSysinfo(), rpmnsClean(), and rpmShowRC().

const char* _sysinfo_tags[]
static
Initial value:
= {
"Providename",
"Requirename",
"Conflictname",
"Obsoletename",
"Dirnames",
"Filelinktos",
NULL
}

Definition at line 1745 of file rpmds.c.

struct cpuinfo_s ctags[]
static

Definition at line 1248 of file rpmds.c.

const char* evr_tuple_order = NULL

Definition at line 4017 of file rpmds.c.

Referenced by rpmcliFini(), and rpmdsEVRorder().

struct rpmlibProvides_s rpmlibProvides[]
static

Definition at line 1452 of file rpmds.c.

Referenced by rpmdsRpmlib().

const struct _conf_s vars[]
static

Definition at line 1823 of file rpmds.c.