rpm  5.2.1
rpmevr.h
Go to the documentation of this file.
1 #ifndef H_RPMEVR
2 #define H_RPMEVR
3 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
15 /*@-exportlocal@*/
16 /*@unchecked@*/
17 extern int _rpmevr_debug;
18 /*@=exportlocal@*/
19 
20 typedef /*@abstract@*/ struct EVR_s * EVR_t;
21 
25 /*@-matchfields@*/
26 typedef enum evrFlags_e {
27 #if defined(_RPMEVR_INTERNAL)
28  RPMSENSE_ANY = 0,
29 /*@-enummemuse@*/
30  RPMSENSE_SERIAL = (1 << 0),
31 /*@=enummemuse@*/
32 #endif
33  RPMSENSE_LESS = (1 << 1),
34  RPMSENSE_GREATER = (1 << 2),
35  RPMSENSE_EQUAL = (1 << 3),
36 #if defined(_RPMEVR_INTERNAL)
37  RPMSENSE_PROVIDES = (1 << 4), /* only used internally by builds */
38  RPMSENSE_CONFLICTS = (1 << 5), /* only used internally by builds */
39 #endif
40  RPMSENSE_PREREQ = (1 << 6),
41 #if defined(_RPMEVR_INTERNAL)
42  RPMSENSE_OBSOLETES = (1 << 7), /* only used internally by builds */
43  RPMSENSE_INTERP = (1 << 8),
44  RPMSENSE_SCRIPT_PRE = (1 << 9),
45  RPMSENSE_SCRIPT_POST = (1 << 10),
46  RPMSENSE_SCRIPT_PREUN = (1 << 11),
47  RPMSENSE_SCRIPT_POSTUN = (1 << 12),
48  RPMSENSE_SCRIPT_VERIFY = (1 << 13),
49  RPMSENSE_FIND_REQUIRES = (1 << 14),
50  RPMSENSE_FIND_PROVIDES = (1 << 15),
52  RPMSENSE_TRIGGERIN = (1 << 16),
53  RPMSENSE_TRIGGERUN = (1 << 17),
54  RPMSENSE_TRIGGERPOSTUN = (1 << 18),
55  RPMSENSE_MISSINGOK = (1 << 19),
56  RPMSENSE_SCRIPT_PREP = (1 << 20),
57  RPMSENSE_SCRIPT_BUILD = (1 << 21),
58  RPMSENSE_SCRIPT_INSTALL = (1 << 22),
59  RPMSENSE_SCRIPT_CLEAN = (1 << 23),
60  RPMSENSE_RPMLIB = (1 << 24),
61  RPMSENSE_TRIGGERPREIN = (1 << 25),
62  RPMSENSE_KEYRING = (1 << 26),
63  RPMSENSE_STRONG = (1 << 27),
64  RPMSENSE_CONFIG = (1 << 28),
65  RPMSENSE_PROBE = (1 << 29),
66  RPMSENSE_PACKAGE = (1 << 30),
67  RPMSENSE_SCRIPT_SANITYCHECK = (1 << 31)
68 #endif
69 } evrFlags;
70 /*@=matchfields@*/
71 
73 
74 #define RPMSENSE_SENSEMASK 0x0e /* Mask to get senses, ie serial, */
75  /* less, greater, equal. */
76 #define RPMSENSE_NOTEQUAL (RPMSENSE_EQUAL ^ RPMSENSE_SENSEMASK)
77 
78 #if defined(_RPMEVR_INTERNAL)
79 
82 struct EVR_s {
83 /*@owned@*/
84  const char * str;
85 #ifndef DYING
86  unsigned long Elong;
87 #endif
88  evrFlags Flags;
89  const char * F[5];
90 #define RPMEVR_E 1
91 #define RPMEVR_V 2
92 #define RPMEVR_R 3
93 #define RPMEVR_D 4
94 };
95 
96 #define RPMSENSE_TRIGGER \
97  (RPMSENSE_TRIGGERPREIN | RPMSENSE_TRIGGERIN | RPMSENSE_TRIGGERUN | RPMSENSE_TRIGGERPOSTUN)
98 
99 #define _ALL_REQUIRES_MASK (\
100  RPMSENSE_INTERP | \
101  RPMSENSE_SCRIPT_PRE | \
102  RPMSENSE_SCRIPT_POST | \
103  RPMSENSE_SCRIPT_PREUN | \
104  RPMSENSE_SCRIPT_POSTUN | \
105  RPMSENSE_SCRIPT_VERIFY | \
106  RPMSENSE_FIND_REQUIRES | \
107  RPMSENSE_MISSINGOK | \
108  RPMSENSE_SCRIPT_PREP | \
109  RPMSENSE_SCRIPT_BUILD | \
110  RPMSENSE_SCRIPT_INSTALL | \
111  RPMSENSE_SCRIPT_CLEAN | \
112  RPMSENSE_RPMLIB | \
113  RPMSENSE_KEYRING | \
114  RPMSENSE_PACKAGE )
115 
116 #define _notpre(_x) ((_x) & ~RPMSENSE_PREREQ)
117 #define _INSTALL_ONLY_MASK \
118  _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING)
119 #define _ERASE_ONLY_MASK \
120  _notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
121 
122 #define isInstallPreReq(_x) ((_x) & _INSTALL_ONLY_MASK)
123 #define isErasePreReq(_x) ((_x) & _ERASE_ONLY_MASK)
124 #endif /* _RPMEVR_INTERNAL */
125 
132 EVR_t rpmEVRnew(rpmuint32_t Flags, int initialize)
133  /*@*/;
134 
140 /*@null@*/
141 EVR_t rpmEVRfree(/*@only@*/ EVR_t evr)
142  /*@modifies evr @*/;
143 
150 int rpmEVRcmp(const char *a, const char *b)
151  /*@*/;
152 
159 int rpmEVRparse(const char * evrstr, EVR_t evr)
160  /*@modifies evrstr, evr @*/;
161 
168 int rpmEVRcompare(const EVR_t a, const EVR_t b)
169  /*@*/;
170 
177 int rpmEVRoverlap(EVR_t a, EVR_t b)
178  /*@*/;
179 
186 extern int (*rpmvercmp)(const char *a, const char *b)
187  /*@*/;
188 
195 rpmsenseFlags rpmEVRflags(/*@null@*/const char *op, /*@null@*/const char **end)
196  /*@modifies *end @*/;
197 
207  /*@globals internalState @*/
208  /*@modifies internalState @*/;
209 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif /* H_RPMEVR */