rpm 4.19.0
The RPM Package Manager
Loading...
Searching...
No Matches
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/rpmutil.h>
13#include <rpm/rpmps.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
23 RPMSENSE_ANY = 0,
24 RPMSENSE_LESS = (1 << 1),
25 RPMSENSE_GREATER = (1 << 2),
26 RPMSENSE_EQUAL = (1 << 3),
27 /* bit 4 unused */
28 RPMSENSE_POSTTRANS = (1 << 5),
29 RPMSENSE_PREREQ = (1 << 6), /* legacy prereq dependency */
30 RPMSENSE_PRETRANS = (1 << 7),
31 RPMSENSE_INTERP = (1 << 8),
40 RPMSENSE_TRIGGERIN = (1 << 16),
41 RPMSENSE_TRIGGERUN = (1 << 17),
43 RPMSENSE_MISSINGOK = (1 << 19),
44 RPMSENSE_PREUNTRANS = (1 << 20),
46 /* bits 22-23 unused */
47 RPMSENSE_RPMLIB = (1 << 24),
49 RPMSENSE_KEYRING = (1 << 26),
50 /* bit 27 unused */
51 RPMSENSE_CONFIG = (1 << 28),
52 RPMSENSE_META = (1 << 29),
53};
54
55typedef 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_PREUNTRANS | \
76 RPMSENSE_POSTUNTRANS | \
77 RPMSENSE_PREREQ | \
78 RPMSENSE_META | \
79 RPMSENSE_MISSINGOK)
80
81#define _notpre(_x) ((_x) & ~RPMSENSE_PREREQ)
82#define _INSTALL_ONLY_MASK \
83 _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS)
84#define _ERASE_ONLY_MASK \
85 _notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN|RPMSENSE_PREUNTRANS|RPMSENSE_POSTUNTRANS)
86#define _UNORDERED_ONLY_MASK \
87 _notpre(RPMSENSE_RPMLIB|RPMSENSE_CONFIG|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS|RPMSENSE_PREUNTRANS|RPMSENSE_POSTUNTRANS|RPMSENSE_SCRIPT_VERIFY|RPMSENSE_META)
88#define _FORCE_ORDER_ONLY_MASK \
89 _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
90
91#define isLegacyPreReq(_x) (((_x) & _ALL_REQUIRES_MASK) == RPMSENSE_PREREQ)
92#define isInstallPreReq(_x) ((_x) & _INSTALL_ONLY_MASK)
93#define isErasePreReq(_x) ((_x) & _ERASE_ONLY_MASK)
94#define isUnorderedReq(_x) ((_x) & _UNORDERED_ONLY_MASK && \
95 !((_x) & _FORCE_ORDER_ONLY_MASK))
96#define isTransientReq(_x) (isInstallPreReq(_x) && \
97 !isErasePreReq(_x) && \
98 !((_x) & RPMSENSE_META))
99
106rpmsenseFlags rpmSanitizeDSFlags(rpmTagVal tagN, rpmsenseFlags Flags);
107
114rpmsenseFlags rpmParseDSFlags(const char *str, size_t len);
115
121rpmds rpmdsLink(rpmds ds);
122
128rpmds rpmdsFree(rpmds ds);
129
137rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags);
138
145char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds);
146
154rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags);
155
164rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags);
165
171rpmds rpmdsCurrent(rpmds ds);
172
179int rpmdsPutToHeader(rpmds ds, Header h);
180
186int rpmdsCount(const rpmds ds);
187
193int rpmdsIx(const rpmds ds);
194
201int rpmdsSetIx(rpmds ds, int ix);
202
208const char * rpmdsDNEVR(const rpmds ds);
209
215char rpmdsD(const rpmds ds);
216
222rpmTagVal rpmdsDToTagN(char deptype);
223
229const char * rpmdsN(const rpmds ds);
230
236const char * rpmdsEVR(const rpmds ds);
237
243int rpmdsTi(const rpmds ds);
244
250rpmsenseFlags rpmdsFlags(const rpmds ds);
251
257rpmTagVal rpmdsTagN(const rpmds ds);
258
264rpmTagVal rpmdsTagEVR(const rpmds ds);
265
271rpmTagVal rpmdsTagF(const rpmds ds);
272
278rpmTagVal rpmdsTagTi(const rpmds ds);
279
286unsigned int rpmdsInstance(rpmds ds);
287
293int rpmdsIsWeak(rpmds ds);
294
300int rpmdsIsReverse(rpmds ds);
301
307rpm_color_t rpmdsColor(const rpmds ds);
308
315rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color);
316
322int rpmdsNext(rpmds ds);
323
329rpmds rpmdsInit(rpmds ds);
330
337int rpmdsFind(rpmds ds, const rpmds ods);
338
345int rpmdsMerge(rpmds * dsp, rpmds ods);
346
355int rpmdsSearch(rpmds ds, rpmds ods);
356
363int rpmdsCompare(const rpmds A, const rpmds B);
364
372int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote);
373
382int rpmdsMatchesDep (const Header h, int ix, const rpmds req, int nopromote);
383
391int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote);
392
399int rpmdsRpmlib(rpmds * dsp, const void * tblp);
400
409rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags);
410
419rpmds rpmdsThisPool(rpmstrPool pool,
420 Header h, rpmTagVal tagN, rpmsenseFlags Flags);
421
431rpmds rpmdsSinglePool(rpmstrPool pool, rpmTagVal tagN,
432 const char * N, const char * EVR, rpmsenseFlags Flags);
433
444rpmds rpmdsSinglePoolTix(rpmstrPool pool, rpmTagVal tagN,
445 const char * N, const char * EVR,
446 rpmsenseFlags Flags, int triggerIndex);
447
455int rpmdsRpmlibPool(rpmstrPool pool, rpmds * dsp, const void * tblp);
456
457
458typedef enum rpmrichOp_e {
459 RPMRICHOP_SINGLE = 1,
460 RPMRICHOP_AND = 2,
461 RPMRICHOP_OR = 3,
462 RPMRICHOP_IF = 4,
463 RPMRICHOP_ELSE = 5,
464 RPMRICHOP_WITH = 6,
465 RPMRICHOP_WITHOUT = 7,
466 RPMRICHOP_UNLESS = 8
467} rpmrichOp;
468
469typedef enum rpmrichParseType_e {
470 RPMRICH_PARSE_SIMPLE = 1, /* standard N <=> EVR dep */
471 RPMRICH_PARSE_ENTER = 2, /* entering sub-dependency */
472 RPMRICH_PARSE_LEAVE = 3, /* leaving sub-dependency */
473 RPMRICH_PARSE_OP = 4 /* parsed a rich dependency op */
474} rpmrichParseType;
475
476typedef rpmRC (*rpmrichParseFunction) (void *cbdata, rpmrichParseType type,
477 const char *n, int nl, const char *e, int el, rpmsenseFlags sense,
478 rpmrichOp op, char **emsg);
479
488rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata);
489
499rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN);
500
501
507int rpmdsIsRich(rpmds dep);
508
514const char *rpmrichOpStr(rpmrichOp op);
515
525rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg);
526
527#ifdef __cplusplus
528}
529#endif
530
531#endif /* H_RPMDS */
const char * rpmdsN(const rpmds ds)
int rpmdsIsWeak(rpmds ds)
int rpmdsIx(const rpmds ds)
rpmsenseFlags rpmSanitizeDSFlags(rpmTagVal tagN, rpmsenseFlags Flags)
rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags)
rpmds rpmdsCurrent(rpmds ds)
rpmds rpmdsSinglePoolTix(rpmstrPool pool, rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags, int triggerIndex)
int rpmdsTi(const rpmds ds)
int rpmdsCompare(const rpmds A, const rpmds B)
const char * rpmdsEVR(const rpmds ds)
int rpmdsFind(rpmds ds, const rpmds ods)
unsigned int rpmdsInstance(rpmds ds)
int rpmdsPutToHeader(rpmds ds, Header h)
rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color)
rpmds rpmdsSingle(rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags)
rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags)
rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags)
int rpmdsMerge(rpmds *dsp, rpmds ods)
rpmTagVal rpmdsTagF(const rpmds ds)
rpmTagVal rpmdsTagEVR(const rpmds ds)
char rpmdsD(const rpmds ds)
rpmds rpmdsThisPool(rpmstrPool pool, Header h, rpmTagVal tagN, rpmsenseFlags Flags)
rpmds rpmdsFree(rpmds ds)
rpmTagVal rpmdsTagTi(const rpmds ds)
int rpmdsSetIx(rpmds ds, int ix)
int rpmdsSearch(rpmds ds, rpmds ods)
int rpmdsIsReverse(rpmds ds)
int rpmdsCount(const rpmds ds)
rpmTagVal rpmdsTagN(const rpmds ds)
rpmds rpmdsLink(rpmds ds)
rpmTagVal rpmdsDToTagN(char deptype)
int rpmdsMatchesDep(const Header h, int ix, const rpmds req, int nopromote)
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
rpmsenseFlags rpmParseDSFlags(const char *str, size_t len)
rpmsenseFlags rpmdsFlags(const rpmds ds)
rpmds rpmdsInit(rpmds ds)
int rpmdsAnyMatchesDep(const Header h, const rpmds req, int nopromote)
rpm_color_t rpmdsColor(const rpmds ds)
int rpmdsNext(rpmds ds)
char * rpmdsNewDNEVR(const char *dspfx, const rpmds ds)
rpmsenseFlags_e
Definition: rpmds.h:22
const char * rpmdsDNEVR(const rpmds ds)
rpmds rpmdsSinglePool(rpmstrPool pool, rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags)
@ RPMSENSE_POSTUNTRANS
Definition: rpmds.h:45
@ RPMSENSE_FIND_PROVIDES
Definition: rpmds.h:38
@ RPMSENSE_SCRIPT_POSTUN
Definition: rpmds.h:35
@ RPMSENSE_TRIGGERPREIN
Definition: rpmds.h:48
@ RPMSENSE_INTERP
Definition: rpmds.h:31
@ RPMSENSE_TRIGGERUN
Definition: rpmds.h:41
@ RPMSENSE_PREUNTRANS
Definition: rpmds.h:44
@ RPMSENSE_FIND_REQUIRES
Definition: rpmds.h:37
@ RPMSENSE_MISSINGOK
Definition: rpmds.h:43
@ RPMSENSE_TRIGGERIN
Definition: rpmds.h:40
@ RPMSENSE_TRIGGERPOSTUN
Definition: rpmds.h:42
@ RPMSENSE_META
Definition: rpmds.h:52
@ RPMSENSE_SCRIPT_PRE
Definition: rpmds.h:32
@ RPMSENSE_SCRIPT_VERIFY
Definition: rpmds.h:36
@ RPMSENSE_SCRIPT_PREUN
Definition: rpmds.h:34
@ RPMSENSE_RPMLIB
Definition: rpmds.h:47
@ RPMSENSE_SCRIPT_POST
Definition: rpmds.h:33
@ RPMSENSE_POSTTRANS
Definition: rpmds.h:28
@ RPMSENSE_PRETRANS
Definition: rpmds.h:30
enum rpmRC_e rpmRC
struct headerToken_s * Header
Definition: rpmtypes.h:24
const char * rpmrichOpStr(rpmrichOp op)
int rpmdsRpmlib(rpmds *dsp, const void *tblp)
int rpmdsIsRich(rpmds dep)
int rpmdsRpmlibPool(rpmstrPool pool, rpmds *dsp, const void *tblp)
rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN)
rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata)
rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg)