rpm 5.3.12
|
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 /*@unchecked@*/ /*@observer@*/ /*@owned@*/ /*@null@*/ 00024 extern const char *_sysinfo_path; 00025 00028 /*@-exportlocal@*/ 00029 /*@unchecked@*/ 00030 extern int _rpmds_nopromote; 00031 /*@=exportlocal@*/ 00032 00033 #if defined(_RPMDS_INTERNAL) 00034 #include <mire.h> 00035 00039 struct rpmds_s { 00040 struct rpmioItem_s _item; 00041 /*@observer@*/ 00042 const char * Type; 00043 /*@only@*/ /*@null@*/ 00044 const char * DNEVR; 00045 /*@refcounted@*/ /*@null@*/ 00046 Header h; 00047 /*@only@*/ /*@relnull@*/ 00048 const char ** N; 00049 /*@only@*/ /*@relnull@*/ 00050 const char ** EVR; 00051 /*@only@*/ /*@relnull@*/ 00052 evrFlags * Flags; 00053 /*@only@*/ /*@null@*/ 00054 rpmuint32_t * Color; 00055 /*@only@*/ /*@null@*/ 00056 rpmuint32_t * Refs; 00057 /*@only@*/ /*@null@*/ 00058 rpmint32_t * Result; 00059 /*@null@*/ 00060 int (*EVRparse) (const char *evrstr, EVR_t evr); /* EVR parsing. */ 00061 int (*EVRcmp) (const char *a, const char *b); /* EVR comparison. */ 00062 struct rpmns_s ns; 00063 /*@only@*/ /*@null@*/ 00064 miRE exclude; 00065 int nexclude; 00066 /*@only@*/ /*@null@*/ 00067 miRE include; 00068 int ninclude; 00069 /*@only@*/ /*@null@*/ 00070 const char * A; 00071 rpmuint32_t BT; 00072 rpmTag tagN; 00073 rpmuint32_t Count; 00074 int i; 00075 unsigned l; 00076 unsigned u; 00077 int nopromote; 00078 #if defined(__LCLINT__) 00079 /*@refs@*/ 00080 int nrefs; 00081 #endif 00082 }; 00083 #endif /* _RPMDS_INTERNAL */ 00084 00085 #if defined(_RPMPRCO_INTERNAL) 00086 00089 struct rpmPRCO_s { 00090 struct rpmioItem_s _item; 00091 /*@dependent@*/ /*@relnull@*/ 00092 rpmds * Pdsp; 00093 /*@dependent@*/ /*@relnull@*/ 00094 rpmds * Rdsp; 00095 /*@dependent@*/ /*@relnull@*/ 00096 rpmds * Cdsp; 00097 /*@dependent@*/ /*@relnull@*/ 00098 rpmds * Odsp; 00099 /*@dependent@*/ /*@relnull@*/ 00100 rpmds * Tdsp; 00101 /*@dependent@*/ /*@relnull@*/ 00102 rpmds * Ddsp; 00103 /*@dependent@*/ /*@relnull@*/ 00104 rpmds * Ldsp; 00105 /*@refcounted@*/ /*@null@*/ 00106 rpmds this; 00107 /*@refcounted@*/ /*@null@*/ 00108 rpmds P; 00109 /*@refcounted@*/ /*@null@*/ 00110 rpmds R; 00111 /*@refcounted@*/ /*@null@*/ 00112 rpmds C; 00113 /*@refcounted@*/ /*@null@*/ 00114 rpmds O; 00115 /*@refcounted@*/ /*@null@*/ 00116 rpmds T; 00117 /*@refcounted@*/ /*@null@*/ 00118 rpmds D; 00119 /*@refcounted@*/ /*@null@*/ 00120 rpmds L; 00121 #if defined(__LCLINT__) 00122 /*@refs@*/ 00123 int nrefs; 00124 #endif 00125 }; 00126 #endif /* _RPMPRCO_INTERNAL */ 00127 00128 #ifdef __cplusplus 00129 extern "C" { 00130 #endif 00131 00134 00141 /*@unused@*/ /*@null@*/ 00142 rpmds rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds, 00143 /*@null@*/ const char * msg) 00144 /*@modifies ds @*/; 00145 #define rpmdsUnlink(_ds, _msg) \ 00146 ((rpmds)rpmioUnlinkPoolItem((rpmioItem)(_ds), _msg, __FILE__, __LINE__)) 00147 00154 /*@unused@*/ /*@newref@*/ /*@null@*/ 00155 rpmds rpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg) 00156 /*@modifies ds @*/; 00157 #define rpmdsLink(_ds, _msg) \ 00158 ((rpmds)rpmioLinkPoolItem((rpmioItem)(_ds), _msg, __FILE__, __LINE__)) 00159 00165 /*@null@*/ 00166 rpmds rpmdsFree(/*@killref@*/ /*@null@*/ rpmds ds) 00167 /*@modifies ds @*/; 00168 #define rpmdsFree(_ds) \ 00169 ((rpmds)rpmioFreePoolItem((rpmioItem)(_ds), __FUNCTION__, __FILE__, __LINE__)) 00170 00178 /*@null@*/ 00179 rpmds rpmdsNew(Header h, rpmTag tagN, int flags) 00180 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00181 /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/; 00182 00188 /*@dependent@*/ /*@observer@*/ /*@null@*/ 00189 const char * rpmdsNewN(rpmds ds) 00190 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ 00191 /*@modifies ds, rpmGlobalMacroContext, internalState @*/; 00192 00199 char * rpmdsNewDNEVR(const char * dspfx, rpmds ds) 00200 /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ 00201 /*@modifies ds, rpmGlobalMacroContext, internalState @*/; 00202 00210 /*@null@*/ 00211 rpmds rpmdsThis(Header h, rpmTag tagN, evrFlags Flags) 00212 /*@globals internalState @*/ 00213 /*@modifies internalState @*/; 00214 00223 /*@null@*/ 00224 rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, evrFlags Flags) 00225 /*@*/; 00226 00232 int rpmdsCount(/*@null@*/ const rpmds ds) 00233 /*@*/; 00234 00240 int rpmdsIx(/*@null@*/ const rpmds ds) 00241 /*@*/; 00242 00249 int rpmdsSetIx(/*@null@*/ rpmds ds, int ix) 00250 /*@modifies ds @*/; 00251 00257 /*@observer@*/ /*@relnull@*/ 00258 extern const char * rpmdsDNEVR(/*@null@*/ const rpmds ds) 00259 /*@*/; 00260 00266 /*@observer@*/ /*@null@*/ 00267 extern const char * rpmdsN(/*@null@*/ rpmds ds) 00268 /*@globals internalState @*/ 00269 /*@modifies internalState @*/; 00270 00276 /*@observer@*/ /*@relnull@*/ 00277 extern const char * rpmdsEVR(/*@null@*/ const rpmds ds) 00278 /*@*/; 00279 00285 evrFlags rpmdsFlags(/*@null@*/ const rpmds ds) 00286 /*@*/; 00287 00293 rpmTag rpmdsTagN(/*@null@*/ const rpmds ds) 00294 /*@*/; 00295 00301 /*@observer@*/ /*@relnull@*/ 00302 extern const char * rpmdsA(/*@null@*/ const rpmds ds) 00303 /*@*/; 00304 00310 time_t rpmdsBT(/*@null@*/ const rpmds ds) 00311 /*@*/; 00312 00319 time_t rpmdsSetBT(/*@null@*/ const rpmds ds, time_t BT) 00320 /*@modifies ds @*/; 00321 00327 nsType rpmdsNSType(/*@null@*/ const rpmds ds) 00328 /*@*/; 00329 00343 int rpmdsNoPromote(/*@null@*/ const rpmds ds) 00344 /*@*/; 00345 00352 int rpmdsSetNoPromote(/*@null@*/ rpmds ds, int nopromote) 00353 /*@modifies ds @*/; 00354 00361 /*@null@*/ 00362 void * rpmdsSetEVRparse(/*@null@*/ rpmds ds, 00363 /*@null@*/ int (*EVRparse)(const char *everstr, EVR_t evr)) 00364 /*@modifies ds @*/; 00365 00372 /*@null@*/ 00373 void * rpmdsSetEVRcmp(/*@null@*/ rpmds ds, 00374 /*@null@*/ int (*EVRcmp)(const char *a, const char *b)) 00375 /*@modifies ds @*/; 00376 00382 rpmuint32_t rpmdsColor(/*@null@*/ const rpmds ds) 00383 /*@*/; 00384 00391 rpmuint32_t rpmdsSetColor(/*@null@*/ const rpmds ds, rpmuint32_t color) 00392 /*@modifies ds @*/; 00393 00399 /*@null@*/ 00400 void * rpmdsExclude(/*@null@*/ const rpmds ds) 00401 /*@*/; 00402 00408 int rpmdsNExclude(/*@null@*/ const rpmds ds) 00409 /*@*/; 00410 00416 /*@null@*/ 00417 void * rpmdsInclude(/*@null@*/ const rpmds ds) 00418 /*@*/; 00419 00425 int rpmdsNInclude(/*@null@*/ const rpmds ds) 00426 /*@*/; 00427 00433 rpmuint32_t rpmdsRefs(/*@null@*/ const rpmds ds) 00434 /*@*/; 00435 00442 rpmuint32_t rpmdsSetRefs(/*@null@*/ const rpmds ds, rpmuint32_t refs) 00443 /*@modifies ds @*/; 00444 00450 rpmint32_t rpmdsResult(/*@null@*/ const rpmds ds) 00451 /*@*/; 00452 00459 rpmint32_t rpmdsSetResult(/*@null@*/ const rpmds ds, rpmint32_t result) 00460 /*@modifies ds @*/; 00461 00468 /*@-globuse@*/ /* FIX: rpmMessage annotation is a lie */ 00469 void rpmdsNotify(/*@null@*/ rpmds ds, /*@null@*/ const char * where, int rc) 00470 /*@globals fileSystem @*/ 00471 /*@modifies fileSystem @*/; 00472 /*@=globuse@*/ 00473 00479 int rpmdsNext(/*@null@*/ rpmds ds) 00480 /*@modifies ds @*/; 00481 00487 /*@null@*/ 00488 rpmds rpmdsInit(/*@null@*/ rpmds ds) 00489 /*@modifies ds @*/; 00490 00497 int rpmdsFind(rpmds ds, /*@null@*/ const rpmds ods) 00498 /*@modifies ds @*/; 00499 00506 int rpmdsMerge(/*@null@*/ /*@out@*/ rpmds * dsp, /*@null@*/ rpmds ods) 00507 /*@modifies *dsp, ods @*/; 00508 00517 int rpmdsSearch(/*@null@*/ rpmds ds, /*@null@*/ rpmds ods) 00518 /*@modifies ds, ods @*/; 00519 00522 /*@unchecked@*/ /*@null@*/ 00523 extern const char * _cpuinfo_path; 00524 00531 int rpmdsCpuinfo(/*@out@*/ rpmds * dsp, /*@null@*/ const char * fn) 00532 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00533 /*@modifies *dsp, rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/; 00534 00541 int rpmdsRpmlib(rpmds * dsp, /*@null@*/ void * tblp) 00542 /*@modifies *dsp @*/; 00543 00550 int rpmdsSysinfo(rpmPRCO PRCO, /*@null@*/ const char * fn) 00551 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00552 /*@modifies PRCO, rpmGlobalMacroContext, h_errno, 00553 fileSystem, internalState @*/; 00554 00561 int rpmdsGetconf(rpmds * dsp, /*@null@*/ const char * path) 00562 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00563 /*@modifies *dsp, rpmGlobalMacroContext, h_errno, 00564 fileSystem, internalState @*/; 00565 00572 int rpmdsMergePRCO(void * context, rpmds ds) 00573 /*@modifies context, ds @*/; 00574 00580 /*@null@*/ 00581 rpmPRCO rpmdsFreePRCO(/*@only@*/ /*@null@*/ rpmPRCO PRCO) 00582 /*@modifies PRCO @*/; 00583 00589 rpmPRCO rpmdsNewPRCO(/*@null@*/ Header h) 00590 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00591 /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/; 00592 00599 /*@null@*/ 00600 rpmds rpmdsFromPRCO(/*@null@*/ rpmPRCO PRCO, rpmTag tagN) 00601 /*@*/; 00602 00611 int rpmdsELF(const char * fn, int flags, 00612 int (*add) (void * context, rpmds ds), void * context) 00613 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00614 /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/; 00615 #define RPMELF_FLAG_SKIPPROVIDES 0x1 /*<! rpmdsELF: skip provides */ 00616 #define RPMELF_FLAG_SKIPREQUIRES 0x2 /*<! rpmdsELF: skip requires */ 00617 00625 int rpmdsLdconfig(rpmPRCO PRCO, /*@null@*/ const char * fn) 00626 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00627 /*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/; 00628 00629 #if defined(__sun) 00630 00639 int rpmdsRldpath(rpmPRCO PRCO, /*@null@*/ const char * rldp) 00640 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00641 /*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/; 00642 00651 int rpmdsCrle(rpmPRCO PRCO, /*@null@*/ const char * fn) 00652 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00653 /*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/; 00654 #endif 00655 00662 struct utsname; 00663 int rpmdsUname(rpmds * dsp, /*@null@*/ const struct utsname * un) 00664 /*@globals internalState @*/ 00665 /*@modifies *dsp, internalState @*/; 00666 00674 int rpmdsPipe(rpmds * dsp, rpmTag tagN, /*@null@*/ const char * cmd) 00675 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00676 /*@modifies *dsp, rpmGlobalMacroContext, h_errno, 00677 fileSystem, internalState @*/; 00678 00685 int rpmdsCompare(const rpmds A, const rpmds B) 00686 /*@*/; 00687 00694 int rpmdsMatch(const rpmds A, rpmds B) 00695 /*@modifies B @*/; 00696 00705 void rpmdsProblem(/*@null@*/ rpmps ps, const char * pkgNEVR, const rpmds ds, 00706 /*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys, 00707 int adding) 00708 /*@globals internalState @*/ 00709 /*@modifies ps, internalState @*/; 00710 00718 int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote) 00719 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00720 /*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/; 00721 00729 int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote) 00730 /*@globals internalState @*/ 00731 /*@modifies internalState @*/; 00732 00739 int rpmdsNegateRC(const rpmds ds, int rc) 00740 /*@*/; 00741 00747 /*@observer@*/ 00748 const char * rpmdsType(/*@null@*/ const rpmds ds) 00749 /*@*/; 00750 00751 #if !defined(SWIG) 00752 00758 /*@unused@*/ static inline 00759 int rpmdsPrint(/*@null@*/ rpmds ds, /*@null@*/ FILE * fp) 00760 /*@globals fileSystem @*/ 00761 /*@modifies ds, *fp, fileSystem @*/ 00762 { 00763 if (fp == NULL) 00764 fp = stderr; 00765 ds = rpmdsInit(ds); 00766 while (rpmdsNext(ds) >= 0) 00767 fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsType(ds), rpmdsDNEVR(ds)+2); 00768 return 0; 00769 } 00770 00777 /*@unused@*/ static inline 00778 int rpmdsPrintResults(/*@null@*/ rpmds ds, /*@null@*/ FILE * fp) 00779 /*@globals fileSystem @*/ 00780 /*@modifies ds, *fp, fileSystem @*/ 00781 { 00782 if (fp == NULL) 00783 fp = stderr; 00784 ds = rpmdsInit(ds); 00785 while (rpmdsNext(ds) >= 0) { 00786 rpmint32_t rc = rpmdsResult(ds); 00787 if (rc > 0) 00788 continue; 00789 fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsType(ds), rpmdsDNEVR(ds)+2); 00790 } 00791 return 0; 00792 } 00793 00801 /*@-mods@*/ /* XXX LCL wonky */ 00802 /*@unused@*/ static inline 00803 int rpmdsPrintClosure(/*@null@*/ rpmds P, /*@null@*/ rpmds R, 00804 /*@null@*/ FILE * fp) 00805 /*@globals fileSystem @*/ 00806 /*@modifies P, R, *fp, fileSystem @*/ 00807 { 00808 int rc; 00809 00810 /* Allocate the R results array (to be filled in by rpmdsSearch). */ 00811 (void) rpmdsSetResult(R, 0); /* allocate result array. */ 00812 00813 /* Collect the rpmdsSearch results (in the R dependency set). */ 00814 R = rpmdsInit(R); 00815 while (rpmdsNext(R) >= 0) 00816 rc = rpmdsSearch(P, R); 00817 00818 return rpmdsPrintResults(R, fp); 00819 } 00820 /*@=mods@*/ 00821 #endif 00822 00824 #ifdef __cplusplus 00825 } 00826 #endif 00827 00828 #endif /* H_RPMDS */