rpm
4.5
|
00001 #ifndef H_RPMTE 00002 #define H_RPMTE 00003 00008 #include <argv.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@*/ 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 00039 /*@-fielduse@*/ /* LCL: confused by union? */ 00040 struct tsortInfo_s { 00041 union { 00042 int count; 00043 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00044 rpmte suc; 00045 } tsi_u; 00046 #define tsi_count tsi_u.count 00047 #define tsi_suc tsi_u.suc 00048 /*@owned@*/ /*@null@*/ 00049 tsortInfo tsi_next; 00050 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00051 rpmte tsi_chain; 00052 int tsi_tagn; 00053 int tsi_reqx; 00054 int tsi_queued; 00055 int tsi_qcnt; 00056 }; 00057 /*@=fielduse@*/ 00058 00062 struct rpmChainLink_s { 00063 /*@only@*/ /*@null@*/ 00064 ARGV_t Pkgid; 00065 /*@only@*/ /*@null@*/ 00066 ARGV_t Hdrid; 00067 /*@only@*/ /*@null@*/ 00068 ARGV_t NEVRA; 00069 }; 00070 00074 struct rpmte_s { 00075 rpmElementType type; 00077 /*@refcounted@*/ /*@relnull@*/ 00078 Header h; 00079 /*@only@*/ 00080 const char * NEVR; 00081 /*@only@*/ 00082 const char * NEVRA; 00083 /*@only@*/ /*@relnull@*/ 00084 const char * pkgid; 00085 /*@only@*/ /*@relnull@*/ 00086 const char * hdrid; 00087 /*@owned@*/ 00088 const char * name; 00089 /*@only@*/ /*@null@*/ 00090 char * epoch; 00091 /*@dependent@*/ /*@null@*/ 00092 char * version; 00093 /*@dependent@*/ /*@null@*/ 00094 char * release; 00095 /*@only@*/ /*@null@*/ 00096 const char * arch; 00097 /*@only@*/ /*@null@*/ 00098 const char * os; 00099 int isSource; 00101 rpmte parent; 00102 int degree; 00103 int npreds; 00104 int tree; 00105 int depth; 00106 int breadth; 00107 unsigned int db_instance; 00108 /*@owned@*/ 00109 tsortInfo tsi; 00111 /*@null@*/ 00112 rpmPRCO PRCO; 00114 /*@refcounted@*/ /*@null@*/ 00115 rpmfi fi; 00117 uint_32 color; 00118 uint_32 pkgFileSize; 00120 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00121 fnpyKey key; 00122 /*@owned@*/ /*@null@*/ 00123 rpmRelocation relocs; 00124 int nrelocs; 00125 int autorelocatex; 00126 /*@refcounted@*/ /*@null@*/ 00127 FD_t fd; 00129 struct rpmChainLink_s blink; 00130 struct rpmChainLink_s flink; 00131 int linkFailed; 00132 int done; 00134 int installed; 00135 int downgrade; 00137 struct { 00138 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00139 alKey addedKey; 00140 struct { 00141 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00142 alKey dependsOnKey; 00143 int dboffset; 00144 } removed; 00145 } u; 00146 00147 }; 00148 00152 struct rpmtsi_s { 00153 /*@refcounted@*/ 00154 rpmts ts; 00155 int reverse; 00156 int ocsave; 00157 int oc; 00158 }; 00159 00160 #endif /* _RPMTE_INTERNAL */ 00161 00162 #ifdef __cplusplus 00163 extern "C" { 00164 #endif 00165 00171 /*@null@*/ 00172 rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te) 00173 /*@globals fileSystem @*/ 00174 /*@modifies te, fileSystem @*/; 00175 00187 /*@only@*/ /*@null@*/ 00188 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type, 00189 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key, 00190 /*@null@*/ rpmRelocation relocs, 00191 int dboffset, 00192 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey) 00193 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00194 /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/; 00195 00201 extern Header rpmteHeader(rpmte te) 00202 /*@modifies te @*/; 00203 00210 extern Header rpmteSetHeader(rpmte te, Header h) 00211 /*@modifies te, h @*/; 00212 00218 rpmElementType rpmteType(rpmte te) 00219 /*@*/; 00220 00226 /*@observer@*/ 00227 extern const char * rpmteN(rpmte te) 00228 /*@*/; 00229 00235 /*@observer@*/ /*@null@*/ 00236 extern const char * rpmteE(rpmte te) 00237 /*@*/; 00238 00244 /*@observer@*/ /*@null@*/ 00245 extern const char * rpmteV(rpmte te) 00246 /*@*/; 00247 00253 /*@observer@*/ /*@null@*/ 00254 extern const char * rpmteR(rpmte te) 00255 /*@*/; 00256 00262 /*@observer@*/ /*@null@*/ 00263 extern const char * rpmteA(rpmte te) 00264 /*@*/; 00265 00271 /*@observer@*/ /*@null@*/ 00272 extern const char * rpmteO(rpmte te) 00273 /*@*/; 00274 00280 extern int rpmteIsSource(rpmte te) 00281 /*@*/; 00282 00288 uint_32 rpmteColor(rpmte te) 00289 /*@*/; 00290 00297 uint_32 rpmteSetColor(rpmte te, uint_32 color) 00298 /*@modifies te @*/; 00299 00305 unsigned int rpmteDBInstance(rpmte te) 00306 /*@*/; 00307 00314 void rpmteSetDBInstance(rpmte te, unsigned int instance) 00315 /*@modifies te @*/; 00316 00323 uint_32 rpmtePkgFileSize(rpmte te) 00324 /*@*/; 00325 00331 int rpmteDepth(rpmte te) 00332 /*@*/; 00333 00340 int rpmteSetDepth(rpmte te, int ndepth) 00341 /*@modifies te @*/; 00342 00348 int rpmteBreadth(rpmte te) 00349 /*@*/; 00350 00357 int rpmteSetBreadth(rpmte te, int nbreadth) 00358 /*@modifies te @*/; 00359 00365 int rpmteNpreds(rpmte te) 00366 /*@*/; 00367 00374 int rpmteSetNpreds(rpmte te, int npreds) 00375 /*@modifies te @*/; 00376 00382 int rpmteTree(rpmte te) 00383 /*@*/; 00384 00391 int rpmteSetTree(rpmte te, int ntree) 00392 /*@modifies te @*/; 00393 00399 /*@observer@*/ /*@unused@*/ 00400 rpmte rpmteParent(rpmte te) 00401 /*@*/; 00402 00409 /*@null@*/ 00410 rpmte rpmteSetParent(rpmte te, rpmte pte) 00411 /*@modifies te @*/; 00412 00418 int rpmteDegree(rpmte te) 00419 /*@*/; 00420 00427 int rpmteSetDegree(rpmte te, int ndegree) 00428 /*@modifies te @*/; 00429 00435 tsortInfo rpmteTSI(rpmte te) 00436 /*@*/; 00437 00442 void rpmteFreeTSI(rpmte te) 00443 /*@modifies te @*/; 00444 00449 void rpmteNewTSI(rpmte te) 00450 /*@modifies te @*/; 00451 00456 /*@unused@*/ 00457 void rpmteCleanDS(rpmte te) 00458 /*@modifies te @*/; 00459 00465 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00466 alKey rpmteAddedKey(rpmte te) 00467 /*@*/; 00468 00475 /*@exposed@*/ /*@dependent@*/ /*@null@*/ 00476 alKey rpmteSetAddedKey(rpmte te, 00477 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey) 00478 /*@modifies te @*/; 00479 00485 int rpmteDBOffset(rpmte te) 00486 /*@*/; 00487 00493 /*@observer@*/ 00494 extern const char * rpmteNEVR(rpmte te) 00495 /*@*/; 00496 00502 /*@-exportlocal@*/ 00503 /*@observer@*/ 00504 extern const char * rpmteNEVRA(rpmte te) 00505 /*@*/; 00506 /*@=exportlocal@*/ 00507 00513 /*@-exportlocal@*/ 00514 /*@observer@*/ /*@null@*/ 00515 extern const char * rpmtePkgid(rpmte te) 00516 /*@*/; 00517 /*@=exportlocal@*/ 00518 00524 /*@-exportlocal@*/ 00525 /*@observer@*/ /*@null@*/ 00526 extern const char * rpmteHdrid(rpmte te) 00527 /*@*/; 00528 /*@=exportlocal@*/ 00529 00535 FD_t rpmteFd(rpmte te) 00536 /*@*/; 00537 00543 /*@exposed@*/ 00544 fnpyKey rpmteKey(rpmte te) 00545 /*@*/; 00546 00553 rpmds rpmteDS(rpmte te, rpmTag tag) 00554 /*@*/; 00555 00562 rpmfi rpmteFI(rpmte te, rpmTag tag) 00563 /*@*/; 00564 00570 /*@-exportlocal@*/ 00571 void rpmteColorDS(rpmte te, rpmTag tag) 00572 /*@modifies te @*/; 00573 /*@=exportlocal@*/ 00574 00583 int rpmteChain(rpmte p, rpmte q, Header oh, /*@null@*/ const char * msg) 00584 /*@modifies p, q, oh @*/; 00585 00586 #define RPMTE_CHAIN_END "CHAIN END" 00593 int rpmtsiOc(rpmtsi tsi) 00594 /*@*/; 00595 00601 /*@unused@*/ /*@null@*/ 00602 rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi) 00603 /*@globals fileSystem @*/ 00604 /*@modifies fileSystem @*/; 00605 00613 /*@null@*/ 00614 rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi, 00615 const char * fn, unsigned int ln) 00616 /*@globals fileSystem @*/ 00617 /*@modifies fileSystem @*/; 00618 #define rpmtsiFree(_tsi) XrpmtsiFree(_tsi, __FILE__, __LINE__) 00619 00625 /*@unused@*/ /*@only@*/ 00626 rpmtsi rpmtsiInit(rpmts ts) 00627 /*@modifies ts @*/; 00628 00636 /*@unused@*/ /*@only@*/ 00637 rpmtsi XrpmtsiInit(rpmts ts, 00638 const char * fn, unsigned int ln) 00639 /*@modifies ts @*/; 00640 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__) 00641 00648 /*@dependent@*/ /*@null@*/ 00649 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type) 00650 /*@modifies tsi @*/; 00651 00652 #if !defined(SWIG) 00653 #if defined(_RPMTE_INTERNAL) 00654 static inline void rpmtePrintID(rpmte p) 00655 /*@globals fileSystem @*/ 00656 /*@modifies fileSystem @*/ 00657 { 00658 if (p != NULL) { 00659 if (p->blink.Pkgid) argvPrint("blink.Pkgid", p->blink.Pkgid, NULL); 00660 if (p->blink.Hdrid) argvPrint("blink.Hdrid", p->blink.Hdrid, NULL); 00661 if (p->blink.NEVRA) argvPrint("blink.NEVRA", p->blink.NEVRA, NULL); 00662 if (p->flink.Pkgid) argvPrint("flink.Pkgid", p->flink.Pkgid, NULL); 00663 if (p->flink.Hdrid) argvPrint("flink.Hdrid", p->flink.Hdrid, NULL); 00664 if (p->flink.NEVRA) argvPrint("flink.NEVRA", p->flink.NEVRA, NULL); 00665 } 00666 }; 00667 #endif 00668 00669 static inline void hdrPrintInstalled(Header h) 00670 /*@globals fileSystem @*/ 00671 /*@modifies fileSystem @*/ 00672 { 00673 const char * qfmt = "[%{erasednevra} O:%{packageorigin} P:%{erasedpkgid} H:%{erasedhdrid}\n]"; 00674 const char * errstr = "(unknown error)"; 00675 /*@-modobserver@*/ 00676 const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr); 00677 /*@=modobserver@*/ 00678 00679 if (str == NULL) 00680 fprintf(stderr, "error: %s\n", errstr); 00681 else { 00682 fprintf(stderr, "%s", str); 00683 str = _free(str); 00684 } 00685 } 00686 00687 static inline void hdrPrintErased(Header h) 00688 /*@globals fileSystem @*/ 00689 /*@modifies fileSystem @*/ 00690 { 00691 const char * qfmt = "[%{installednevra} O:%{packageorigin} P:%{installedpkgid} H:%{installedhdrid}\n]"; 00692 const char * errstr = "(unknown error)"; 00693 /*@-modobserver@*/ 00694 const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr); 00695 /*@=modobserver@*/ 00696 if (str == NULL) 00697 fprintf(stderr, "error: %s\n", errstr); 00698 else { 00699 fprintf(stderr, "%s", str); 00700 str = _free(str); 00701 } 00702 } 00703 #endif 00704 00705 #ifdef __cplusplus 00706 } 00707 #endif 00708 00709 #endif /* H_RPMTE */