rpm: /srv/include/rpm/rpmds.h Source File

rpm 4.20.1 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
22 enum rpmsenseFlags_e {
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),
32 RPMSENSE_SCRIPT_PRE = (1 << 9),
33 RPMSENSE_SCRIPT_POST = (1 << 10),
34 RPMSENSE_SCRIPT_PREUN = (1 << 11),
35 RPMSENSE_SCRIPT_POSTUN = (1 << 12),
36 RPMSENSE_SCRIPT_VERIFY = (1 << 13),
37 RPMSENSE_FIND_REQUIRES = (1 << 14),
38 RPMSENSE_FIND_PROVIDES = (1 << 15),
40 RPMSENSE_TRIGGERIN = (1 << 16),
41 RPMSENSE_TRIGGERUN = (1 << 17),
42 RPMSENSE_TRIGGERPOSTUN = (1 << 18),
43 RPMSENSE_MISSINGOK = (1 << 19),
44 RPMSENSE_PREUNTRANS = (1 << 20),
45 RPMSENSE_POSTUNTRANS = (1 << 21),
46 /* bits 22-23 unused */
47 RPMSENSE_RPMLIB = (1 << 24),
48 RPMSENSE_TRIGGERPREIN = (1 << 25),
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
145 char * 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
179 int rpmdsPutToHeader(rpmds ds, Header h);
180
186 int rpmdsCount(const rpmds ds);
187
193 int rpmdsIx(const rpmds ds);
194
201 int rpmdsSetIx(rpmds ds, int ix);
202
208 const char * rpmdsDNEVR(const rpmds ds);
209
215 char rpmdsD(const rpmds ds);
216
222rpmTagVal rpmdsDToTagN(char deptype);
223
229 const char * rpmdsN(const rpmds ds);
230
236 const char * rpmdsEVR(const rpmds ds);
237
243 int 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
286 unsigned int rpmdsInstance(rpmds ds);
287
293 int rpmdsIsWeak(rpmds ds);
294
300 int rpmdsIsReverse(rpmds ds);
301
308 int rpmdsIsSysuser(rpmds ds, char **sysuser);
309
315rpm_color_t rpmdsColor(const rpmds ds);
316
323rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color);
324
330 int rpmdsNext(rpmds ds);
331
337rpmds rpmdsInit(rpmds ds);
338
345 int rpmdsFind(rpmds ds, const rpmds ods);
346
353 int rpmdsMerge(rpmds * dsp, rpmds ods);
354
363 int rpmdsSearch(rpmds ds, rpmds ods);
364
371 int rpmdsCompare(const rpmds A, const rpmds B);
372
380 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote);
381
390 int rpmdsMatchesDep (const Header h, int ix, const rpmds req, int nopromote);
391
399 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote);
400
407 int rpmdsRpmlib(rpmds * dsp, const void * tblp);
408
417rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags);
418
427rpmds rpmdsThisPool(rpmstrPool pool,
428 Header h, rpmTagVal tagN, rpmsenseFlags Flags);
429
439rpmds rpmdsSinglePool(rpmstrPool pool, rpmTagVal tagN,
440 const char * N, const char * EVR, rpmsenseFlags Flags);
441
452rpmds rpmdsSinglePoolTix(rpmstrPool pool, rpmTagVal tagN,
453 const char * N, const char * EVR,
454 rpmsenseFlags Flags, int triggerIndex);
455
463 int rpmdsRpmlibPool(rpmstrPool pool, rpmds * dsp, const void * tblp);
464
465
466typedef enum rpmrichOp_e {
467 RPMRICHOP_NONE = 0,
468 RPMRICHOP_SINGLE = 1,
469 RPMRICHOP_AND = 2,
470 RPMRICHOP_OR = 3,
471 RPMRICHOP_IF = 4,
472 RPMRICHOP_ELSE = 5,
473 RPMRICHOP_WITH = 6,
474 RPMRICHOP_WITHOUT = 7,
475 RPMRICHOP_UNLESS = 8
476} rpmrichOp;
477
478typedef enum rpmrichParseType_e {
479 RPMRICH_PARSE_SIMPLE = 1, /* standard N <=> EVR dep */
480 RPMRICH_PARSE_ENTER = 2, /* entering sub-dependency */
481 RPMRICH_PARSE_LEAVE = 3, /* leaving sub-dependency */
482 RPMRICH_PARSE_OP = 4 /* parsed a rich dependency op */
483} rpmrichParseType;
484
485typedef rpmRC (*rpmrichParseFunction) (void *cbdata, rpmrichParseType type,
486 const char *n, int nl, const char *e, int el, rpmsenseFlags sense,
487 rpmrichOp op, char **emsg);
488
497 rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata);
498
508 rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN);
509
510
516 int rpmdsIsRich(rpmds dep);
517
523 const char *rpmrichOpStr(rpmrichOp op);
524
534 rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg);
535
536#ifdef __cplusplus
537}
538#endif
539
540#endif /* H_RPMDS */
rpmdsN
const char * rpmdsN(const rpmds ds)
rpmdsIsWeak
int rpmdsIsWeak(rpmds ds)
rpmdsIsSysuser
int rpmdsIsSysuser(rpmds ds, char **sysuser)
rpmdsIx
int rpmdsIx(const rpmds ds)
rpmSanitizeDSFlags
rpmsenseFlags rpmSanitizeDSFlags(rpmTagVal tagN, rpmsenseFlags Flags)
rpmdsNewPool
rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags)
rpmdsCurrent
rpmds rpmdsCurrent(rpmds ds)
rpmdsSinglePoolTix
rpmds rpmdsSinglePoolTix(rpmstrPool pool, rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags, int triggerIndex)
rpmdsTi
int rpmdsTi(const rpmds ds)
rpmdsCompare
int rpmdsCompare(const rpmds A, const rpmds B)
rpmdsEVR
const char * rpmdsEVR(const rpmds ds)
rpmdsFind
int rpmdsFind(rpmds ds, const rpmds ods)
rpmdsInstance
unsigned int rpmdsInstance(rpmds ds)
rpmdsPutToHeader
int rpmdsPutToHeader(rpmds ds, Header h)
rpmdsSetColor
rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color)
rpmdsSingle
rpmds rpmdsSingle(rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags)
rpmdsThis
rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags)
rpmdsNew
rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags)
rpmdsMerge
int rpmdsMerge(rpmds *dsp, rpmds ods)
rpmdsTagF
rpmTagVal rpmdsTagF(const rpmds ds)
rpmdsTagEVR
rpmTagVal rpmdsTagEVR(const rpmds ds)
rpmdsD
char rpmdsD(const rpmds ds)
rpmdsThisPool
rpmds rpmdsThisPool(rpmstrPool pool, Header h, rpmTagVal tagN, rpmsenseFlags Flags)
rpmdsFree
rpmds rpmdsFree(rpmds ds)
rpmdsTagTi
rpmTagVal rpmdsTagTi(const rpmds ds)
rpmdsSetIx
int rpmdsSetIx(rpmds ds, int ix)
rpmdsSearch
int rpmdsSearch(rpmds ds, rpmds ods)
rpmdsIsReverse
int rpmdsIsReverse(rpmds ds)
rpmdsCount
int rpmdsCount(const rpmds ds)
rpmdsTagN
rpmTagVal rpmdsTagN(const rpmds ds)
rpmdsLink
rpmds rpmdsLink(rpmds ds)
rpmdsDToTagN
rpmTagVal rpmdsDToTagN(char deptype)
rpmdsMatchesDep
int rpmdsMatchesDep(const Header h, int ix, const rpmds req, int nopromote)
rpmdsNVRMatchesDep
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
rpmParseDSFlags
rpmsenseFlags rpmParseDSFlags(const char *str, size_t len)
rpmdsFlags
rpmsenseFlags rpmdsFlags(const rpmds ds)
rpmdsInit
rpmds rpmdsInit(rpmds ds)
rpmdsAnyMatchesDep
int rpmdsAnyMatchesDep(const Header h, const rpmds req, int nopromote)
rpmdsColor
rpm_color_t rpmdsColor(const rpmds ds)
rpmdsNext
int rpmdsNext(rpmds ds)
rpmdsNewDNEVR
char * rpmdsNewDNEVR(const char *dspfx, const rpmds ds)
rpmsenseFlags_e
rpmsenseFlags_e
Definition rpmds.h:22
rpmdsDNEVR
const char * rpmdsDNEVR(const rpmds ds)
rpmdsSinglePool
rpmds rpmdsSinglePool(rpmstrPool pool, rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags)
RPMSENSE_POSTUNTRANS
@ RPMSENSE_POSTUNTRANS
Definition rpmds.h:45
RPMSENSE_FIND_PROVIDES
@ RPMSENSE_FIND_PROVIDES
Definition rpmds.h:38
RPMSENSE_SCRIPT_POSTUN
@ RPMSENSE_SCRIPT_POSTUN
Definition rpmds.h:35
RPMSENSE_TRIGGERPREIN
@ RPMSENSE_TRIGGERPREIN
Definition rpmds.h:48
RPMSENSE_INTERP
@ RPMSENSE_INTERP
Definition rpmds.h:31
RPMSENSE_TRIGGERUN
@ RPMSENSE_TRIGGERUN
Definition rpmds.h:41
RPMSENSE_PREUNTRANS
@ RPMSENSE_PREUNTRANS
Definition rpmds.h:44
RPMSENSE_FIND_REQUIRES
@ RPMSENSE_FIND_REQUIRES
Definition rpmds.h:37
RPMSENSE_MISSINGOK
@ RPMSENSE_MISSINGOK
Definition rpmds.h:43
RPMSENSE_TRIGGERIN
@ RPMSENSE_TRIGGERIN
Definition rpmds.h:40
RPMSENSE_TRIGGERPOSTUN
@ RPMSENSE_TRIGGERPOSTUN
Definition rpmds.h:42
RPMSENSE_META
@ RPMSENSE_META
Definition rpmds.h:52
RPMSENSE_SCRIPT_PRE
@ RPMSENSE_SCRIPT_PRE
Definition rpmds.h:32
RPMSENSE_SCRIPT_VERIFY
@ RPMSENSE_SCRIPT_VERIFY
Definition rpmds.h:36
RPMSENSE_SCRIPT_PREUN
@ RPMSENSE_SCRIPT_PREUN
Definition rpmds.h:34
RPMSENSE_RPMLIB
@ RPMSENSE_RPMLIB
Definition rpmds.h:47
RPMSENSE_SCRIPT_POST
@ RPMSENSE_SCRIPT_POST
Definition rpmds.h:33
RPMSENSE_POSTTRANS
@ RPMSENSE_POSTTRANS
Definition rpmds.h:28
RPMSENSE_PRETRANS
@ RPMSENSE_PRETRANS
Definition rpmds.h:30
rpmRC
enum rpmRC_e rpmRC
Header
struct headerToken_s * Header
Definition rpmtypes.h:24
rpmrichOpStr
const char * rpmrichOpStr(rpmrichOp op)
rpmdsRpmlib
int rpmdsRpmlib(rpmds *dsp, const void *tblp)
rpmdsIsRich
int rpmdsIsRich(rpmds dep)
rpmdsRpmlibPool
int rpmdsRpmlibPool(rpmstrPool pool, rpmds *dsp, const void *tblp)
rpmrichParseForTag
rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN)
rpmrichParse
rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata)
rpmdsParseRichDep
rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg)
rpmps.h
rpmtypes.h
rpmutil.h