rpm  4.10.90
rpmds.h
Go to the documentation of this file.
00001 #ifndef H_RPMDS
00002 #define H_RPMDS
00003 
00009 #include <time.h>
00010 
00011 #include <rpm/rpmtypes.h>
00012 #include <rpm/rpmps.h>
00013 
00014 #ifdef __cplusplus
00015 extern "C" {
00016 #endif
00017 
00020 extern int _rpmds_nopromote;
00021 
00025 enum rpmsenseFlags_e {
00026     RPMSENSE_ANY        = 0,
00027     RPMSENSE_LESS       = (1 << 1),
00028     RPMSENSE_GREATER    = (1 << 2),
00029     RPMSENSE_EQUAL      = (1 << 3),
00030     /* bit 4 unused */
00031     RPMSENSE_POSTTRANS  = (1 << 5),     
00032     RPMSENSE_PREREQ     = (1 << 6),     /* legacy prereq dependency */
00033     RPMSENSE_PRETRANS   = (1 << 7),     
00034     RPMSENSE_INTERP     = (1 << 8),     
00035     RPMSENSE_SCRIPT_PRE = (1 << 9),     
00036     RPMSENSE_SCRIPT_POST = (1 << 10),   
00037     RPMSENSE_SCRIPT_PREUN = (1 << 11),  
00038     RPMSENSE_SCRIPT_POSTUN = (1 << 12), 
00039     RPMSENSE_SCRIPT_VERIFY = (1 << 13), 
00040     RPMSENSE_FIND_REQUIRES = (1 << 14), 
00041     RPMSENSE_FIND_PROVIDES = (1 << 15), 
00043     RPMSENSE_TRIGGERIN  = (1 << 16),    
00044     RPMSENSE_TRIGGERUN  = (1 << 17),    
00045     RPMSENSE_TRIGGERPOSTUN = (1 << 18), 
00046     RPMSENSE_MISSINGOK  = (1 << 19),    
00047     /* bits 20-23 unused */
00048     RPMSENSE_RPMLIB = (1 << 24),        
00049     RPMSENSE_TRIGGERPREIN = (1 << 25),  
00050     RPMSENSE_KEYRING    = (1 << 26),
00051     /* bit 27 unused */
00052     RPMSENSE_CONFIG     = (1 << 28)
00053 };
00054 
00055 typedef rpmFlags rpmsenseFlags;
00056 
00057 #define RPMSENSE_SENSEMASK      15       /* Mask to get senses, ie serial, */
00058                                          /* less, greater, equal.          */
00059 
00060 #define RPMSENSE_TRIGGER        \
00061         (RPMSENSE_TRIGGERPREIN | RPMSENSE_TRIGGERIN | RPMSENSE_TRIGGERUN | RPMSENSE_TRIGGERPOSTUN)
00062 
00063 #define _ALL_REQUIRES_MASK      (\
00064     RPMSENSE_INTERP | \
00065     RPMSENSE_SCRIPT_PRE | \
00066     RPMSENSE_SCRIPT_POST | \
00067     RPMSENSE_SCRIPT_PREUN | \
00068     RPMSENSE_SCRIPT_POSTUN | \
00069     RPMSENSE_SCRIPT_VERIFY | \
00070     RPMSENSE_FIND_REQUIRES | \
00071     RPMSENSE_RPMLIB | \
00072     RPMSENSE_KEYRING | \
00073     RPMSENSE_PRETRANS | \
00074     RPMSENSE_POSTTRANS | \
00075     RPMSENSE_PREREQ | \
00076     RPMSENSE_MISSINGOK)
00077 
00078 #define _notpre(_x)             ((_x) & ~RPMSENSE_PREREQ)
00079 #define _INSTALL_ONLY_MASK \
00080     _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_RPMLIB|RPMSENSE_KEYRING|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS)
00081 #define _ERASE_ONLY_MASK  \
00082     _notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
00083 
00084 #define isLegacyPreReq(_x)  (((_x) & _ALL_REQUIRES_MASK) == RPMSENSE_PREREQ)
00085 #define isInstallPreReq(_x)     ((_x) & _INSTALL_ONLY_MASK)
00086 #define isErasePreReq(_x)       ((_x) & _ERASE_ONLY_MASK)
00087 
00093 rpmds rpmdsLink(rpmds ds);
00094 
00100 rpmds rpmdsFree(rpmds ds);
00101 
00109 rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags);
00110 
00117 char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds);
00118 
00126 rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags);
00127 
00136 rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags);
00137 
00143 rpmds rpmdsCurrent(rpmds ds);
00144 
00150 int rpmdsCount(const rpmds ds);
00151 
00157 int rpmdsIx(const rpmds ds);
00158 
00165 int rpmdsSetIx(rpmds ds, int ix);
00166 
00172 const char * rpmdsDNEVR(const rpmds ds);
00173 
00179 const char * rpmdsN(const rpmds ds);
00180 
00186 const char * rpmdsEVR(const rpmds ds);
00187 
00193 rpmsenseFlags rpmdsFlags(const rpmds ds);
00194 
00200 rpmTagVal rpmdsTagN(const rpmds ds);
00201 
00208 unsigned int rpmdsInstance(rpmds ds);
00209 
00223 int rpmdsNoPromote(const rpmds ds);
00224 
00231 int rpmdsSetNoPromote(rpmds ds, int nopromote);
00232 
00238 rpm_color_t rpmdsColor(const rpmds ds);
00239 
00246 rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color);
00247 
00254 /* FIX: rpmMessage annotation is a lie */
00255 void rpmdsNotify(rpmds ds, const char * where, int rc);
00256 
00262 int rpmdsNext(rpmds ds);
00263 
00269 rpmds rpmdsInit(rpmds ds);
00270 
00277 int rpmdsFind(rpmds ds, const rpmds ods);
00278 
00285 int rpmdsMerge(rpmds * dsp, rpmds ods);
00286 
00295 int rpmdsSearch(rpmds ds, rpmds ods);
00296 
00303 int rpmdsCompare(const rpmds A, const rpmds B);
00304 
00312 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote);
00313 
00322 int rpmdsMatchesDep (const Header h, int ix, const rpmds req, int nopromote);
00323 
00331 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote);
00332 
00339 int rpmdsRpmlib(rpmds * dsp, const void * tblp);
00340 
00341 #ifdef __cplusplus
00342 }
00343 #endif
00344 
00345 #endif  /* H_RPMDS */