rpm  4.5
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 
26 typedef enum evrFlags_e evrFlags;
27 
28 /*@-matchfields@*/
29 enum evrFlags_e {
31 #if defined(_RPMEVR_INTERNAL)
32 /*@-enummemuse@*/
33  RPMSENSE_SERIAL = (1 << 0),
34 /*@=enummemuse@*/
35 #endif
36  RPMSENSE_LESS = (1 << 1),
37  RPMSENSE_GREATER = (1 << 2),
38  RPMSENSE_EQUAL = (1 << 3),
39 #if defined(_RPMEVR_INTERNAL)
40  RPMSENSE_PROVIDES = (1 << 4), /* only used internally by builds */
41  RPMSENSE_CONFLICTS = (1 << 5), /* only used internally by builds */
42 #endif
43  RPMSENSE_PREREQ = (1 << 6),
44 #if defined(_RPMEVR_INTERNAL)
45  RPMSENSE_OBSOLETES = (1 << 7), /* only used internally by builds */
46  RPMSENSE_INTERP = (1 << 8),
47  RPMSENSE_SCRIPT_PRE = (1 << 9),
48  RPMSENSE_SCRIPT_POST = (1 << 10),
49  RPMSENSE_SCRIPT_PREUN = (1 << 11),
50  RPMSENSE_SCRIPT_POSTUN = (1 << 12),
51  RPMSENSE_SCRIPT_VERIFY = (1 << 13),
52  RPMSENSE_FIND_REQUIRES = (1 << 14),
53  RPMSENSE_FIND_PROVIDES = (1 << 15),
55  RPMSENSE_TRIGGERIN = (1 << 16),
56  RPMSENSE_TRIGGERUN = (1 << 17),
57  RPMSENSE_TRIGGERPOSTUN = (1 << 18),
58  RPMSENSE_MISSINGOK = (1 << 19),
59  RPMSENSE_SCRIPT_PREP = (1 << 20),
60  RPMSENSE_SCRIPT_BUILD = (1 << 21),
61  RPMSENSE_SCRIPT_INSTALL = (1 << 22),
62  RPMSENSE_SCRIPT_CLEAN = (1 << 23),
63  RPMSENSE_RPMLIB = (1 << 24),
64  RPMSENSE_TRIGGERPREIN = (1 << 25),
65  RPMSENSE_KEYRING = (1 << 26),
66  RPMSENSE_STRONG = (1 << 27),
67  RPMSENSE_CONFIG = (1 << 28),
68  RPMSENSE_PROBE = (1 << 29),
69  RPMSENSE_PACKAGE = (1 << 30)
70 #endif
71 };
72 /*@=matchfields@*/
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  const char * str;
84 /*@observer@*/ /*@null@*/
85  const char * E;
86  unsigned long Elong;
87 /*@observer@*/ /*@null@*/
88  const char * V;
89 /*@observer@*/ /*@null@*/
90  const char * R;
91  evrFlags Flags;
92 };
93 
94 #define RPMSENSE_TRIGGER \
95  (RPMSENSE_TRIGGERPREIN | RPMSENSE_TRIGGERIN | RPMSENSE_TRIGGERUN | RPMSENSE_TRIGGERPOSTUN)
96 
97 #define _ALL_REQUIRES_MASK (\
98  RPMSENSE_INTERP | \
99  RPMSENSE_SCRIPT_PRE | \
100  RPMSENSE_SCRIPT_POST | \
101  RPMSENSE_SCRIPT_PREUN | \
102  RPMSENSE_SCRIPT_POSTUN | \
103  RPMSENSE_SCRIPT_VERIFY | \
104  RPMSENSE_FIND_REQUIRES | \
105  RPMSENSE_MISSINGOK | \
106  RPMSENSE_SCRIPT_PREP | \
107  RPMSENSE_SCRIPT_BUILD | \
108  RPMSENSE_SCRIPT_INSTALL | \
109  RPMSENSE_SCRIPT_CLEAN | \
110  RPMSENSE_RPMLIB | \
111  RPMSENSE_KEYRING | \
112  RPMSENSE_PACKAGE )
113 
114 #define _notpre(_x) ((_x) & ~RPMSENSE_PREREQ)
115 #define _INSTALL_ONLY_MASK \
116  _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING)
117 #define _ERASE_ONLY_MASK \
118  _notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
119 
120 #define isInstallPreReq(_x) ((_x) & _INSTALL_ONLY_MASK)
121 #define isErasePreReq(_x) ((_x) & _ERASE_ONLY_MASK)
122 #endif /* _RPMEVR_INTERNAL */
123 
130 int rpmEVRcmp(const char *a, const char *b)
131  /*@*/;
132 
139 int rpmEVRparse(const char * evrstr, EVR_t evr)
140  /*@modifies evrstr, evr @*/;
141 
148 int rpmEVRcompare(const EVR_t a, const EVR_t b)
149  /*@*/;
150 
157 extern int (*rpmvercmp)(const char *a, const char *b)
158  /*@*/;
159 
166 rpmsenseFlags rpmEVRflags(/*@null@*/const char *op, /*@null@*/const char **end)
167  /*@modifies *end @*/;
168 
169 #ifdef __cplusplus
170 }
171 #endif
172 
173 #endif /* H_RPMEVR */