rpmds.h
Go to the documentation of this file.
#ifndef H_RPMDS
#define H_RPMDS
#include <time.h>
#include <rpm/rpmtypes.h>
#include <rpm/rpmps.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int _rpmds_nopromote;
enum rpmsenseFlags_e {
RPMSENSE_ANY = 0,
RPMSENSE_LESS = (1 << 1),
RPMSENSE_GREATER = (1 << 2),
RPMSENSE_EQUAL = (1 << 3),
/* bit 4 unused */
RPMSENSE_POSTTRANS = (1 << 5),
RPMSENSE_PREREQ = (1 << 6), /* legacy prereq dependency */
RPMSENSE_PRETRANS = (1 << 7),
RPMSENSE_INTERP = (1 << 8),
RPMSENSE_SCRIPT_PRE = (1 << 9),
RPMSENSE_SCRIPT_POST = (1 << 10),
RPMSENSE_SCRIPT_PREUN = (1 << 11),
RPMSENSE_SCRIPT_POSTUN = (1 << 12),
RPMSENSE_SCRIPT_VERIFY = (1 << 13),
RPMSENSE_FIND_REQUIRES = (1 << 14),
RPMSENSE_FIND_PROVIDES = (1 << 15),
RPMSENSE_TRIGGERIN = (1 << 16),
RPMSENSE_TRIGGERUN = (1 << 17),
RPMSENSE_TRIGGERPOSTUN = (1 << 18),
RPMSENSE_MISSINGOK = (1 << 19),
/* bits 20-23 unused */
RPMSENSE_RPMLIB = (1 << 24),
RPMSENSE_TRIGGERPREIN = (1 << 25),
RPMSENSE_KEYRING = (1 << 26),
/* bit 27 unused */
RPMSENSE_CONFIG = (1 << 28),
RPMSENSE_META = (1 << 29),
};
typedef rpmFlags rpmsenseFlags;
#define RPMSENSE_SENSEMASK 15 /* Mask to get senses, ie serial, */
/* less, greater, equal. */
#define RPMSENSE_TRIGGER \
(RPMSENSE_TRIGGERPREIN | RPMSENSE_TRIGGERIN | RPMSENSE_TRIGGERUN | RPMSENSE_TRIGGERPOSTUN)
#define _ALL_REQUIRES_MASK (\
RPMSENSE_INTERP | \
RPMSENSE_SCRIPT_PRE | \
RPMSENSE_SCRIPT_POST | \
RPMSENSE_SCRIPT_PREUN | \
RPMSENSE_SCRIPT_POSTUN | \
RPMSENSE_SCRIPT_VERIFY | \
RPMSENSE_FIND_REQUIRES | \
RPMSENSE_RPMLIB | \
RPMSENSE_KEYRING | \
RPMSENSE_PRETRANS | \
RPMSENSE_POSTTRANS | \
RPMSENSE_PREREQ | \
RPMSENSE_META | \
RPMSENSE_MISSINGOK)
#define _notpre(_x) ((_x) & ~RPMSENSE_PREREQ)
#define _INSTALL_ONLY_MASK \
_notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS)
#define _ERASE_ONLY_MASK \
_notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
#define _UNORDERED_ONLY_MASK \
_notpre(RPMSENSE_RPMLIB|RPMSENSE_CONFIG|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS|RPMSENSE_SCRIPT_VERIFY|RPMSENSE_META)
#define _FORCE_ORDER_ONLY_MASK \
_notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
#define isLegacyPreReq(_x) (((_x) & _ALL_REQUIRES_MASK) == RPMSENSE_PREREQ)
#define isInstallPreReq(_x) ((_x) & _INSTALL_ONLY_MASK)
#define isErasePreReq(_x) ((_x) & _ERASE_ONLY_MASK)
#define isUnorderedReq(_x) ((_x) & _UNORDERED_ONLY_MASK && \
!((_x) & _FORCE_ORDER_ONLY_MASK))
#define isTransientReq(_x) (isInstallPreReq(_x) && \
!isErasePreReq(_x) && \
!((_x) & RPMSENSE_META))
rpmsenseFlags rpmSanitizeDSFlags(rpmTagVal tagN, rpmsenseFlags Flags);
rpmsenseFlags rpmParseDSFlags(const char *str, size_t len);
rpmds rpmdsLink(rpmds ds);
rpmds rpmdsFree(rpmds ds);
rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags);
char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds);
rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags);
rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags);
rpmds rpmdsCurrent(rpmds ds);
int rpmdsPutToHeader(rpmds ds, Header h);
int rpmdsCount(const rpmds ds);
int rpmdsIx(const rpmds ds);
int rpmdsSetIx(rpmds ds, int ix);
const char * rpmdsDNEVR(const rpmds ds);
char rpmdsD(const rpmds ds);
rpmTagVal rpmdsDToTagN(char deptype);
const char * rpmdsN(const rpmds ds);
const char * rpmdsEVR(const rpmds ds);
int rpmdsTi(const rpmds ds);
rpmsenseFlags rpmdsFlags(const rpmds ds);
rpmTagVal rpmdsTagN(const rpmds ds);
rpmTagVal rpmdsTagEVR(const rpmds ds);
rpmTagVal rpmdsTagF(const rpmds ds);
rpmTagVal rpmdsTagTi(const rpmds ds);
unsigned int rpmdsInstance(rpmds ds);
int rpmdsIsWeak(rpmds ds);
int rpmdsIsReverse(rpmds ds);
int rpmdsNoPromote(const rpmds ds);
int rpmdsSetNoPromote(rpmds ds, int nopromote);
rpm_color_t rpmdsColor(const rpmds ds);
rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color);
int rpmdsNext(rpmds ds);
rpmds rpmdsInit(rpmds ds);
int rpmdsFind(rpmds ds, const rpmds ods);
int rpmdsMerge(rpmds * dsp, rpmds ods);
int rpmdsSearch(rpmds ds, rpmds ods);
int rpmdsCompare(const rpmds A, const rpmds B);
int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote);
int rpmdsMatchesDep (const Header h, int ix, const rpmds req, int nopromote);
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote);
int rpmdsRpmlib(rpmds * dsp, const void * tblp);
rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags);
rpmds rpmdsThisPool(rpmstrPool pool,
Header h, rpmTagVal tagN, rpmsenseFlags Flags);
rpmds rpmdsSinglePool(rpmstrPool pool, rpmTagVal tagN,
const char * N, const char * EVR, rpmsenseFlags Flags);
rpmds rpmdsSinglePoolTix(rpmstrPool pool, rpmTagVal tagN,
const char * N, const char * EVR,
rpmsenseFlags Flags, int triggerIndex);
int rpmdsRpmlibPool(rpmstrPool pool, rpmds * dsp, const void * tblp);
typedef enum rpmrichOp_e {
RPMRICHOP_SINGLE = 1,
RPMRICHOP_AND = 2,
RPMRICHOP_OR = 3,
RPMRICHOP_IF = 4,
RPMRICHOP_ELSE = 5,
RPMRICHOP_WITH = 6,
RPMRICHOP_WITHOUT = 7,
RPMRICHOP_UNLESS = 8
} rpmrichOp;
typedef enum rpmrichParseType_e {
RPMRICH_PARSE_SIMPLE = 1, /* standard N <=> EVR dep */
RPMRICH_PARSE_ENTER = 2, /* entering sub-dependency */
RPMRICH_PARSE_LEAVE = 3, /* leaving sub-dependency */
RPMRICH_PARSE_OP = 4 /* parsed a rich dependency op */
} rpmrichParseType;
typedef rpmRC (*rpmrichParseFunction) (void *cbdata, rpmrichParseType type,
const char *n, int nl, const char *e, int el, rpmsenseFlags sense,
rpmrichOp op, char **emsg);
rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata);
rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN);
int rpmdsIsRich(rpmds dep);
const char *rpmrichOpStr(rpmrichOp op);
rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg);
#ifdef __cplusplus
}
#endif
#endif /* H_RPMDS */
rpmdsEVR
const char * rpmdsEVR(const rpmds ds)
Return current dependency epoch-version-release.
rpmdsIsWeak
int rpmdsIsWeak(rpmds ds)
Return whether dependency is weak.
rpmdsIx
int rpmdsIx(const rpmds ds)
Return dependency set index.
rpmSanitizeDSFlags
rpmsenseFlags rpmSanitizeDSFlags(rpmTagVal tagN, rpmsenseFlags Flags)
Return only those flags allowed for given type of dependencies.
rpmdsNewPool
rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags)
Create and load a dependency set.
rpmdsCurrent
rpmds rpmdsCurrent(rpmds ds)
Return a new dependency set of size 1 from the current iteration index.
rpmdsSinglePoolTix
rpmds rpmdsSinglePoolTix(rpmstrPool pool, rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags, int triggerIndex)
Create, load and initialize a trigger dependency set of size 1.
rpmdsTi
int rpmdsTi(const rpmds ds)
Return current dependency triggerindex.
rpmdsCompare
int rpmdsCompare(const rpmds A, const rpmds B)
Compare two versioned dependency ranges, looking for overlap.
rpmdsFind
int rpmdsFind(rpmds ds, const rpmds ods)
Find a dependency set element using binary search.
rpmdsInstance
unsigned int rpmdsInstance(rpmds ds)
Return dependency header instance, ie whether the dependency comes from an installed header or not.
rpmdsPutToHeader
int rpmdsPutToHeader(rpmds ds, Header h)
Write content of the dependency set to the header.
rpmdsSetColor
rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color)
Return current dependency color.
rpmdsN
const char * rpmdsN(const rpmds ds)
Return current dependency name.
rpmdsSingle
rpmds rpmdsSingle(rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags)
Create, load and initialize a dependency set of size 1.
rpmdsThis
rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags)
Create, load and initialize a dependency for this header.
rpmdsNew
rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags)
Create and load a dependency set.
rpmdsMerge
int rpmdsMerge(rpmds *dsp, rpmds ods)
Merge a dependency set maintaining (N,EVR,Flags) sorted order.
rpmdsTagF
rpmTagVal rpmdsTagF(const rpmds ds)
Return current dependency type.
rpmdsTagEVR
rpmTagVal rpmdsTagEVR(const rpmds ds)
Return current dependency type.
rpmdsD
char rpmdsD(const rpmds ds)
Return one char indicating the type of the dependency.
rpmdsThisPool
rpmds rpmdsThisPool(rpmstrPool pool, Header h, rpmTagVal tagN, rpmsenseFlags Flags)
Create, load and initialize a dependency for this header.
rpmdsFree
rpmds rpmdsFree(rpmds ds)
Destroy a dependency set.
rpmdsTagTi
rpmTagVal rpmdsTagTi(const rpmds ds)
Return current dependency type.
rpmdsSetIx
int rpmdsSetIx(rpmds ds, int ix)
Set dependency set index.
rpmdsSearch
int rpmdsSearch(rpmds ds, rpmds ods)
Search a sorted dependency set for an element that overlaps.
rpmdsIsReverse
int rpmdsIsReverse(rpmds ds)
Return whether dependency is reversed.
rpmdsCount
int rpmdsCount(const rpmds ds)
Return dependency set count.
rpmdsTagN
rpmTagVal rpmdsTagN(const rpmds ds)
Return current dependency type.
rpmdsLink
rpmds rpmdsLink(rpmds ds)
Reference a dependency set instance.
rpmdsDToTagN
rpmTagVal rpmdsDToTagN(char deptype)
Return matching tagN for one char dependency type description.
rpmdsMatchesDep
int rpmdsMatchesDep(const Header h, int ix, const rpmds req, int nopromote)
Compare package provides dependencies from header with a single dependency.
rpmdsNVRMatchesDep
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
Compare package name-version-release from header with a single dependency.
rpmParseDSFlags
rpmsenseFlags rpmParseDSFlags(const char *str, size_t len)
Convert a string to the sense flags.
rpmdsFlags
rpmsenseFlags rpmdsFlags(const rpmds ds)
Return current dependency flags.
rpmdsInit
rpmds rpmdsInit(rpmds ds)
Initialize dependency set iterator.
rpmdsNewDNEVR
char * rpmdsNewDNEVR(const char *dspfx, const rpmds ds)
Return new formatted dependency string.
rpmdsDNEVR
const char * rpmdsDNEVR(const rpmds ds)
Return current formatted dependency string.
rpmdsAnyMatchesDep
int rpmdsAnyMatchesDep(const Header h, const rpmds req, int nopromote)
Compare package provides dependencies from header with a single dependency.
rpmdsColor
rpm_color_t rpmdsColor(const rpmds ds)
Return current dependency color.
rpmdsNext
int rpmdsNext(rpmds ds)
Return next dependency set iterator index.
rpmdsNoPromote
int rpmdsNoPromote(const rpmds ds)
Obsolete, do not use.
rpmsenseFlags_e
rpmsenseFlags_e
Dependency Attributes.
Definition: rpmds.h:25
rpmdsSinglePool
rpmds rpmdsSinglePool(rpmstrPool pool, rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags)
Create, load and initialize a dependency set of size 1.
rpmdsSetNoPromote
int rpmdsSetNoPromote(rpmds ds, int nopromote)
Obsolete, do not use.
RPMSENSE_FIND_PROVIDES
@ RPMSENSE_FIND_PROVIDES
Definition: rpmds.h:41
RPMSENSE_GREATER
@ RPMSENSE_GREATER
Definition: rpmds.h:28
RPMSENSE_SCRIPT_POSTUN
@ RPMSENSE_SCRIPT_POSTUN
Definition: rpmds.h:38
RPMSENSE_TRIGGERPREIN
@ RPMSENSE_TRIGGERPREIN
Definition: rpmds.h:49
RPMSENSE_INTERP
@ RPMSENSE_INTERP
Definition: rpmds.h:34
RPMSENSE_PREREQ
@ RPMSENSE_PREREQ
Definition: rpmds.h:32
RPMSENSE_TRIGGERUN
@ RPMSENSE_TRIGGERUN
Definition: rpmds.h:44
RPMSENSE_LESS
@ RPMSENSE_LESS
Definition: rpmds.h:27
RPMSENSE_EQUAL
@ RPMSENSE_EQUAL
Definition: rpmds.h:29
RPMSENSE_ANY
@ RPMSENSE_ANY
Definition: rpmds.h:26
RPMSENSE_FIND_REQUIRES
@ RPMSENSE_FIND_REQUIRES
Definition: rpmds.h:40
RPMSENSE_MISSINGOK
@ RPMSENSE_MISSINGOK
Definition: rpmds.h:46
RPMSENSE_TRIGGERIN
@ RPMSENSE_TRIGGERIN
Definition: rpmds.h:43
RPMSENSE_TRIGGERPOSTUN
@ RPMSENSE_TRIGGERPOSTUN
Definition: rpmds.h:45
RPMSENSE_META
@ RPMSENSE_META
Definition: rpmds.h:53
RPMSENSE_SCRIPT_PRE
@ RPMSENSE_SCRIPT_PRE
Definition: rpmds.h:35
RPMSENSE_SCRIPT_VERIFY
@ RPMSENSE_SCRIPT_VERIFY
Definition: rpmds.h:39
RPMSENSE_SCRIPT_PREUN
@ RPMSENSE_SCRIPT_PREUN
Definition: rpmds.h:37
RPMSENSE_RPMLIB
@ RPMSENSE_RPMLIB
Definition: rpmds.h:48
RPMSENSE_KEYRING
@ RPMSENSE_KEYRING
Definition: rpmds.h:50
RPMSENSE_SCRIPT_POST
@ RPMSENSE_SCRIPT_POST
Definition: rpmds.h:36
RPMSENSE_POSTTRANS
@ RPMSENSE_POSTTRANS
Definition: rpmds.h:31
RPMSENSE_PRETRANS
@ RPMSENSE_PRETRANS
Definition: rpmds.h:33
RPMSENSE_CONFIG
@ RPMSENSE_CONFIG
Definition: rpmds.h:52
rpmTagVal
rpm_tag_t rpmTagVal
Definition: rpmtypes.h:30
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
rpm_color_t
uint32_t rpm_color_t
Definition: rpmtypes.h:38
rpmRC
enum rpmRC_e rpmRC
Package read return codes.
rpmds
struct rpmds_s * rpmds
Definition: rpmtypes.h:65
Header
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
rpmrichParseType_e
rpmrichParseType_e
Definition: rpmds.h:483
RPMRICH_PARSE_ENTER
@ RPMRICH_PARSE_ENTER
Definition: rpmds.h:485
RPMRICH_PARSE_OP
@ RPMRICH_PARSE_OP
Definition: rpmds.h:487
RPMRICH_PARSE_LEAVE
@ RPMRICH_PARSE_LEAVE
Definition: rpmds.h:486
RPMRICH_PARSE_SIMPLE
@ RPMRICH_PARSE_SIMPLE
Definition: rpmds.h:484
rpmrichParseType
enum rpmrichParseType_e rpmrichParseType
rpmdsRpmlib
int rpmdsRpmlib(rpmds *dsp, const void *tblp)
Load rpmlib provides into a dependency set.
rpmrichParseFunction
rpmRC(* rpmrichParseFunction)(void *cbdata, rpmrichParseType type, const char *n, int nl, const char *e, int el, rpmsenseFlags sense, rpmrichOp op, char **emsg)
Definition: rpmds.h:490
rpmdsIsRich
int rpmdsIsRich(rpmds dep)
Return if current depenency is rich.
rpmsenseFlags
rpmFlags rpmsenseFlags
Definition: rpmds.h:56
rpmdsRpmlibPool
int rpmdsRpmlibPool(rpmstrPool pool, rpmds *dsp, const void *tblp)
Load rpmlib provides into a dependency set.
rpmrichOp_e
rpmrichOp_e
Definition: rpmds.h:472
RPMRICHOP_UNLESS
@ RPMRICHOP_UNLESS
Definition: rpmds.h:480
RPMRICHOP_IF
@ RPMRICHOP_IF
Definition: rpmds.h:476
RPMRICHOP_OR
@ RPMRICHOP_OR
Definition: rpmds.h:475
RPMRICHOP_ELSE
@ RPMRICHOP_ELSE
Definition: rpmds.h:477
RPMRICHOP_WITHOUT
@ RPMRICHOP_WITHOUT
Definition: rpmds.h:479
RPMRICHOP_AND
@ RPMRICHOP_AND
Definition: rpmds.h:474
RPMRICHOP_WITH
@ RPMRICHOP_WITH
Definition: rpmds.h:478
RPMRICHOP_SINGLE
@ RPMRICHOP_SINGLE
Definition: rpmds.h:473
rpmrichOpStr
const char * rpmrichOpStr(rpmrichOp op)
Return a string representation of the rich dependency op.
rpmrichParseForTag
rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN)
Parse a rich dependency string for a specific tag.
_rpmds_nopromote
int _rpmds_nopromote
rpmrichParse
rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata)
Parse a rich dependency string.
rpmdsParseRichDep
rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg)
Parse a rich dependency string.
rpmrichOp
enum rpmrichOp_e rpmrichOp
rpmstrPool
struct rpmstrPool_s * rpmstrPool
Definition: rpmtypes.h:84