Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

lib/rpmds.h

Go to the documentation of this file.
00001 #ifndef H_RPMDS
00002 #define H_RPMDS
00003 
00009 #include "rpmevr.h"
00010 #define _RPMNS_INTERNAL
00011 #include "rpmns.h"
00012 #include "rpmps.h"
00013 
00016 /*@-exportlocal@*/
00017 /*@unchecked@*/
00018 extern int _rpmds_debug;
00019 /*@=exportlocal@*/
00020 
00023 /*@-exportlocal@*/
00024 /*@unchecked@*/
00025 extern int _rpmds_nopromote;
00026 /*@=exportlocal@*/
00027 
00028 #if defined(_RPMDS_INTERNAL)
00029 
00032 struct rpmds_s {
00033 /*@observer@*/
00034     const char * Type;          
00035 /*@only@*/ /*@null@*/
00036     const char * DNEVR;         
00037 /*@refcounted@*/ /*@null@*/
00038     Header h;                   
00039 /*@only@*/ /*@relnull@*/
00040     const char ** N;            
00041 /*@only@*/ /*@relnull@*/
00042     const char ** EVR;          
00043 /*@only@*/ /*@relnull@*/
00044     int_32 * Flags;             
00045 /*@only@*/ /*@null@*/
00046     uint_32 * Color;            
00047 /*@only@*/ /*@null@*/
00048     int_32 * Refs;              
00049 /*@only@*/ /*@null@*/
00050     int_32 * Result;            
00051 /*@null@*/
00052     int (*EVRparse) (const char *evrstr, EVR_t evr);     /* EVR parsing. */
00053     int (*EVRcmp) (const char *a, const char *b);        /* EVR comparison. */
00054     struct rpmns_s ns;          
00055 /*@only@*/ /*@null@*/
00056     const char * A;             
00057     int_32 BT;                  
00058     rpmTag tagN;                
00059     rpmTagType Nt, EVRt, Ft;    
00060     int_32 Count;               
00061     int i;                      
00062     unsigned l;                 
00063     unsigned u;                 
00064     int nopromote;              
00065 /*@refs@*/
00066     int nrefs;                  
00067 };
00068 #endif  /* _RPMDS_INTERNAL */
00069 
00070 #if defined(_RPMPRCO_INTERNAL)
00071 
00074 struct rpmPRCO_s {
00075 /*@dependent@*/ /*@relnull@*/
00076     rpmds * Pdsp;               
00077 /*@dependent@*/ /*@relnull@*/
00078     rpmds * Rdsp;               
00079 /*@dependent@*/ /*@relnull@*/
00080     rpmds * Cdsp;               
00081 /*@dependent@*/ /*@relnull@*/
00082     rpmds * Odsp;               
00083 /*@dependent@*/ /*@relnull@*/
00084     rpmds * Tdsp;               
00085 /*@dependent@*/ /*@relnull@*/
00086     rpmds * Ddsp;               
00087 /*@dependent@*/ /*@relnull@*/
00088     rpmds * Ldsp;               
00089 /*@refcounted@*/ /*@null@*/
00090     rpmds this;         
00091 /*@refcounted@*/ /*@null@*/
00092     rpmds P;            
00093 /*@refcounted@*/ /*@null@*/
00094     rpmds R;            
00095 /*@refcounted@*/ /*@null@*/
00096     rpmds C;            
00097 /*@refcounted@*/ /*@null@*/
00098     rpmds O;            
00099 /*@refcounted@*/ /*@null@*/
00100     rpmds T;            
00101 /*@refcounted@*/ /*@null@*/
00102     rpmds D;            
00103 /*@refcounted@*/ /*@null@*/
00104     rpmds L;            
00105 };
00106 #endif  /* _RPMPRCO_INTERNAL */
00107 
00108 #ifdef __cplusplus
00109 extern "C" {
00110 #endif
00111 
00120 /*@unused@*/ /*@null@*/
00121 rpmds rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
00122                 /*@null@*/ const char * msg)
00123         /*@modifies ds @*/;
00124 
00126 /*@-exportlocal@*/
00127 /*@null@*/
00128 rpmds XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
00129                 /*@null@*/ const char * msg, const char * fn, unsigned ln)
00130         /*@modifies ds @*/;
00131 /*@=exportlocal@*/
00132 #define rpmdsUnlink(_ds, _msg)  XrpmdsUnlink(_ds, _msg, __FILE__, __LINE__)
00133 
00140 /*@unused@*/ /*@newref@*/ /*@null@*/
00141 rpmds rpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg)
00142         /*@modifies ds @*/;
00143 
00145 /*@newref@*/ /*@null@*/
00146 rpmds XrpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg,
00147                 const char * fn, unsigned ln)
00148         /*@modifies ds @*/;
00149 #define rpmdsLink(_ds, _msg)    XrpmdsLink(_ds, _msg, __FILE__, __LINE__)
00150 
00156 /*@null@*/
00157 rpmds rpmdsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds)
00158         /*@modifies ds @*/;
00166 /*@null@*/
00167 rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
00168         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00169         /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
00170 
00176 const char * rpmdsNewN(rpmds ds)
00177         /*@globals rpmGlobalMacroContext, h_errno @*/
00178         /*@modifies ds, rpmGlobalMacroContext @*/;
00179 
00186 char * rpmdsNewDNEVR(const char * dspfx, rpmds ds)
00187         /*@globals rpmGlobalMacroContext, h_errno @*/
00188         /*@modifies ds, rpmGlobalMacroContext @*/;
00189 
00197 /*@null@*/
00198 rpmds rpmdsThis(Header h, rpmTag tagN, int_32 Flags)
00199         /*@*/;
00200 
00209 /*@null@*/
00210 rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
00211         /*@*/;
00212 
00218 int rpmdsCount(/*@null@*/ const rpmds ds)
00219         /*@*/;
00220 
00226 int rpmdsIx(/*@null@*/ const rpmds ds)
00227         /*@*/;
00228 
00235 int rpmdsSetIx(/*@null@*/ rpmds ds, int ix)
00236         /*@modifies ds @*/;
00237 
00243 /*@observer@*/ /*@relnull@*/
00244 extern const char * rpmdsDNEVR(/*@null@*/ const rpmds ds)
00245         /*@*/;
00246 
00252 /*@observer@*/ /*@null@*/
00253 extern const char * rpmdsN(/*@null@*/ rpmds ds)
00254         /*@*/;
00255 
00261 /*@observer@*/ /*@relnull@*/
00262 extern const char * rpmdsEVR(/*@null@*/ const rpmds ds)
00263         /*@*/;
00264 
00270 int_32 rpmdsFlags(/*@null@*/ const rpmds ds)
00271         /*@*/;
00272 
00278 rpmTag rpmdsTagN(/*@null@*/ const rpmds ds)
00279         /*@*/;
00280 
00286 /*@observer@*/ /*@relnull@*/
00287 extern const char * rpmdsA(/*@null@*/ const rpmds ds)
00288         /*@*/;
00289 
00295 time_t rpmdsBT(/*@null@*/ const rpmds ds)
00296         /*@*/;
00297 
00304 time_t rpmdsSetBT(/*@null@*/ const rpmds ds, time_t BT)
00305         /*@modifies ds @*/;
00306 
00312 nsType rpmdsNSType(/*@null@*/ const rpmds ds)
00313         /*@*/;
00314 
00328 int rpmdsNoPromote(/*@null@*/ const rpmds ds)
00329         /*@*/;
00330 
00337 int rpmdsSetNoPromote(/*@null@*/ rpmds ds, int nopromote)
00338         /*@modifies ds @*/;
00339 
00346 /*@null@*/
00347 void * rpmdsSetEVRparse(/*@null@*/ rpmds ds,
00348                 /*@null@*/ int (*EVRparse)(const char *everstr, EVR_t evr))
00349         /*@modifies ds @*/;
00350 
00357 /*@null@*/
00358 void * rpmdsSetEVRcmp(/*@null@*/ rpmds ds,
00359                 /*@null@*/ int (*EVRcmp)(const char *a, const char *b))
00360         /*@modifies ds @*/;
00361 
00367 uint_32 rpmdsColor(/*@null@*/ const rpmds ds)
00368         /*@*/;
00369 
00376 uint_32 rpmdsSetColor(/*@null@*/ const rpmds ds, uint_32 color)
00377         /*@modifies ds @*/;
00378 
00384 int_32 rpmdsRefs(/*@null@*/ const rpmds ds)
00385         /*@*/;
00386 
00393 int_32 rpmdsSetRefs(/*@null@*/ const rpmds ds, int_32 refs)
00394         /*@modifies ds @*/;
00395 
00401 int_32 rpmdsResult(/*@null@*/ const rpmds ds)
00402         /*@*/;
00403 
00410 int_32 rpmdsSetResult(/*@null@*/ const rpmds ds, int_32 result)
00411         /*@modifies ds @*/;
00412 
00419 /*@-globuse@*/ /* FIX: rpmMessage annotation is a lie */
00420 void rpmdsNotify(/*@null@*/ rpmds ds, /*@null@*/ const char * where, int rc)
00421         /*@globals fileSystem @*/
00422         /*@modifies fileSystem @*/;
00423 /*@=globuse@*/
00424 
00430 int rpmdsNext(/*@null@*/ rpmds ds)
00431         /*@modifies ds @*/;
00432 
00438 /*@null@*/
00439 rpmds rpmdsInit(/*@null@*/ rpmds ds)
00440         /*@modifies ds @*/;
00441 
00448 int rpmdsFind(rpmds ds, /*@null@*/ const rpmds ods)
00449         /*@modifies ds @*/;
00450 
00457 int rpmdsMerge(/*@null@*/ /*@out@*/ rpmds * dsp, /*@null@*/ rpmds ods)
00458         /*@modifies *dsp, ods @*/;
00459 
00468 int rpmdsSearch(/*@null@*/ rpmds ds, /*@null@*/ rpmds ods)
00469         /*@modifies ds, ods @*/;
00470 
00477 int rpmdsCpuinfo(/*@out@*/ rpmds * dsp, /*@null@*/ const char * fn)
00478         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00479         /*@modifies *dsp, rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/;
00480 
00487 int rpmdsRpmlib(rpmds * dsp, /*@null@*/ void * tblp)
00488         /*@modifies *dsp @*/;
00489 
00496 int rpmdsSysinfo(rpmPRCO PRCO, /*@null@*/ const char * fn)
00497         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00498         /*@modifies PRCO, rpmGlobalMacroContext, h_errno,
00499                 fileSystem, internalState @*/;
00500 
00507 int rpmdsGetconf(rpmds * dsp, /*@null@*/ const char * path)
00508         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00509         /*@modifies *dsp, rpmGlobalMacroContext, h_errno,
00510                 fileSystem, internalState @*/;
00511 
00518 int rpmdsMergePRCO(void * context, rpmds ds)
00519         /*@modifies context, ds @*/;
00520 
00526 /*@null@*/
00527 rpmPRCO rpmdsFreePRCO(/*@only@*/ /*@null@*/ rpmPRCO PRCO)
00528         /*@modifies PRCO @*/;
00529 
00535 rpmPRCO rpmdsNewPRCO(/*@null@*/ Header h)
00536         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00537         /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
00538 
00545 /*@null@*/
00546 rpmds rpmdsFromPRCO(/*@null@*/ rpmPRCO PRCO, rpmTag tagN)
00547         /*@*/;
00548 
00557 int rpmdsELF(const char * fn, int flags,
00558                 int (*add) (void * context, rpmds ds), void * context)
00559         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00560         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
00561 #define RPMELF_FLAG_SKIPPROVIDES        0x1     /*<! rpmdsELF: skip provides */
00562 #define RPMELF_FLAG_SKIPREQUIRES        0x2     /*<! rpmdsELF: skip requires */
00563 
00571 int rpmdsLdconfig(rpmPRCO PRCO, /*@null@*/ const char * fn)
00572         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00573         /*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/;
00574 
00575 #if defined(__sun)
00576 
00585 int rpmdsRldpath(rpmPRCO PRCO, /*@null@*/ const char * rldp)
00586         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00587         /*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/;
00588 
00597 int rpmdsCrle(rpmPRCO PRCO, /*@null@*/ const char * fn)
00598         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00599         /*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/;
00600 #endif
00601 
00608 int rpmdsUname(rpmds * dsp, /*@null@*/ const struct utsname * un)
00609         /*@globals internalState @*/
00610         /*@modifies *dsp, internalState @*/;
00611 
00619 int rpmdsPipe(rpmds * dsp, int_32 tagN, /*@null@*/ const char * cmd)
00620         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00621         /*@modifies *dsp, rpmGlobalMacroContext, h_errno,
00622                 fileSystem, internalState @*/;
00623 
00630 int rpmdsCompare(const rpmds A, const rpmds B)
00631         /*@*/;
00632 
00641 void rpmdsProblem(/*@null@*/ rpmps ps, const char * pkgNEVR, const rpmds ds,
00642                 /*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys,
00643                 int adding)
00644         /*@modifies ps @*/;
00645 
00653 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
00654         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00655         /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
00656 
00664 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
00665         /*@*/;
00666 
00673 int rpmdsNegateRC(const rpmds ds, int rc)
00674         /*@*/;
00675 
00676 #if !defined(SWIG)
00677 
00682 /*@unused@*/ static inline /*@observer@*/
00683 const char * rpmdsTagName(/*@null@*/ const rpmds ds)
00684         /*@*/
00685 {
00686     int tagN = rpmdsTagN(ds);
00687 
00688     switch (tagN) {
00689     case RPMTAG_PROVIDENAME:    return "Provides";      /*@notreached@*/ break;
00690     case RPMTAG_REQUIRENAME:    return "Requires";      /*@notreached@*/ break;
00691     case RPMTAG_CONFLICTNAME:   return "Conflicts";     /*@notreached@*/ break;
00692     case RPMTAG_OBSOLETENAME:   return "Obsoletes";     /*@notreached@*/ break;
00693     case RPMTAG_TRIGGERNAME:    return "Triggers";      /*@notreached@*/ break;
00694     case RPMTAG_DIRNAMES:       return "Dirnames";      /*@notreached@*/ break;
00695     }
00696     return tagName(tagN);
00697 }
00698 
00705 /*@unused@*/ static inline
00706 int rpmdsPrint(/*@null@*/ rpmds ds, /*@null@*/ FILE * fp)
00707         /*@globals fileSystem @*/
00708         /*@modifies ds, *fp, fileSystem @*/
00709 {
00710     if (fp == NULL)
00711         fp = stderr;
00712     ds = rpmdsInit(ds);
00713     while (rpmdsNext(ds) >= 0)
00714         fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsTagName(ds), rpmdsDNEVR(ds)+2);
00715     return 0;
00716 }
00717 
00724 /*@unused@*/ static inline
00725 int rpmdsPrintResults(/*@null@*/ rpmds ds, /*@null@*/ FILE * fp)
00726         /*@globals fileSystem @*/
00727         /*@modifies ds, *fp, fileSystem @*/
00728 {
00729     if (fp == NULL)
00730         fp = stderr;
00731     ds = rpmdsInit(ds);
00732     while (rpmdsNext(ds) >= 0) {
00733         int rc = rpmdsResult(ds);
00734         if (rc > 0)
00735             continue;
00736         fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsTagName(ds), rpmdsDNEVR(ds)+2);
00737     }
00738     return 0;
00739 }
00740 
00748 /*@-mods@*/     /* XXX LCL wonky */
00749 /*@unused@*/ static inline
00750 int rpmdsPrintClosure(/*@null@*/ rpmds P, /*@null@*/ rpmds R,
00751                 /*@null@*/ FILE * fp)
00752         /*@globals fileSystem @*/
00753         /*@modifies P, R, *fp, fileSystem @*/
00754 {
00755     int rc;
00756 
00757     /* Allocate the R results array (to be filled in by rpmdsSearch). */
00758     (void) rpmdsSetResult(R, 0);        /* allocate result array. */
00759 
00760     /* Collect the rpmdsSearch results (in the R dependency set). */
00761     R = rpmdsInit(R);
00762     while (rpmdsNext(R) >= 0)
00763         rc = rpmdsSearch(P, R);
00764 
00765     return rpmdsPrintResults(R, fp);
00766 }
00767 /*@=mods@*/
00768 #endif
00769 
00771 #ifdef __cplusplus
00772 }
00773 #endif
00774 
00775 #endif  /* H_RPMDS */

Generated on Wed Dec 28 16:54:52 2016 for rpm by  doxygen 1.4.4