rpm  4.10.0
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);
00108 rpmds rpmdsNew(Header h, rpmTagVal tagN, int flags);
00109 
00116 char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds);
00117 
00125 rpmds rpmdsThis(Header h, rpmTagVal tagN, rpmsenseFlags Flags);
00126 
00135 rpmds rpmdsSingle(rpmTagVal tagN, const char * N, const char * EVR, rpmsenseFlags Flags);
00136 
00142 rpmds rpmdsCurrent(rpmds ds);
00143 
00149 int rpmdsCount(const rpmds ds);
00150 
00156 int rpmdsIx(const rpmds ds);
00157 
00164 int rpmdsSetIx(rpmds ds, int ix);
00165 
00171 const char * rpmdsDNEVR(const rpmds ds);
00172 
00178 const char * rpmdsN(const rpmds ds);
00179 
00185 const char * rpmdsEVR(const rpmds ds);
00186 
00192 rpmsenseFlags rpmdsFlags(const rpmds ds);
00193 
00199 rpmTagVal rpmdsTagN(const rpmds ds);
00200 
00207 unsigned int rpmdsInstance(rpmds ds);
00208 
00222 int rpmdsNoPromote(const rpmds ds);
00223 
00230 int rpmdsSetNoPromote(rpmds ds, int nopromote);
00231 
00237 rpm_color_t rpmdsColor(const rpmds ds);
00238 
00245 rpm_color_t rpmdsSetColor(const rpmds ds, rpm_color_t color);
00246 
00253 /* FIX: rpmMessage annotation is a lie */
00254 void rpmdsNotify(rpmds ds, const char * where, int rc);
00255 
00261 int rpmdsNext(rpmds ds);
00262 
00268 rpmds rpmdsInit(rpmds ds);
00269 
00276 int rpmdsFind(rpmds ds, const rpmds ods);
00277 
00284 int rpmdsMerge(rpmds * dsp, rpmds ods);
00285 
00294 int rpmdsSearch(rpmds ds, rpmds ods);
00295 
00302 int rpmdsCompare(const rpmds A, const rpmds B);
00303 
00311 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote);
00312 
00321 int rpmdsMatchesDep (const Header h, int ix, const rpmds req, int nopromote);
00322 
00330 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote);
00331 
00338 int rpmdsRpmlib(rpmds * dsp, const void * tblp);
00339 
00340 #ifdef __cplusplus
00341 }
00342 #endif
00343 
00344 #endif  /* H_RPMDS */