rpm  4.16.1.2
rpmds.h
Go to the documentation of this file.
1 #ifndef H_RPMDS
2 #define H_RPMDS
3 
9 #include <time.h>
10 
11 #include <rpm/rpmtypes.h>
12 #include <rpm/rpmps.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
20 extern int _rpmds_nopromote;
21 
27  RPMSENSE_LESS = (1 << 1),
28  RPMSENSE_GREATER = (1 << 2),
29  RPMSENSE_EQUAL = (1 << 3),
30  /* bit 4 unused */
31  RPMSENSE_POSTTRANS = (1 << 5),
32  RPMSENSE_PREREQ = (1 << 6), /* legacy prereq dependency */
33  RPMSENSE_PRETRANS = (1 << 7),
34  RPMSENSE_INTERP = (1 << 8),
35  RPMSENSE_SCRIPT_PRE = (1 << 9),
36  RPMSENSE_SCRIPT_POST = (1 << 10),
37  RPMSENSE_SCRIPT_PREUN = (1 << 11),
38  RPMSENSE_SCRIPT_POSTUN = (1 << 12),
39  RPMSENSE_SCRIPT_VERIFY = (1 << 13),
40  RPMSENSE_FIND_REQUIRES = (1 << 14),
41  RPMSENSE_FIND_PROVIDES = (1 << 15),
43  RPMSENSE_TRIGGERIN = (1 << 16),
44  RPMSENSE_TRIGGERUN = (1 << 17),
45  RPMSENSE_TRIGGERPOSTUN = (1 << 18),
46  RPMSENSE_MISSINGOK = (1 << 19),
47  /* bits 20-23 unused */
48  RPMSENSE_RPMLIB = (1 << 24),
49  RPMSENSE_TRIGGERPREIN = (1 << 25),
50  RPMSENSE_KEYRING = (1 << 26),
51  /* bit 27 unused */
52  RPMSENSE_CONFIG = (1 << 28),
53  RPMSENSE_META = (1 << 29),
54 };
55 
57 
58 #define RPMSENSE_SENSEMASK 15 /* Mask to get senses, ie serial, */
59  /* less, greater, equal. */
60 
61 #define RPMSENSE_TRIGGER \
62  (RPMSENSE_TRIGGERPREIN | RPMSENSE_TRIGGERIN | RPMSENSE_TRIGGERUN | RPMSENSE_TRIGGERPOSTUN)
63 
64 #define _ALL_REQUIRES_MASK (\
65  RPMSENSE_INTERP | \
66  RPMSENSE_SCRIPT_PRE | \
67  RPMSENSE_SCRIPT_POST | \
68  RPMSENSE_SCRIPT_PREUN | \
69  RPMSENSE_SCRIPT_POSTUN | \
70  RPMSENSE_SCRIPT_VERIFY | \
71  RPMSENSE_FIND_REQUIRES | \
72  RPMSENSE_RPMLIB | \
73  RPMSENSE_KEYRING | \
74  RPMSENSE_PRETRANS | \
75  RPMSENSE_POSTTRANS | \
76  RPMSENSE_PREREQ | \
77  RPMSENSE_META | \
78  RPMSENSE_MISSINGOK)
79 
80 #define _notpre(_x) ((_x) & ~RPMSENSE_PREREQ)
81 #define _INSTALL_ONLY_MASK \
82  _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS)
83 #define _ERASE_ONLY_MASK \
84  _notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
85 #define _UNORDERED_ONLY_MASK \
86  _notpre(RPMSENSE_RPMLIB|RPMSENSE_CONFIG|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS|RPMSENSE_SCRIPT_VERIFY|RPMSENSE_META)
87 #define _FORCE_ORDER_ONLY_MASK \
88  _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
89 
90 #define isLegacyPreReq(_x) (((_x) & _ALL_REQUIRES_MASK) == RPMSENSE_PREREQ)
91 #define isInstallPreReq(_x) ((_x) & _INSTALL_ONLY_MASK)
92 #define isErasePreReq(_x) ((_x) & _ERASE_ONLY_MASK)
93 #define isUnorderedReq(_x) ((_x) & _UNORDERED_ONLY_MASK && \
94  !((_x) & _FORCE_ORDER_ONLY_MASK))
95 #define isTransientReq(_x) (isInstallPreReq(_x) && \
96  !isErasePreReq(_x) && \
97  !((_x) & RPMSENSE_META))
98 
106 
113 rpmsenseFlags rpmParseDSFlags(const char *str, size_t len);
114 
121 
128 
136 rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags);
137 
144 char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds);
145 
154 
163 rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags);
164 
171 
179 
185 int rpmdsCount(const rpmds ds);
186 
192 int rpmdsIx(const rpmds ds);
193 
200 int rpmdsSetIx(rpmds ds, int ix);
201 
207 const char * rpmdsDNEVR(const rpmds ds);
208 
214 char rpmdsD(const rpmds ds);
215 
221 rpmTagVal rpmdsDToTagN(char deptype);
222 
228 const char * rpmdsN(const rpmds ds);
229 
235 const char * rpmdsEVR(const rpmds ds);
236 
242 int rpmdsTi(const rpmds ds);
243 
250 
257 
264 
271 
278 
285 unsigned int rpmdsInstance(rpmds ds);
286 
293 
300 
306 int rpmdsNoPromote(const rpmds ds);
307 
314 int rpmdsSetNoPromote(rpmds ds, int nopromote);
315 
322 
330 
336 int rpmdsNext(rpmds ds);
337 
344 
351 int rpmdsFind(rpmds ds, const rpmds ods);
352 
359 int rpmdsMerge(rpmds * dsp, rpmds ods);
360 
369 int rpmdsSearch(rpmds ds, rpmds ods);
370 
377 int rpmdsCompare(const rpmds A, const rpmds B);
378 
386 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote);
387 
396 int rpmdsMatchesDep (const Header h, int ix, const rpmds req, int nopromote);
397 
405 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote);
406 
413 int rpmdsRpmlib(rpmds * dsp, const void * tblp);
414 
423 rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags);
424 
434  Header h, rpmTagVal tagN, rpmsenseFlags Flags);
435 
446  const char * N, const char * EVR, rpmsenseFlags Flags);
447 
459  const char * N, const char * EVR,
460  rpmsenseFlags Flags, int triggerIndex);
461 
469 int rpmdsRpmlibPool(rpmstrPool pool, rpmds * dsp, const void * tblp);
470 
471 
472 typedef enum rpmrichOp_e {
480  RPMRICHOP_UNLESS = 8
482 
483 typedef enum rpmrichParseType_e {
484  RPMRICH_PARSE_SIMPLE = 1, /* standard N <=> EVR dep */
485  RPMRICH_PARSE_ENTER = 2, /* entering sub-dependency */
486  RPMRICH_PARSE_LEAVE = 3, /* leaving sub-dependency */
487  RPMRICH_PARSE_OP = 4 /* parsed a rich dependency op */
489 
490 typedef rpmRC (*rpmrichParseFunction) (void *cbdata, rpmrichParseType type,
491  const char *n, int nl, const char *e, int el, rpmsenseFlags sense,
492  rpmrichOp op, char **emsg);
493 
502 rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata);
503 
513 rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN);
514 
515 
522 
528 const char *rpmrichOpStr(rpmrichOp op);
529 
539 rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg);
540 
541 #ifdef __cplusplus
542 }
543 #endif
544 
545 #endif /* H_RPMDS */
RPMRICH_PARSE_ENTER
@ RPMRICH_PARSE_ENTER
Definition: rpmds.h:485
RPMRICH_PARSE_LEAVE
@ RPMRICH_PARSE_LEAVE
Definition: rpmds.h:486
rpmdsTagN
rpmTagVal rpmdsTagN(const rpmds ds)
Return current dependency type.
rpmdsFind
int rpmdsFind(rpmds ds, const rpmds ods)
Find a dependency set element using binary search.
rpmdsTagTi
rpmTagVal rpmdsTagTi(const rpmds ds)
Return current dependency type.
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
RPMRICHOP_AND
@ RPMRICHOP_AND
Definition: rpmds.h:474
rpmdsSetNoPromote
int rpmdsSetNoPromote(rpmds ds, int nopromote)
Obsolete, do not use.
RPMSENSE_POSTTRANS
@ RPMSENSE_POSTTRANS
Definition: rpmds.h:31
RPMSENSE_GREATER
@ RPMSENSE_GREATER
Definition: rpmds.h:28
RPMSENSE_RPMLIB
@ RPMSENSE_RPMLIB
Definition: rpmds.h:48
RPMSENSE_META
@ RPMSENSE_META
Definition: rpmds.h:53
rpmdsNewPool
rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags)
Create and load a dependency set.
rpmdsNVRMatchesDep
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
Compare package name-version-release from header with a single dependency.
RPMRICHOP_SINGLE
@ RPMRICHOP_SINGLE
Definition: rpmds.h:473
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
rpmdsMerge
int rpmdsMerge(rpmds *dsp, rpmds ods)
Merge a dependency set maintaining (N,EVR,Flags) sorted order.
rpmrichParseType_e
rpmrichParseType_e
Definition: rpmds.h:483
rpmrichOpStr
const char * rpmrichOpStr(rpmrichOp op)
Return a string representation of the rich dependency op.
rpmstrPool
struct rpmstrPool_s * rpmstrPool
Definition: rpmtypes.h:84
rpmdsParseRichDep
rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg)
Parse a rich dependency string.
RPMSENSE_PREREQ
@ RPMSENSE_PREREQ
Definition: rpmds.h:32
RPMSENSE_TRIGGERPREIN
@ RPMSENSE_TRIGGERPREIN
Definition: rpmds.h:49
rpmdsIx
int rpmdsIx(const rpmds ds)
Return dependency set index.
RPMSENSE_FIND_REQUIRES
@ RPMSENSE_FIND_REQUIRES
Definition: rpmds.h:40
rpmdsLink
rpmds rpmdsLink(rpmds ds)
Reference a dependency set instance.
RPMRICHOP_UNLESS
@ RPMRICHOP_UNLESS
Definition: rpmds.h:480
RPMSENSE_MISSINGOK
@ RPMSENSE_MISSINGOK
Definition: rpmds.h:46
rpm_color_t
uint32_t rpm_color_t
Definition: rpmtypes.h:38
_rpmds_nopromote
int _rpmds_nopromote
rpmdsTagEVR
rpmTagVal rpmdsTagEVR(const rpmds ds)
Return current dependency type.
rpmdsN
const char * rpmdsN(const rpmds ds)
Return current dependency name.
RPMSENSE_SCRIPT_PRE
@ RPMSENSE_SCRIPT_PRE
Definition: rpmds.h:35
RPMRICHOP_WITHOUT
@ RPMRICHOP_WITHOUT
Definition: rpmds.h:479
rpmdsSetIx
int rpmdsSetIx(rpmds ds, int ix)
Set dependency set index.
rpmdsIsWeak
int rpmdsIsWeak(rpmds ds)
Return whether dependency is weak.
rpmRC
enum rpmRC_e rpmRC
Package read return codes.
rpmdsSearch
int rpmdsSearch(rpmds ds, rpmds ods)
Search a sorted dependency set for an element that overlaps.
rpmrichOp
enum rpmrichOp_e rpmrichOp
rpmrichParseType
enum rpmrichParseType_e rpmrichParseType
rpmdsAnyMatchesDep
int rpmdsAnyMatchesDep(const Header h, const rpmds req, int nopromote)
Compare package provides dependencies from header with a single dependency.
rpmdsIsRich
int rpmdsIsRich(rpmds dep)
Return if current depenency is rich.
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.
rpmdsDToTagN
rpmTagVal rpmdsDToTagN(char deptype)
Return matching tagN for one char dependency type description.
rpmdsThisPool
rpmds rpmdsThisPool(rpmstrPool pool, Header h, rpmTagVal tagN, rpmsenseFlags Flags)
Create, load and initialize a dependency for this header.
RPMSENSE_TRIGGERIN
@ RPMSENSE_TRIGGERIN
Definition: rpmds.h:43
rpmdsNoPromote
int rpmdsNoPromote(const rpmds ds)
Obsolete, do not use.
rpmdsFlags
rpmsenseFlags rpmdsFlags(const rpmds ds)
Return current dependency flags.
rpmsenseFlags_e
rpmsenseFlags_e
Dependency Attributes.
Definition: rpmds.h:25
RPMSENSE_EQUAL
@ RPMSENSE_EQUAL
Definition: rpmds.h:29
RPMRICHOP_OR
@ RPMRICHOP_OR
Definition: rpmds.h:475
rpmdsFree
rpmds rpmdsFree(rpmds ds)
Destroy a dependency set.
RPMSENSE_PRETRANS
@ RPMSENSE_PRETRANS
Definition: rpmds.h:33
rpmrichParse
rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata)
Parse a rich dependency string.
RPMSENSE_SCRIPT_PREUN
@ RPMSENSE_SCRIPT_PREUN
Definition: rpmds.h:37
rpmdsThis
rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags)
Create, load and initialize a dependency for this header.
rpmdsCount
int rpmdsCount(const rpmds ds)
Return dependency set count.
rpmdsSingle
rpmds rpmdsSingle(rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags)
Create, load and initialize a dependency set of size 1.
RPMSENSE_SCRIPT_POSTUN
@ RPMSENSE_SCRIPT_POSTUN
Definition: rpmds.h:38
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.
RPMRICH_PARSE_OP
@ RPMRICH_PARSE_OP
Definition: rpmds.h:487
rpmdsRpmlib
int rpmdsRpmlib(rpmds *dsp, const void *tblp)
Load rpmlib provides into a dependency set.
RPMRICHOP_ELSE
@ RPMRICHOP_ELSE
Definition: rpmds.h:477
rpmdsCompare
int rpmdsCompare(const rpmds A, const rpmds B)
Compare two versioned dependency ranges, looking for overlap.
RPMSENSE_INTERP
@ RPMSENSE_INTERP
Definition: rpmds.h:34
rpmdsInit
rpmds rpmdsInit(rpmds ds)
Initialize dependency set iterator.
rpmds
struct rpmds_s * rpmds
Definition: rpmtypes.h:65
RPMSENSE_LESS
@ RPMSENSE_LESS
Definition: rpmds.h:27
rpmdsD
char rpmdsD(const rpmds ds)
Return one char indicating the type of the dependency.
rpmParseDSFlags
rpmsenseFlags rpmParseDSFlags(const char *str, size_t len)
Convert a string to the sense flags.
rpmdsNew
rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags)
Create and load a dependency set.
rpmdsColor
rpm_color_t rpmdsColor(const rpmds ds)
Return current dependency color.
RPMSENSE_TRIGGERUN
@ RPMSENSE_TRIGGERUN
Definition: rpmds.h:44
rpmdsInstance
unsigned int rpmdsInstance(rpmds ds)
Return dependency header instance, ie whether the dependency comes from an installed header or not.
RPMRICHOP_WITH
@ RPMRICHOP_WITH
Definition: rpmds.h:478
RPMSENSE_TRIGGERPOSTUN
@ RPMSENSE_TRIGGERPOSTUN
Definition: rpmds.h:45
rpmdsPutToHeader
int rpmdsPutToHeader(rpmds ds, Header h)
Write content of the dependency set to the header.
rpmdsEVR
const char * rpmdsEVR(const rpmds ds)
Return current dependency epoch-version-release.
rpmdsDNEVR
const char * rpmdsDNEVR(const rpmds ds)
Return current formatted dependency string.
rpmdsTagF
rpmTagVal rpmdsTagF(const rpmds ds)
Return current dependency type.
RPMRICH_PARSE_SIMPLE
@ RPMRICH_PARSE_SIMPLE
Definition: rpmds.h:484
rpmsenseFlags
rpmFlags rpmsenseFlags
Definition: rpmds.h:56
RPMSENSE_KEYRING
@ RPMSENSE_KEYRING
Definition: rpmds.h:50
RPMSENSE_SCRIPT_POST
@ RPMSENSE_SCRIPT_POST
Definition: rpmds.h:36
rpmrichParseForTag
rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN)
Parse a rich dependency string for a specific tag.
rpmdsRpmlibPool
int rpmdsRpmlibPool(rpmstrPool pool, rpmds *dsp, const void *tblp)
Load rpmlib provides into a dependency set.
rpmdsSetColor
rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color)
Return current dependency color.
rpmrichOp_e
rpmrichOp_e
Definition: rpmds.h:472
rpmSanitizeDSFlags
rpmsenseFlags rpmSanitizeDSFlags(rpmTagVal tagN, rpmsenseFlags Flags)
Return only those flags allowed for given type of dependencies.
Header
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
rpmdsIsReverse
int rpmdsIsReverse(rpmds ds)
Return whether dependency is reversed.
rpmdsNext
int rpmdsNext(rpmds ds)
Return next dependency set iterator index.
rpmdsTi
int rpmdsTi(const rpmds ds)
Return current dependency triggerindex.
rpmdsMatchesDep
int rpmdsMatchesDep(const Header h, int ix, const rpmds req, int nopromote)
Compare package provides dependencies from header with a single dependency.
RPMSENSE_CONFIG
@ RPMSENSE_CONFIG
Definition: rpmds.h:52
rpmTagVal
rpm_tag_t rpmTagVal
Definition: rpmtypes.h:30
RPMRICHOP_IF
@ RPMRICHOP_IF
Definition: rpmds.h:476
RPMSENSE_FIND_PROVIDES
@ RPMSENSE_FIND_PROVIDES
Definition: rpmds.h:41
RPMSENSE_SCRIPT_VERIFY
@ RPMSENSE_SCRIPT_VERIFY
Definition: rpmds.h:39
rpmdsCurrent
rpmds rpmdsCurrent(rpmds ds)
Return a new dependency set of size 1 from the current iteration index.
rpmdsNewDNEVR
char * rpmdsNewDNEVR(const char *dspfx, const rpmds ds)
Return new formatted dependency string.
RPMSENSE_ANY
@ RPMSENSE_ANY
Definition: rpmds.h:26