rpm 5.3.7
|
00001 #ifndef H_RPMTE 00002 #define H_RPMTE 00003 00008 #include <rpmfi.h> 00009 00012 /*@-exportlocal@*/ 00013 /*@unchecked@*/ 00014 extern int _rpmte_debug; 00015 /*@=exportlocal@*/ 00016 00020 typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo; 00021 00025 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmtsi_s *rpmtsi; 00026 00030 typedef enum rpmElementType_e { 00031 TR_ADDED = (1 << 0), 00032 TR_REMOVED = (1 << 1) 00033 } rpmElementType; 00034 00035 #if defined(_RPMTE_INTERNAL) 00036 #include <argv.h> 00037 #include <rpmtxn.h> 00038 #include <rpmal.h> 00039 00040 typedef struct relation_s * relation; 00041 00042 #if defined(_RPMTS_ORDER_INTERNAL) 00043 struct relation_s { 00044 rpmte rel_suc; // pkg requiring this package 00045 rpmsenseFlags rel_flags; // accumulated flags of the requirements 00046 struct relation_s * rel_next; 00047 }; 00048 #endif 00049 00053 /*@-fielduse@*/ /* LCL: confused by union? */ 00054 struct tsortInfo_s { 00055 /*@owned@*/ /*@null@*/ 00056 tsortInfo tsi_next; 00057 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00058 rpmte tsi_chain; 00059 int tsi_tagn; 00060 int tsi_queued; 00061 00062 int tsi_count; 00063 int tsi_qcnt; 00064 int tsi_reqx; 00065 relation tsi_relations; 00066 relation tsi_forward_relations; 00067 rpmte tsi_suc; 00068 int tsi_SccIdx; 00069 int tsi_SccLowlink; 00070 }; 00071 /*@=fielduse@*/ 00072 00076 struct rpmChainLink_s { 00077 /*@only@*/ /*@null@*/ 00078 ARGV_t Pkgid; 00079 /*@only@*/ /*@null@*/ 00080 ARGV_t Hdrid; 00081 /*@only@*/ /*@null@*/ 00082 ARGV_t NEVRA; 00083 }; 00084 00087 typedef struct sharedFileInfo_s * sharedFileInfo; 00088 00092 struct sharedFileInfo_s { 00093 rpmuint32_t pkgFileNum; 00094 rpmuint32_t otherFileNum; 00095 rpmuint32_t otherPkg; 00096 rpmuint32_t isRemoved; 00097 }; 00098 00102 struct rpmte_s { 00103 struct rpmioItem_s _item; 00104 rpmElementType type; 00106 /*@refcounted@*/ /*@relnull@*/ 00107 Header h; 00108 /*@only@*/ 00109 const char * NEVR; 00110 /*@only@*/ 00111 const char * NEVRA; 00112 /*@only@*/ /*@relnull@*/ 00113 const char * pkgid; 00114 /*@only@*/ /*@relnull@*/ 00115 const char * hdrid; 00116 /*@only@*/ /*@null@*/ 00117 const char * sourcerpm; 00118 /*@only@*/ 00119 const char * name; 00120 /*@only@*/ /*@null@*/ 00121 char * epoch; 00122 /*@only@*/ /*@null@*/ 00123 char * version; 00124 /*@only@*/ /*@null@*/ 00125 char * release; 00126 #ifdef RPM_VENDOR_MANDRIVA 00127 /*@only@*/ /*@null@*/ 00128 char * distepoch; 00129 #endif 00130 /*@only@*/ /*@null@*/ 00131 const char * arch; 00132 /*@only@*/ /*@null@*/ 00133 const char * os; 00134 int isSource; 00136 rpmte parent; 00137 int degree; 00138 int npreds; 00139 int tree; 00140 int depth; 00141 int breadth; 00142 uint32_t db_instance; 00143 /*@owned@*/ 00144 tsortInfo tsi; 00146 /*@null@*/ 00147 rpmPRCO PRCO; 00149 /*@null@*/ 00150 rpmtxn txn; 00151 /*@refcounted@*/ /*@null@*/ 00152 rpmfi fi; 00153 #ifdef REFERENCE 00154 rpmpol pol; 00155 #endif 00156 00157 rpmuint32_t depFlags; 00158 rpmuint32_t transFlags; 00159 rpmuint32_t color; 00160 rpmuint32_t pkgFileSize; 00162 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00163 fnpyKey key; 00164 /*@owned@*/ /*@null@*/ 00165 rpmRelocation relocs; 00166 int nrelocs; 00167 int autorelocatex; 00168 /*@refcounted@*/ /*@null@*/ 00169 FD_t fd; 00171 /*@owned@*/ /*@null@*/ 00172 sharedFileInfo replaced; 00173 int nreplaced; 00175 struct rpmChainLink_s blink; 00176 struct rpmChainLink_s flink; 00177 int linkFailed; 00178 int done; 00179 rpmuint32_t originTid[2]; 00180 rpmuint32_t originTime[2]; 00182 int installed; 00183 int downgrade; 00185 struct { 00186 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00187 alKey addedKey; 00188 struct { 00189 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00190 alKey dependsOnKey; 00191 uint32_t dboffset; 00192 } removed; 00193 } u; 00194 #if defined(__LCLINT__) 00195 /*@refs@*/ 00196 int nrefs; 00197 #endif 00198 }; 00199 00203 struct rpmtsi_s { 00204 struct rpmioItem_s _item; 00205 /*@refcounted@*/ 00206 rpmts ts; 00207 int reverse; 00208 int ocsave; 00209 int oc; 00210 #if defined(__LCLINT__) 00211 /*@refs@*/ 00212 int nrefs; 00213 #endif 00214 }; 00215 00216 int rpmteClose(rpmte te, rpmts ts, int reset_fi) 00217 /*@modifies te, ts @*/; 00218 Header rpmteDBHeader(rpmts ts, uint32_t rec) 00219 /*@modifies ts @*/; 00220 Header rpmteFDHeader(rpmts ts, rpmte te) 00221 /*@modifies ts, te @*/; 00222 int rpmteOpen(rpmte te, rpmts ts, int reload_fi) 00223 /*@modifies te, ts @*/; 00224 00230 int rpmteFailed(rpmte te) 00231 /*@*/; 00232 00233 int rpmteHaveTransScript(rpmte te, rpmTag tag) 00234 /*@*/; 00235 00236 #endif /* _RPMTE_INTERNAL */ 00237 00238 #ifdef __cplusplus 00239 extern "C" { 00240 #endif 00241 00247 /*@unused@*/ /*@null@*/ 00248 rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te) 00249 /*@globals fileSystem @*/ 00250 /*@modifies te, fileSystem @*/; 00251 #define rpmteFree(_te) \ 00252 ((rpmte) rpmioFreePoolItem((rpmioItem)(_te), __FUNCTION__, __FILE__, __LINE__)) 00253 00265 /*@only@*/ /*@null@*/ 00266 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type, 00267 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key, 00268 /*@null@*/ rpmRelocation relocs, 00269 uint32_t dboffset, 00270 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey) 00271 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00272 /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/; 00273 00279 extern Header rpmteHeader(rpmte te) 00280 /*@modifies te @*/; 00281 00288 extern Header rpmteSetHeader(rpmte te, Header h) 00289 /*@modifies te, h @*/; 00290 00296 rpmElementType rpmteType(rpmte te) 00297 /*@*/; 00298 00304 /*@observer@*/ 00305 extern const char * rpmteN(rpmte te) 00306 /*@*/; 00307 00313 /*@observer@*/ /*@null@*/ 00314 extern const char * rpmteE(rpmte te) 00315 /*@*/; 00316 00322 /*@observer@*/ /*@null@*/ 00323 extern const char * rpmteV(rpmte te) 00324 /*@*/; 00325 00331 /*@observer@*/ /*@null@*/ 00332 extern const char * rpmteR(rpmte te) 00333 /*@*/; 00334 00340 /*@observer@*/ /*@null@*/ 00341 extern const char * rpmteD(rpmte te) 00342 /*@*/; 00343 00349 /*@observer@*/ /*@null@*/ 00350 extern const char * rpmteA(rpmte te) 00351 /*@*/; 00352 00358 /*@observer@*/ /*@null@*/ 00359 extern const char * rpmteO(rpmte te) 00360 /*@*/; 00361 00367 extern int rpmteIsSource(rpmte te) 00368 /*@*/; 00369 00375 rpmuint32_t rpmteColor(rpmte te) 00376 /*@*/; 00377 00384 rpmuint32_t rpmteSetColor(rpmte te, rpmuint32_t color) 00385 /*@modifies te @*/; 00386 00392 uint32_t rpmteDBInstance(rpmte te) 00393 /*@*/; 00394 00401 void rpmteSetDBInstance(rpmte te, unsigned int instance) 00402 /*@modifies te @*/; 00403 00410 rpmuint32_t rpmtePkgFileSize(rpmte te) 00411 /*@*/; 00412 00418 /*@observer@*/ 00419 rpmuint32_t * rpmteOriginTid(rpmte te) 00420 /*@*/; 00421 00427 /*@observer@*/ 00428 rpmuint32_t * rpmteOriginTime(rpmte te) 00429 /*@*/; 00430 00436 int rpmteDepth(rpmte te) 00437 /*@*/; 00438 00445 int rpmteSetDepth(rpmte te, int ndepth) 00446 /*@modifies te @*/; 00447 00453 int rpmteBreadth(rpmte te) 00454 /*@*/; 00455 00462 int rpmteSetBreadth(rpmte te, int nbreadth) 00463 /*@modifies te @*/; 00464 00470 int rpmteNpreds(rpmte te) 00471 /*@*/; 00472 00479 int rpmteSetNpreds(rpmte te, int npreds) 00480 /*@modifies te @*/; 00481 00487 int rpmteTree(rpmte te) 00488 /*@*/; 00489 00496 int rpmteSetTree(rpmte te, int ntree) 00497 /*@modifies te @*/; 00498 00504 /*@observer@*/ /*@unused@*/ 00505 rpmte rpmteParent(rpmte te) 00506 /*@*/; 00507 00514 /*@null@*/ 00515 rpmte rpmteSetParent(rpmte te, rpmte pte) 00516 /*@modifies te @*/; 00517 00523 int rpmteDegree(rpmte te) 00524 /*@*/; 00525 00532 int rpmteSetDegree(rpmte te, int ndegree) 00533 /*@modifies te @*/; 00534 00540 tsortInfo rpmteTSI(rpmte te) 00541 /*@*/; 00542 00547 void rpmteFreeTSI(rpmte te) 00548 /*@modifies te @*/; 00549 00554 void rpmteNewTSI(rpmte te) 00555 /*@modifies te @*/; 00556 00561 /*@unused@*/ 00562 void rpmteCleanDS(rpmte te) 00563 /*@modifies te @*/; 00564 00565 #if defined(_RPMTE_INTERNAL) 00566 00571 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00572 alKey rpmteAddedKey(rpmte te) 00573 /*@*/; 00574 00581 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00582 alKey rpmteSetAddedKey(rpmte te, 00583 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey) 00584 /*@modifies te @*/; 00585 #endif /* _RPMTE_INTERNAL */ 00586 00592 int rpmteDBOffset(rpmte te) 00593 /*@*/; 00594 00600 /*@observer@*/ 00601 extern const char * rpmteNEVR(rpmte te) 00602 /*@*/; 00603 00609 /*@-exportlocal@*/ 00610 /*@observer@*/ 00611 extern const char * rpmteNEVRA(rpmte te) 00612 /*@*/; 00613 /*@=exportlocal@*/ 00614 00620 /*@-exportlocal@*/ 00621 /*@observer@*/ /*@null@*/ 00622 extern const char * rpmtePkgid(rpmte te) 00623 /*@*/; 00624 /*@=exportlocal@*/ 00625 00631 /*@-exportlocal@*/ 00632 /*@observer@*/ /*@null@*/ 00633 extern const char * rpmteHdrid(rpmte te) 00634 /*@*/; 00635 /*@=exportlocal@*/ 00636 00642 /*@-exportlocal@*/ 00643 /*@observer@*/ /*@null@*/ 00644 extern const char * rpmteSourcerpm(rpmte te) 00645 /*@*/; 00646 /*@=exportlocal@*/ 00647 00653 FD_t rpmteFd(rpmte te) 00654 /*@*/; 00655 00661 /*@exposed@*/ 00662 fnpyKey rpmteKey(rpmte te) 00663 /*@*/; 00664 00671 rpmds rpmteDS(rpmte te, rpmTag tag) 00672 /*@*/; 00673 00680 rpmfi rpmteFI(rpmte te, rpmTag tag) 00681 /*@*/; 00682 /*@null@*/ 00683 rpmfi rpmteSetFI(rpmte te, rpmfi fi) 00684 /*@modifies te, fi @*/; 00685 00691 /*@-exportlocal@*/ 00692 void rpmteColorDS(rpmte te, rpmTag tag) 00693 /*@modifies te @*/; 00694 /*@=exportlocal@*/ 00695 00704 int rpmteChain(rpmte p, rpmte q, Header oh, /*@null@*/ const char * msg) 00705 /*@globals internalState @*/ 00706 /*@modifies p, q, oh, internalState @*/; 00707 00708 #define RPMTE_CHAIN_END "CHAIN END" 00715 int rpmtsiOc(rpmtsi tsi) 00716 /*@*/; 00717 00723 /*@unused@*/ /*@null@*/ 00724 rpmtsi rpmtsiFree(/*@killref@*//*@null@*/ rpmtsi tsi) 00725 /*@globals fileSystem @*/ 00726 /*@modifies fileSystem @*/; 00727 #define rpmtsiFree(_tsi) \ 00728 ((rpmtsi)rpmioFreePoolItem((rpmioItem)(_tsi), __FUNCTION__, __FILE__, __LINE__)) 00729 00735 /*@unused@*/ /*@only@*/ 00736 rpmtsi rpmtsiInit(rpmts ts) 00737 /*@modifies ts @*/; 00738 00746 /*@unused@*/ /*@only@*/ 00747 rpmtsi XrpmtsiInit(rpmts ts, 00748 const char * fn, unsigned int ln) 00749 /*@modifies ts @*/; 00750 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__) 00751 00758 /*@dependent@*/ /*@null@*/ 00759 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type) 00760 /*@modifies tsi @*/; 00761 00762 #if defined(DYING) 00763 #if !defined(SWIG) 00764 00766 static inline void rpmtePrintID(rpmte p) 00767 /*@globals fileSystem @*/ 00768 /*@modifies fileSystem @*/ 00769 { 00770 if (p != NULL) { 00771 if (p->blink.Pkgid) argvPrint("blink.Pkgid", p->blink.Pkgid, NULL); 00772 if (p->blink.Hdrid) argvPrint("blink.Hdrid", p->blink.Hdrid, NULL); 00773 if (p->blink.NEVRA) argvPrint("blink.NEVRA", p->blink.NEVRA, NULL); 00774 if (p->flink.Pkgid) argvPrint("flink.Pkgid", p->flink.Pkgid, NULL); 00775 if (p->flink.Hdrid) argvPrint("flink.Hdrid", p->flink.Hdrid, NULL); 00776 if (p->flink.NEVRA) argvPrint("flink.NEVRA", p->flink.NEVRA, NULL); 00777 } 00778 }; 00779 00782 static inline void hdrPrintInstalled(Header h) 00783 /*@globals fileSystem @*/ 00784 /*@modifies h, fileSystem @*/ 00785 { 00786 const char * qfmt = "[%{erasednevra} O:%{packageorigin} P:%{erasedpkgid} H:%{erasedhdrid}\n]"; 00787 const char * errstr = "(unknown error)"; 00788 /*@-modobserver@*/ 00789 const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr); 00790 /*@=modobserver@*/ 00791 00792 if (str == NULL) 00793 fprintf(stderr, "error: %s\n", errstr); 00794 else { 00795 fprintf(stderr, "%s", str); 00796 str = _free(str); 00797 } 00798 } 00799 00802 static inline void hdrPrintErased(Header h) 00803 /*@globals fileSystem @*/ 00804 /*@modifies h, fileSystem @*/ 00805 { 00806 const char * qfmt = "[%{installednevra} O:%{packageorigin} P:%{installedpkgid} H:%{installedhdrid}\n]"; 00807 const char * errstr = "(unknown error)"; 00808 /*@-modobserver@*/ 00809 const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr); 00810 /*@=modobserver@*/ 00811 if (str == NULL) 00812 fprintf(stderr, "error: %s\n", errstr); 00813 else { 00814 fprintf(stderr, "%s", str); 00815 str = _free(str); 00816 } 00817 } 00818 #endif 00819 #endif 00820 00821 #ifdef REFERENCE 00822 00825 typedef struct rpmfs_s * rpmfs; 00826 00829 struct sharedFileInfo_s { 00830 int pkgFileNum; 00831 int otherPkg; 00832 int otherFileNum; 00833 }; 00834 00835 typedef char rpm_fstate_t; 00836 00837 struct rpmfs_s { 00838 unsigned int fc; 00839 00840 rpm_fstate_t * states; 00841 rpmFileAction * actions; 00843 sharedFileInfo replaced; 00844 int numReplaced; 00845 int allocatedReplaced; 00846 }; 00847 00848 int rpmteMarkFailed(rpmte te, rpmts ts); 00849 00850 rpmps rpmteProblems(rpmte te); 00851 rpmfs rpmteGetFileStates(rpmte te); 00852 rpmfs rpmfsNew(unsigned int fc, rpmElementType type); 00853 rpmfs rpmfsFree(rpmfs fs); 00854 rpm_count_t rpmfsFC(rpmfs fs); 00855 void rpmfsAddReplaced(rpmfs fs, int pkgFileNum, int otherPkg, int otherFileNum); 00856 sharedFileInfo rpmfsGetReplaced(rpmfs fs); 00857 sharedFileInfo rpmfsNextReplaced(rpmfs fs , sharedFileInfo replaced); 00858 void rpmfsSetState(rpmfs fs, unsigned int ix, rpmfileState state); 00859 rpmfileState rpmfsGetState(rpmfs fs, unsigned int ix); 00860 /*@null@*/ 00861 rpm_fstate_t * rpmfsGetStates(rpmfs fs); 00862 void rpmfsSetAction(rpmfs fs, unsigned int ix, rpmFileAction action); 00863 #endif /* REFERENCE */ 00864 00865 #ifdef __cplusplus 00866 } 00867 #endif 00868 00869 #endif /* H_RPMTE */