- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# lib/rpmte.h

Go to the documentation of this file.

    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
    00073 typedef struct sharedFileInfo_s *               sharedFileInfo;
    00074
    00078 struct sharedFileInfo_s {
    00079     int pkgFileNum;
    00080     int otherFileNum;
    00081     int otherPkg;
    00082     int isRemoved;
    00083 };
    00084
    00088 struct rpmte_s {
    00089     rpmElementType type;
    00091 /*@refcounted@*/ /*@relnull@*/
    00092     Header h;
    00093 /*@only@*/
    00094     const char * NEVR;
    00095 /*@only@*/
    00096     const char * NEVRA;
    00097 /*@only@*/ /*@relnull@*/
    00098     const char * pkgid;
    00099 /*@only@*/ /*@relnull@*/
    00100     const char * hdrid;
    00101 /*@owned@*/
    00102     const char * name;
    00103 /*@only@*/ /*@null@*/
    00104     char * epoch;
    00105 /*@dependent@*/ /*@null@*/
    00106     char * version;
    00107 /*@dependent@*/ /*@null@*/
    00108     char * release;
    00109 /*@only@*/ /*@null@*/
    00110     const char * arch;
    00111 /*@only@*/ /*@null@*/
    00112     const char * os;
    00113     int isSource;
    00115     rpmte parent;
    00116     int degree;
    00117     int npreds;
    00118     int tree;
    00119     int depth;
    00120     int breadth;
    00121     unsigned int db_instance;
    00122 /*@owned@*/
    00123     tsortInfo tsi;
    00125 /*@null@*/
    00126     rpmPRCO PRCO;
    00128 /*@refcounted@*/ /*@null@*/
    00129     rpmfi fi;
    00131     uint32_t color;
    00132     uint32_t pkgFileSize;
    00134 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00135     fnpyKey key;
    00136 /*@owned@*/ /*@null@*/
    00137     rpmRelocation relocs;
    00138     int nrelocs;
    00139     int autorelocatex;
    00140 /*@refcounted@*/ /*@null@*/
    00141     FD_t fd;
    00143 /*@owned@*/ /*@null@*/
    00144     sharedFileInfo replaced;
    00145     int nreplaced;
    00147     struct rpmChainLink_s blink;
    00148     struct rpmChainLink_s flink;
    00149     int linkFailed;
    00150     int done;
    00152     int installed;
    00153     int downgrade;
    00155     struct {
    00156 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00157         alKey addedKey;
    00158         struct {
    00159 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00160             alKey dependsOnKey;
    00161             int dboffset;
    00162         } removed;
    00163     } u;
    00164
    00165 };
    00166
    00170 struct rpmtsi_s {
    00171 /*@refcounted@*/
    00172     rpmts ts;
    00173     int reverse;
    00174     int ocsave;
    00175     int oc;
    00176 };
    00177
    00178 #endif  /* _RPMTE_INTERNAL */
    00179
    00180 #ifdef __cplusplus
    00181 extern "C" {
    00182 #endif
    00183
    00189 /*@null@*/
    00190 rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
    00191         /*@globals fileSystem @*/
    00192         /*@modifies te, fileSystem @*/;
    00193
    00205 /*@only@*/ /*@null@*/
    00206 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
    00207                 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
    00208                 /*@null@*/ rpmRelocation relocs,
    00209                 int dboffset,
    00210                 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
    00211         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00212         /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00213
    00219 extern Header rpmteHeader(rpmte te)
    00220         /*@modifies te @*/;
    00221
    00228 extern Header rpmteSetHeader(rpmte te, Header h)
    00229         /*@modifies te, h @*/;
    00230
    00236 rpmElementType rpmteType(rpmte te)
    00237         /*@*/;
    00238
    00244 /*@observer@*/
    00245 extern const char * rpmteN(rpmte te)
    00246         /*@*/;
    00247
    00253 /*@observer@*/ /*@null@*/
    00254 extern const char * rpmteE(rpmte te)
    00255         /*@*/;
    00256
    00262 /*@observer@*/ /*@null@*/
    00263 extern const char * rpmteV(rpmte te)
    00264         /*@*/;
    00265
    00271 /*@observer@*/ /*@null@*/
    00272 extern const char * rpmteR(rpmte te)
    00273         /*@*/;
    00274
    00280 /*@observer@*/ /*@null@*/
    00281 extern const char * rpmteA(rpmte te)
    00282         /*@*/;
    00283
    00289 /*@observer@*/ /*@null@*/
    00290 extern const char * rpmteO(rpmte te)
    00291         /*@*/;
    00292
    00298 extern int rpmteIsSource(rpmte te)
    00299         /*@*/;
    00300
    00306 uint32_t rpmteColor(rpmte te)
    00307         /*@*/;
    00308
    00315 uint32_t rpmteSetColor(rpmte te, uint32_t color)
    00316         /*@modifies te @*/;
    00317
    00323 unsigned int rpmteDBInstance(rpmte te)
    00324         /*@*/;
    00325
    00332 void rpmteSetDBInstance(rpmte te, unsigned int instance)
    00333         /*@modifies te @*/;
    00334
    00341 uint32_t rpmtePkgFileSize(rpmte te)
    00342         /*@*/;
    00343
    00349 int rpmteDepth(rpmte te)
    00350         /*@*/;
    00351
    00358 int rpmteSetDepth(rpmte te, int ndepth)
    00359         /*@modifies te @*/;
    00360
    00366 int rpmteBreadth(rpmte te)
    00367         /*@*/;
    00368
    00375 int rpmteSetBreadth(rpmte te, int nbreadth)
    00376         /*@modifies te @*/;
    00377
    00383 int rpmteNpreds(rpmte te)
    00384         /*@*/;
    00385
    00392 int rpmteSetNpreds(rpmte te, int npreds)
    00393         /*@modifies te @*/;
    00394
    00400 int rpmteTree(rpmte te)
    00401         /*@*/;
    00402
    00409 int rpmteSetTree(rpmte te, int ntree)
    00410         /*@modifies te @*/;
    00411
    00417 /*@observer@*/ /*@unused@*/
    00418 rpmte rpmteParent(rpmte te)
    00419         /*@*/;
    00420
    00427 /*@null@*/
    00428 rpmte rpmteSetParent(rpmte te, rpmte pte)
    00429         /*@modifies te @*/;
    00430
    00436 int rpmteDegree(rpmte te)
    00437         /*@*/;
    00438
    00445 int rpmteSetDegree(rpmte te, int ndegree)
    00446         /*@modifies te @*/;
    00447
    00453 tsortInfo rpmteTSI(rpmte te)
    00454         /*@*/;
    00455
    00460 void rpmteFreeTSI(rpmte te)
    00461         /*@modifies te @*/;
    00462
    00467 void rpmteNewTSI(rpmte te)
    00468         /*@modifies te @*/;
    00469
    00474 /*@unused@*/
    00475 void rpmteCleanDS(rpmte te)
    00476         /*@modifies te @*/;
    00477
    00483 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00484 alKey rpmteAddedKey(rpmte te)
    00485         /*@*/;
    00486
    00493 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00494 alKey rpmteSetAddedKey(rpmte te,
    00495                 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
    00496         /*@modifies te @*/;
    00497
    00503 int rpmteDBOffset(rpmte te)
    00504         /*@*/;
    00505
    00511 /*@observer@*/
    00512 extern const char * rpmteNEVR(rpmte te)
    00513         /*@*/;
    00514
    00520 /*@-exportlocal@*/
    00521 /*@observer@*/
    00522 extern const char * rpmteNEVRA(rpmte te)
    00523         /*@*/;
    00524 /*@=exportlocal@*/
    00525
    00531 /*@-exportlocal@*/
    00532 /*@observer@*/ /*@null@*/
    00533 extern const char * rpmtePkgid(rpmte te)
    00534         /*@*/;
    00535 /*@=exportlocal@*/
    00536
    00542 /*@-exportlocal@*/
    00543 /*@observer@*/ /*@null@*/
    00544 extern const char * rpmteHdrid(rpmte te)
    00545         /*@*/;
    00546 /*@=exportlocal@*/
    00547
    00553 FD_t rpmteFd(rpmte te)
    00554         /*@*/;
    00555
    00561 /*@exposed@*/
    00562 fnpyKey rpmteKey(rpmte te)
    00563         /*@*/;
    00564
    00571 rpmds rpmteDS(rpmte te, rpmTag tag)
    00572         /*@*/;
    00573
    00580 rpmfi rpmteFI(rpmte te, rpmTag tag)
    00581         /*@*/;
    00582
    00588 /*@-exportlocal@*/
    00589 void rpmteColorDS(rpmte te, rpmTag tag)
    00590         /*@modifies te @*/;
    00591 /*@=exportlocal@*/
    00592
    00601 int rpmteChain(rpmte p, rpmte q, Header oh, /*@null@*/ const char * msg)
    00602         /*@modifies p, q, oh @*/;
    00603
    00604 #define RPMTE_CHAIN_END "CHAIN END"
    00611 int rpmtsiOc(rpmtsi tsi)
    00612         /*@*/;
    00613
    00619 /*@unused@*/ /*@null@*/
    00620 rpmtsi rpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi)
    00621         /*@globals fileSystem @*/
    00622         /*@modifies fileSystem @*/;
    00623
    00631 /*@null@*/
    00632 rpmtsi XrpmtsiFree(/*@only@*//*@null@*/ rpmtsi tsi,
    00633                 const char * fn, unsigned int ln)
    00634         /*@globals fileSystem @*/
    00635         /*@modifies fileSystem @*/;
    00636 #define rpmtsiFree(_tsi)        XrpmtsiFree(_tsi, __FILE__, __LINE__)
    00637
    00643 /*@unused@*/ /*@only@*/
    00644 rpmtsi rpmtsiInit(rpmts ts)
    00645         /*@modifies ts @*/;
    00646
    00654 /*@unused@*/ /*@only@*/
    00655 rpmtsi XrpmtsiInit(rpmts ts,
    00656                 const char * fn, unsigned int ln)
    00657         /*@modifies ts @*/;
    00658 #define rpmtsiInit(_ts)         XrpmtsiInit(_ts, __FILE__, __LINE__)
    00659
    00666 /*@dependent@*/ /*@null@*/
    00667 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
    00668         /*@modifies tsi @*/;
    00669
    00670 #if !defined(SWIG)
    00671 #if     defined(_RPMTE_INTERNAL)
    00672
    00674 static inline void rpmtePrintID(rpmte p)
    00675         /*@globals fileSystem @*/
    00676         /*@modifies fileSystem @*/
    00677 {
    00678     if (p != NULL) {
    00679         if (p->blink.Pkgid) argvPrint("blink.Pkgid", p->blink.Pkgid, NULL);
    00680         if (p->blink.Hdrid) argvPrint("blink.Hdrid", p->blink.Hdrid, NULL);
    00681         if (p->blink.NEVRA) argvPrint("blink.NEVRA", p->blink.NEVRA, NULL);
    00682         if (p->flink.Pkgid) argvPrint("flink.Pkgid", p->flink.Pkgid, NULL);
    00683         if (p->flink.Hdrid) argvPrint("flink.Hdrid", p->flink.Hdrid, NULL);
    00684         if (p->flink.NEVRA) argvPrint("flink.NEVRA", p->flink.NEVRA, NULL);
    00685     }
    00686 };
    00687
    00690 static inline void hdrPrintInstalled(Header h)
    00691         /*@globals fileSystem @*/
    00692         /*@modifies h, fileSystem @*/
    00693 {
    00694     const char * qfmt = "[%{erasednevra} O:%{packageorigin} P:%{erasedpkgid} H:%{erasedhdrid}\n]";
    00695     const char * errstr = "(unknown error)";
    00696 /*@-modobserver@*/
    00697     const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
    00698 /*@=modobserver@*/
    00699
    00700     if (str == NULL)
    00701         fprintf(stderr, "error: %s\n", errstr);
    00702     else {
    00703         fprintf(stderr, "%s", str);
    00704         str = _free(str);
    00705     }
    00706 }
    00707
    00710 static inline void hdrPrintErased(Header h)
    00711         /*@globals fileSystem @*/
    00712         /*@modifies h, fileSystem @*/
    00713 {
    00714     const char * qfmt = "[%{installednevra} O:%{packageorigin} P:%{installedpkgid} H:%{installedhdrid}\n]";
    00715     const char * errstr = "(unknown error)";
    00716 /*@-modobserver@*/
    00717     const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
    00718 /*@=modobserver@*/
    00719     if (str == NULL)
    00720         fprintf(stderr, "error: %s\n", errstr);
    00721     else {
    00722         fprintf(stderr, "%s", str);
    00723         str = _free(str);
    00724     }
    00725 }
    00726 #endif
    00727 #endif
    00728
    00729 #ifdef __cplusplus
    00730 }
    00731 #endif
    00732
    00733 #endif  /* H_RPMTE */