rpm  4.14.0
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 };
54 
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 
84 #define isLegacyPreReq(_x) (((_x) & _ALL_REQUIRES_MASK) == RPMSENSE_PREREQ)
85 #define isInstallPreReq(_x) ((_x) & _INSTALL_ONLY_MASK)
86 #define isErasePreReq(_x) ((_x) & _ERASE_ONLY_MASK)
87 
88 
89 
96 rpmsenseFlags rpmSanitizeDSFlags(rpmTagVal tagN, rpmsenseFlags Flags);
97 
104 rpmsenseFlags rpmParseDSFlags(const char *str, size_t len);
105 
111 rpmds rpmdsLink(rpmds ds);
112 
118 rpmds rpmdsFree(rpmds ds);
119 
127 rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags);
128 
135 char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds);
136 
144 rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags);
145 
154 rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags);
155 
162 
169 int rpmdsPutToHeader(rpmds ds, Header h);
170 
176 int rpmdsCount(const rpmds ds);
177 
183 int rpmdsIx(const rpmds ds);
184 
191 int rpmdsSetIx(rpmds ds, int ix);
192 
198 const char * rpmdsDNEVR(const rpmds ds);
199 
205 char rpmdsD(const rpmds ds);
206 
212 rpmTagVal rpmdsDToTagN(char deptype);
213 
219 const char * rpmdsN(const rpmds ds);
220 
226 const char * rpmdsEVR(const rpmds ds);
227 
233 int rpmdsTi(const rpmds ds);
234 
240 rpmsenseFlags rpmdsFlags(const rpmds ds);
241 
247 rpmTagVal rpmdsTagN(const rpmds ds);
248 
254 rpmTagVal rpmdsTagEVR(const rpmds ds);
255 
261 rpmTagVal rpmdsTagF(const rpmds ds);
262 
268 rpmTagVal rpmdsTagTi(const rpmds ds);
269 
276 unsigned int rpmdsInstance(rpmds ds);
277 
291 int rpmdsNoPromote(const rpmds ds);
292 
299 int rpmdsSetNoPromote(rpmds ds, int nopromote);
300 
306 rpm_color_t rpmdsColor(const rpmds ds);
307 
314 rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color);
315 
321 int rpmdsNext(rpmds ds);
322 
328 rpmds rpmdsInit(rpmds ds);
329 
336 int rpmdsFind(rpmds ds, const rpmds ods);
337 
344 int rpmdsMerge(rpmds * dsp, rpmds ods);
345 
354 int rpmdsSearch(rpmds ds, rpmds ods);
355 
362 int rpmdsCompare(const rpmds A, const rpmds B);
363 
371 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote);
372 
381 int rpmdsMatchesDep (const Header h, int ix, const rpmds req, int nopromote);
382 
390 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote);
391 
398 int rpmdsRpmlib(rpmds * dsp, const void * tblp);
399 
408 rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags);
409 
419  Header h, rpmTagVal tagN, rpmsenseFlags Flags);
420 
431  const char * N, const char * EVR, rpmsenseFlags Flags);
432 
444  const char * N, const char * EVR,
445  rpmsenseFlags Flags, int triggerIndex);
446 
454 int rpmdsRpmlibPool(rpmstrPool pool, rpmds * dsp, const void * tblp);
455 
456 
457 typedef enum rpmrichOp_e {
466 } rpmrichOp;
467 
468 typedef enum rpmrichParseType_e {
469  RPMRICH_PARSE_SIMPLE = 1, /* standard N <=> EVR dep */
470  RPMRICH_PARSE_ENTER = 2, /* entering sub-dependency */
471  RPMRICH_PARSE_LEAVE = 3, /* leaving sub-dependency */
472  RPMRICH_PARSE_OP = 4 /* parsed a rich dependency op */
474 
475 typedef rpmRC (*rpmrichParseFunction) (void *cbdata, rpmrichParseType type,
476  const char *n, int nl, const char *e, int el, rpmsenseFlags sense,
477  rpmrichOp op, char **emsg);
478 
487 rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata);
488 
498 rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN);
499 
500 
506 int rpmdsIsRich(rpmds dep);
507 
513 const char *rpmrichOpStr(rpmrichOp op);
514 
524 rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg);
525 
526 #ifdef __cplusplus
527 }
528 #endif
529 
530 #endif /* H_RPMDS */
rpmds rpmdsCurrent(rpmds ds)
Return a new dependency set of size 1 from the current iteration index.
int rpmdsNext(rpmds ds)
Return next dependency set iterator index.
int rpmdsMatchesDep(const Header h, int ix, const rpmds req, int nopromote)
Compare package provides dependencies from header with a single dependency.
rpmRC rpmrichParseForTag(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata, rpmTagVal tagN)
Parse a rich dependency string for a specific tag.
rpmds rpmdsNewPool(rpmstrPool pool, Header h, rpmTagVal tagN, int flags)
Create and load a dependency set.
rpmTagVal rpmdsTagN(const rpmds ds)
Return current dependency type.
rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, char **emsg)
Parse a rich dependency string.
rpmTagVal rpmdsTagTi(const rpmds ds)
Return current dependency type.
enum rpmrichOp_e rpmrichOp
char * rpmdsNewDNEVR(const char *dspfx, const rpmds ds)
Return new formatted dependency string.
int rpmdsFind(rpmds ds, const rpmds ods)
Find a dependency set element using binary search.
int rpmdsMerge(rpmds *dsp, rpmds ods)
Merge a dependency set maintaining (N,EVR,Flags) sorted order.
int rpmdsIx(const rpmds ds)
Return dependency set index.
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
Compare package name-version-release from header with a single dependency.
rpmds rpmdsLink(rpmds ds)
Reference a dependency set instance.
int rpmdsRpmlib(rpmds *dsp, const void *tblp)
Load rpmlib provides into a dependency set.
int rpmdsRpmlibPool(rpmstrPool pool, rpmds *dsp, const void *tblp)
Load rpmlib provides into a dependency set.
rpmsenseFlags rpmdsFlags(const rpmds ds)
Return current dependency flags.
rpmsenseFlags_e
Dependency Attributes.
Definition: rpmds.h:25
int rpmdsSetIx(rpmds ds, int ix)
Set dependency set index.
uint32_t rpmFlags
Definition: rpmtypes.h:42
rpmTagVal rpmdsTagEVR(const rpmds ds)
Return current dependency type.
const char * rpmdsN(const rpmds ds)
Return current dependency name.
int rpmdsSearch(rpmds ds, rpmds ods)
Search a sorted dependency set for an element that overlaps.
struct rpmstrPool_s * rpmstrPool
Definition: rpmtypes.h:83
int rpmdsAnyMatchesDep(const Header h, const rpmds req, int nopromote)
Compare package provides dependencies from header with a single dependency.
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.
rpmds rpmdsThisPool(rpmstrPool pool, Header h, rpmTagVal tagN, rpmsenseFlags Flags)
Create, load and initialize a dependency for this header.
int rpmdsNoPromote(const rpmds ds)
Return current "Don&#39;t promote Epoch:" flag.
uint32_t rpm_color_t
Definition: rpmtypes.h:38
rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags)
Create, load and initialize a dependency for this header.
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
int rpmdsCount(const rpmds ds)
Return dependency set count.
char rpmdsD(const rpmds ds)
Return one char indicating the type of the dependency.
rpmrichOp_e
Definition: rpmds.h:457
rpmds rpmdsSinglePool(rpmstrPool pool, rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags)
Create, load and initialize a dependency set of size 1.
rpmds rpmdsSingle(rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags)
Create, load and initialize a dependency set of size 1.
struct rpmds_s * rpmds
Definition: rpmtypes.h:65
rpmTagVal rpmdsDToTagN(char deptype)
Return matching tagN for one char dependency type description.
rpm_tag_t rpmTagVal
Definition: rpmtypes.h:30
rpmds rpmdsFree(rpmds ds)
Destroy a dependency set.
rpmrichParseType_e
Definition: rpmds.h:468
int _rpmds_nopromote
rpmsenseFlags rpmParseDSFlags(const char *str, size_t len)
Convert a string to the sense flags.
rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags)
Create and load a dependency set.
rpm_color_t rpmdsColor(const rpmds ds)
Return current dependency color.
int rpmdsPutToHeader(rpmds ds, Header h)
Write content of the dependency set to the header.
int rpmdsIsRich(rpmds dep)
Return if current depenency is rich.
const char * rpmrichOpStr(rpmrichOp op)
Return a string representation of the rich dependency op.
int rpmdsCompare(const rpmds A, const rpmds B)
Compare two versioned dependency ranges, looking for overlap.
rpmTagVal rpmdsTagF(const rpmds ds)
Return current dependency type.
rpmsenseFlags rpmSanitizeDSFlags(rpmTagVal tagN, rpmsenseFlags Flags)
Return only those flags allowed for given type of dependencies.
rpmds rpmdsInit(rpmds ds)
Initialize dependency set iterator.
const char * rpmdsEVR(const rpmds ds)
Return current dependency epoch-version-release.
const char * rpmdsDNEVR(const rpmds ds)
Return current formatted dependency string.
unsigned int rpmdsInstance(rpmds ds)
Return dependency header instance, ie whether the dependency comes from an installed header or not...
enum rpmrichParseType_e rpmrichParseType
rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color)
Return current dependency color.
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:475
int rpmdsTi(const rpmds ds)
Return current dependency triggerindex.
rpmFlags rpmsenseFlags
Definition: rpmds.h:55
int rpmdsSetNoPromote(rpmds ds, int nopromote)
Set "Don&#39;t promote Epoch:" flag.
enum rpmRC_e rpmRC
Package read return codes.
rpmRC rpmrichParse(const char **dstrp, char **emsg, rpmrichParseFunction cb, void *cbdata)
Parse a rich dependency string.