rpm  5.2.1
rpmdb/rpmevr.h
Go to the documentation of this file.
00001 #ifndef H_RPMEVR
00002 #define H_RPMEVR
00003 
00009 #ifdef __cplusplus
00010 extern "C" {
00011 #endif
00012 
00015 /*@-exportlocal@*/
00016 /*@unchecked@*/
00017 extern int _rpmevr_debug;
00018 /*@=exportlocal@*/
00019 
00020 typedef /*@abstract@*/ struct EVR_s * EVR_t;
00021 
00025 /*@-matchfields@*/
00026 typedef enum evrFlags_e {
00027 #if defined(_RPMEVR_INTERNAL)
00028     RPMSENSE_ANY        = 0,
00029 /*@-enummemuse@*/
00030     RPMSENSE_SERIAL     = (1 << 0),     
00031 /*@=enummemuse@*/
00032 #endif
00033     RPMSENSE_LESS       = (1 << 1),
00034     RPMSENSE_GREATER    = (1 << 2),
00035     RPMSENSE_EQUAL      = (1 << 3),
00036 #if defined(_RPMEVR_INTERNAL)
00037     RPMSENSE_PROVIDES   = (1 << 4), /* only used internally by builds */
00038     RPMSENSE_CONFLICTS  = (1 << 5), /* only used internally by builds */
00039 #endif
00040     RPMSENSE_PREREQ     = (1 << 6),     
00041 #if defined(_RPMEVR_INTERNAL)
00042     RPMSENSE_OBSOLETES  = (1 << 7), /* only used internally by builds */
00043     RPMSENSE_INTERP     = (1 << 8),     
00044     RPMSENSE_SCRIPT_PRE = (1 << 9),     
00045     RPMSENSE_SCRIPT_POST = (1 << 10),   
00046     RPMSENSE_SCRIPT_PREUN = (1 << 11),  
00047     RPMSENSE_SCRIPT_POSTUN = (1 << 12), 
00048     RPMSENSE_SCRIPT_VERIFY = (1 << 13), 
00049     RPMSENSE_FIND_REQUIRES = (1 << 14), 
00050     RPMSENSE_FIND_PROVIDES = (1 << 15), 
00052     RPMSENSE_TRIGGERIN  = (1 << 16),    
00053     RPMSENSE_TRIGGERUN  = (1 << 17),    
00054     RPMSENSE_TRIGGERPOSTUN = (1 << 18), 
00055     RPMSENSE_MISSINGOK  = (1 << 19),    
00056     RPMSENSE_SCRIPT_PREP = (1 << 20),   
00057     RPMSENSE_SCRIPT_BUILD = (1 << 21),  
00058     RPMSENSE_SCRIPT_INSTALL = (1 << 22),
00059     RPMSENSE_SCRIPT_CLEAN = (1 << 23),  
00060     RPMSENSE_RPMLIB = (1 << 24),        
00061     RPMSENSE_TRIGGERPREIN = (1 << 25),  
00062     RPMSENSE_KEYRING    = (1 << 26),
00063     RPMSENSE_STRONG     = (1 << 27),    
00064     RPMSENSE_CONFIG     = (1 << 28),
00065     RPMSENSE_PROBE      = (1 << 29),
00066     RPMSENSE_PACKAGE    = (1 << 30),
00067     RPMSENSE_SCRIPT_SANITYCHECK = (1 << 31) 
00068 #endif
00069 } evrFlags;
00070 /*@=matchfields@*/
00071 
00072 typedef enum evrFlags_e rpmsenseFlags;
00073 
00074 #define RPMSENSE_SENSEMASK      0x0e     /* Mask to get senses, ie serial, */
00075                                          /* less, greater, equal.          */
00076 #define RPMSENSE_NOTEQUAL       (RPMSENSE_EQUAL ^ RPMSENSE_SENSEMASK)
00077 
00078 #if defined(_RPMEVR_INTERNAL)
00079 
00082 struct EVR_s {
00083 /*@owned@*/
00084     const char * str;           
00085 #ifndef DYING
00086     unsigned long Elong;        
00087 #endif
00088     evrFlags Flags;             
00089     const char * F[5];          
00090 #define RPMEVR_E        1
00091 #define RPMEVR_V        2
00092 #define RPMEVR_R        3
00093 #define RPMEVR_D        4
00094 };
00095 
00096 #define RPMSENSE_TRIGGER        \
00097         (RPMSENSE_TRIGGERPREIN | RPMSENSE_TRIGGERIN | RPMSENSE_TRIGGERUN | RPMSENSE_TRIGGERPOSTUN)
00098 
00099 #define _ALL_REQUIRES_MASK      (\
00100     RPMSENSE_INTERP | \
00101     RPMSENSE_SCRIPT_PRE | \
00102     RPMSENSE_SCRIPT_POST | \
00103     RPMSENSE_SCRIPT_PREUN | \
00104     RPMSENSE_SCRIPT_POSTUN | \
00105     RPMSENSE_SCRIPT_VERIFY | \
00106     RPMSENSE_FIND_REQUIRES | \
00107     RPMSENSE_MISSINGOK | \
00108     RPMSENSE_SCRIPT_PREP | \
00109     RPMSENSE_SCRIPT_BUILD | \
00110     RPMSENSE_SCRIPT_INSTALL | \
00111     RPMSENSE_SCRIPT_CLEAN | \
00112     RPMSENSE_RPMLIB | \
00113     RPMSENSE_KEYRING | \
00114     RPMSENSE_PACKAGE )
00115 
00116 #define _notpre(_x)             ((_x) & ~RPMSENSE_PREREQ)
00117 #define _INSTALL_ONLY_MASK \
00118     _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING)
00119 #define _ERASE_ONLY_MASK  \
00120     _notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
00121 
00122 #define isInstallPreReq(_x)     ((_x) & _INSTALL_ONLY_MASK)
00123 #define isErasePreReq(_x)       ((_x) & _ERASE_ONLY_MASK)
00124 #endif  /* _RPMEVR_INTERNAL */
00125 
00132 EVR_t rpmEVRnew(rpmuint32_t Flags, int initialize)
00133         /*@*/;
00134 
00140 /*@null@*/
00141 EVR_t rpmEVRfree(/*@only@*/ EVR_t evr)
00142         /*@modifies evr @*/;
00143 
00150 int rpmEVRcmp(const char *a, const char *b)
00151         /*@*/;
00152 
00159 int rpmEVRparse(const char * evrstr, EVR_t evr)
00160         /*@modifies evrstr, evr @*/;
00161 
00168 int rpmEVRcompare(const EVR_t a, const EVR_t b)
00169         /*@*/;
00170 
00177 int rpmEVRoverlap(EVR_t a, EVR_t b)
00178         /*@*/;
00179 
00186 extern int (*rpmvercmp)(const char *a, const char *b)
00187         /*@*/;
00188 
00195 rpmsenseFlags rpmEVRflags(/*@null@*/const char *op, /*@null@*/const char **end)
00196         /*@modifies *end @*/;
00197 
00206 int rpmVersionCompare(Header A, Header B)
00207         /*@globals internalState @*/
00208         /*@modifies internalState @*/;
00209 
00210 #ifdef __cplusplus
00211 }
00212 #endif
00213 
00214 #endif  /* H_RPMEVR */