rpm 4.15.1

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
25 enum rpmsenseFlags_e {
26 RPMSENSE_ANY = 0,
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 };
54
55 typedef rpmFlags rpmsenseFlags;
56
57 #define RPMSENSE_SENSEMASK 15 /* Mask to get senses, ie serial, */
58 /* less, greater, equal. */
59
60 #define RPMSENSE_TRIGGER \
61 (RPMSENSE_TRIGGERPREIN | RPMSENSE_TRIGGERIN | RPMSENSE_TRIGGERUN | RPMSENSE_TRIGGERPOSTUN)
62
63 #define _ALL_REQUIRES_MASK (\
64 RPMSENSE_INTERP | \
65 RPMSENSE_SCRIPT_PRE | \
66 RPMSENSE_SCRIPT_POST | \
67 RPMSENSE_SCRIPT_PREUN | \
68 RPMSENSE_SCRIPT_POSTUN | \
69 RPMSENSE_SCRIPT_VERIFY | \
70 RPMSENSE_FIND_REQUIRES | \
71 RPMSENSE_RPMLIB | \
72 RPMSENSE_KEYRING | \
73 RPMSENSE_PRETRANS | \
74 RPMSENSE_POSTTRANS | \
75 RPMSENSE_PREREQ | \
76 RPMSENSE_MISSINGOK)
77
78 #define _notpre(_x) ((_x) & ~RPMSENSE_PREREQ)
79 #define _INSTALL_ONLY_MASK \
80 _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS)
81 #define _ERASE_ONLY_MASK \
82 _notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
83 #define _UNORDERED_ONLY_MASK \
84 _notpre(RPMSENSE_RPMLIB|RPMSENSE_CONFIG|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS|RPMSENSE_SCRIPT_VERIFY)
85
86 #define isLegacyPreReq(_x) (((_x) & _ALL_REQUIRES_MASK) == RPMSENSE_PREREQ)
87 #define isInstallPreReq(_x) ((_x) & _INSTALL_ONLY_MASK)
88 #define isErasePreReq(_x) ((_x) & _ERASE_ONLY_MASK)
89 #define isUnorderedReq(_x) ((_x) & _UNORDERED_ONLY_MASK)
90
91
92
99 rpmsenseFlags rpmSanitizeDSFlags(rpmTagVal tagN, rpmsenseFlags Flags);
100
107 rpmsenseFlags rpmParseDSFlags(const char *str, size_t len);
108
114 rpmds rpmdsLink(rpmds ds);
115
121 rpmds rpmdsFree(rpmds ds);
122
130 rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags);
131
138 char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds);
139
147 rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags);
148
157 rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags);
158
164 rpmds rpmdsCurrent(rpmds ds);
165
172 int rpmdsPutToHeader(rpmds ds, Header h);
173
179 int rpmdsCount(const rpmds ds);
180
186 int rpmdsIx(const rpmds ds);
187
194 int rpmdsSetIx(rpmds ds, int ix);
195
201 const char * rpmdsDNEVR(const rpmds ds);
202
208 char rpmdsD(const rpmds ds);
209
215 rpmTagVal rpmdsDToTagN(char deptype);
216
222 const char * rpmdsN(const rpmds ds);
223
229 const char * rpmdsEVR(const rpmds ds);
230
236 int rpmdsTi(const rpmds ds);
237
243 rpmsenseFlags rpmdsFlags(const rpmds ds);
244
250 rpmTagVal rpmdsTagN(const rpmds ds);
251
257 rpmTagVal rpmdsTagEVR(const rpmds ds);
258
264 rpmTagVal rpmdsTagF(const rpmds ds);
265
271 rpmTagVal rpmdsTagTi(const rpmds ds);
272
279 unsigned int rpmdsInstance(rpmds ds);
280
286 int rpmdsIsWeak(rpmds ds);
287
293 int rpmdsIsReverse(rpmds ds);
294
308 int rpmdsNoPromote(const rpmds ds);
309
316 int rpmdsSetNoPromote(rpmds ds, int nopromote);
317
323 rpm_color_t rpmdsColor(const rpmds ds);
324
331 rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color);
332
338 int rpmdsNext(rpmds ds);
339
345 rpmds rpmdsInit(rpmds ds);
346
353 int rpmdsFind(rpmds ds, const rpmds ods);
354
361 int rpmdsMerge(rpmds * dsp, rpmds ods);
362
371 int rpmdsSearch(rpmds ds, rpmds ods);
372
379 int rpmdsCompare(const rpmds A, const rpmds B);
380
388 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote);
389
398 int rpmdsMatchesDep (const Header h, int ix, const rpmds req, int nopromote);
399
407 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote);
408
415 int rpmdsRpmlib(rpmds * dsp, const void * tblp);
416
425 rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags);
426
435 rpmds rpmdsThisPool(rpmstrPool pool,
436 Header h, rpmTagVal tagN, rpmsenseFlags Flags);
437
447 rpmds rpmdsSinglePool(rpmstrPool pool, rpmTagVal tagN,
448 const char * N, const char * EVR, rpmsenseFlags Flags);
449
460 rpmds rpmdsSinglePoolTix(rpmstrPool pool, rpmTagVal tagN,
461 const char * N, const char * EVR,
462 rpmsenseFlags Flags, int triggerIndex);
463
471 int rpmdsRpmlibPool(rpmstrPool pool, rpmds * dsp, const void * tblp);
472
473
474 typedef enum rpmrichOp_e {
475 RPMRICHOP_SINGLE = 1,
476 RPMRICHOP_AND = 2,
477 RPMRICHOP_OR = 3,
478 RPMRICHOP_IF = 4,
479 RPMRICHOP_ELSE = 5,
480 RPMRICHOP_WITH = 6,
481 RPMRICHOP_WITHOUT = 7,
482 RPMRICHOP_UNLESS = 8
483 } rpmrichOp;
484
485 typedef enum rpmrichParseType_e {
486 RPMRICH_PARSE_SIMPLE = 1, /* standard N <=> EVR dep */
487 RPMRICH_PARSE_ENTER = 2, /* entering sub-dependency */
488 RPMRICH_PARSE_LEAVE = 3, /* leaving sub-dependency */
489 RPMRICH_PARSE_OP = 4 /* parsed a rich dependency op */
490 } rpmrichParseType;
491
492 typedef rpmRC (*rpmrichParseFunction) (void *cbdata, rpmrichParseType type,
493 const char *n, int nl, const char *e, int el, rpmsenseFlags sense,
494 rpmrichOp op, char **emsg);
495
504 rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata);
505
515 rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN);
516
517
523 int rpmdsIsRich(rpmds dep);
524
530 const char *rpmrichOpStr(rpmrichOp op);
531
541 rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg);
542
543 #ifdef __cplusplus
544 }
545 #endif
546
547 #endif /* H_RPMDS */
RPMRICH_PARSE_ENTER
@ RPMRICH_PARSE_ENTER
Definition: rpmds.h:487
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
RPMRICH_PARSE_LEAVE
@ RPMRICH_PARSE_LEAVE
Definition: rpmds.h:488
rpmdsTagN
rpmTagVal rpmdsTagN(const rpmds ds)
rpmdsFind
int rpmdsFind(rpmds ds, const rpmds ods)
rpmdsTagTi
rpmTagVal rpmdsTagTi(const rpmds ds)
RPMRICHOP_AND
@ RPMRICHOP_AND
Definition: rpmds.h:476
rpmdsSetNoPromote
int rpmdsSetNoPromote(rpmds ds, int nopromote)
RPMSENSE_POSTTRANS
@ RPMSENSE_POSTTRANS
Definition: rpmds.h:31
RPMSENSE_GREATER
@ RPMSENSE_GREATER
Definition: rpmds.h:28
RPMSENSE_RPMLIB
@ RPMSENSE_RPMLIB
Definition: rpmds.h:48
rpmdsNewPool
rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags)
rpmdsNVRMatchesDep
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
RPMRICHOP_SINGLE
@ RPMRICHOP_SINGLE
Definition: rpmds.h:475
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:492
rpmdsMerge
int rpmdsMerge(rpmds *dsp, rpmds ods)
rpmrichParseType_e
rpmrichParseType_e
Definition: rpmds.h:485
rpmrichOpStr
const char * rpmrichOpStr(rpmrichOp op)
Return a string representation of the rich dependency op.
rpmstrPool
struct rpmstrPool_s * rpmstrPool
Definition: rpmtypes.h:83
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)
RPMSENSE_FIND_REQUIRES
@ RPMSENSE_FIND_REQUIRES
Definition: rpmds.h:40
rpmdsLink
rpmds rpmdsLink(rpmds ds)
RPMRICHOP_UNLESS
@ RPMRICHOP_UNLESS
Definition: rpmds.h:482
RPMSENSE_MISSINGOK
@ RPMSENSE_MISSINGOK
Definition: rpmds.h:46
_rpmds_nopromote
int _rpmds_nopromote
rpmdsTagEVR
rpmTagVal rpmdsTagEVR(const rpmds ds)
rpmdsN
const char * rpmdsN(const rpmds ds)
RPMSENSE_SCRIPT_PRE
@ RPMSENSE_SCRIPT_PRE
Definition: rpmds.h:35
RPMRICHOP_WITHOUT
@ RPMRICHOP_WITHOUT
Definition: rpmds.h:481
rpmdsSetIx
int rpmdsSetIx(rpmds ds, int ix)
rpmdsIsWeak
int rpmdsIsWeak(rpmds ds)
rpmRC
enum rpmRC_e rpmRC
rpmdsSearch
int rpmdsSearch(rpmds ds, rpmds ods)
rpmrichOp
enum rpmrichOp_e rpmrichOp
rpmrichParseType
enum rpmrichParseType_e rpmrichParseType
rpmdsAnyMatchesDep
int rpmdsAnyMatchesDep(const Header h, const rpmds req, int nopromote)
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)
rpmdsDToTagN
rpmTagVal rpmdsDToTagN(char deptype)
rpmdsThisPool
rpmds rpmdsThisPool(rpmstrPool pool, Header h, rpmTagVal tagN, rpmsenseFlags Flags)
RPMSENSE_TRIGGERIN
@ RPMSENSE_TRIGGERIN
Definition: rpmds.h:43
rpmdsNoPromote
int rpmdsNoPromote(const rpmds ds)
rpmdsFlags
rpmsenseFlags rpmdsFlags(const rpmds ds)
rpmsenseFlags_e
rpmsenseFlags_e
Definition: rpmds.h:25
RPMSENSE_EQUAL
@ RPMSENSE_EQUAL
Definition: rpmds.h:29
RPMRICHOP_OR
@ RPMRICHOP_OR
Definition: rpmds.h:477
rpmdsFree
rpmds rpmdsFree(rpmds ds)
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)
rpmdsCount
int rpmdsCount(const rpmds ds)
rpmdsSingle
rpmds rpmdsSingle(rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags)
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)
RPMRICH_PARSE_OP
@ RPMRICH_PARSE_OP
Definition: rpmds.h:489
rpmdsRpmlib
int rpmdsRpmlib(rpmds *dsp, const void *tblp)
Load rpmlib provides into a dependency set.
RPMRICHOP_ELSE
@ RPMRICHOP_ELSE
Definition: rpmds.h:479
rpmdsCompare
int rpmdsCompare(const rpmds A, const rpmds B)
RPMSENSE_INTERP
@ RPMSENSE_INTERP
Definition: rpmds.h:34
rpmdsInit
rpmds rpmdsInit(rpmds ds)
rpm_color_t
uint32_t rpm_color_t
Definition: rpmtypes.h:38
RPMSENSE_LESS
@ RPMSENSE_LESS
Definition: rpmds.h:27
rpmdsD
char rpmdsD(const rpmds ds)
rpmParseDSFlags
rpmsenseFlags rpmParseDSFlags(const char *str, size_t len)
rpmdsNew
rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags)
rpmdsColor
rpm_color_t rpmdsColor(const rpmds ds)
RPMSENSE_TRIGGERUN
@ RPMSENSE_TRIGGERUN
Definition: rpmds.h:44
rpmdsInstance
unsigned int rpmdsInstance(rpmds ds)
RPMRICHOP_WITH
@ RPMRICHOP_WITH
Definition: rpmds.h:480
RPMSENSE_TRIGGERPOSTUN
@ RPMSENSE_TRIGGERPOSTUN
Definition: rpmds.h:45
rpmdsPutToHeader
int rpmdsPutToHeader(rpmds ds, Header h)
rpmdsEVR
const char * rpmdsEVR(const rpmds ds)
rpmdsDNEVR
const char * rpmdsDNEVR(const rpmds ds)
rpmdsTagF
rpmTagVal rpmdsTagF(const rpmds ds)
rpmTagVal
rpm_tag_t rpmTagVal
Definition: rpmtypes.h:30
RPMRICH_PARSE_SIMPLE
@ RPMRICH_PARSE_SIMPLE
Definition: rpmds.h:486
rpmsenseFlags
rpmFlags rpmsenseFlags
Definition: rpmds.h:55
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)
rpmrichOp_e
rpmrichOp_e
Definition: rpmds.h:474
rpmSanitizeDSFlags
rpmsenseFlags rpmSanitizeDSFlags(rpmTagVal tagN, rpmsenseFlags Flags)
Header
struct headerToken_s * Header
Definition: rpmtypes.h:24
rpmdsIsReverse
int rpmdsIsReverse(rpmds ds)
rpmdsNext
int rpmdsNext(rpmds ds)
rpmdsTi
int rpmdsTi(const rpmds ds)
rpmdsMatchesDep
int rpmdsMatchesDep(const Header h, int ix, const rpmds req, int nopromote)
RPMSENSE_CONFIG
@ RPMSENSE_CONFIG
Definition: rpmds.h:52
RPMRICHOP_IF
@ RPMRICHOP_IF
Definition: rpmds.h:478
RPMSENSE_FIND_PROVIDES
@ RPMSENSE_FIND_PROVIDES
Definition: rpmds.h:41
RPMSENSE_SCRIPT_VERIFY
@ RPMSENSE_SCRIPT_VERIFY
Definition: rpmds.h:39
rpmds
struct rpmds_s * rpmds
Definition: rpmtypes.h:65
rpmdsCurrent
rpmds rpmdsCurrent(rpmds ds)
rpmdsNewDNEVR
char * rpmdsNewDNEVR(const char *dspfx, const rpmds ds)
RPMSENSE_ANY
@ RPMSENSE_ANY
Definition: rpmds.h:26