rpm 5.2.1

- 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 <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 <rpmal.h>
    00038
    00042 /*@-fielduse@*/ /* LCL: confused by union? */
    00043 struct tsortInfo_s {
    00044     union {
    00045         int     count;
    00046         /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00047         rpmte   suc;
    00048     } tsi_u;
    00049 #define tsi_count       tsi_u.count
    00050 #define tsi_suc         tsi_u.suc
    00051 /*@owned@*/ /*@null@*/
    00052     tsortInfo   tsi_next;
    00053 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00054     rpmte       tsi_chain;
    00055     int         tsi_tagn;
    00056     int         tsi_reqx;
    00057     int         tsi_queued;
    00058     int         tsi_qcnt;
    00059 };
    00060 /*@=fielduse@*/
    00061
    00065 struct rpmChainLink_s {
    00066 /*@only@*/ /*@null@*/
    00067     ARGV_t Pkgid;
    00068 /*@only@*/ /*@null@*/
    00069     ARGV_t Hdrid;
    00070 /*@only@*/ /*@null@*/
    00071     ARGV_t NEVRA;
    00072 };
    00073
    00076 typedef struct sharedFileInfo_s *               sharedFileInfo;
    00077
    00081 struct sharedFileInfo_s {
    00082     rpmuint32_t pkgFileNum;
    00083     rpmuint32_t otherFileNum;
    00084     rpmuint32_t otherPkg;
    00085     rpmuint32_t isRemoved;
    00086 };
    00087
    00091 struct rpmte_s {
    00092     struct rpmioItem_s _item;
    00093     rpmElementType type;
    00095 /*@refcounted@*/ /*@relnull@*/
    00096     Header h;
    00097 /*@only@*/
    00098     const char * NEVR;
    00099 /*@only@*/
    00100     const char * NEVRA;
    00101 /*@only@*/ /*@relnull@*/
    00102     const char * pkgid;
    00103 /*@only@*/ /*@relnull@*/
    00104     const char * hdrid;
    00105 /*@only@*/ /*@null@*/
    00106     const char * sourcerpm;
    00107 /*@only@*/
    00108     const char * name;
    00109 /*@only@*/ /*@null@*/
    00110     char * epoch;
    00111 /*@only@*/ /*@null@*/
    00112     char * version;
    00113 /*@only@*/ /*@null@*/
    00114     char * release;
    00115 #ifdef  RPM_VENDOR_MANDRIVA
    00116 /*@only@*/ /*@null@*/
    00117     char * distepoch;
    00118 #endif
    00119 /*@only@*/ /*@null@*/
    00120     const char * arch;
    00121 /*@only@*/ /*@null@*/
    00122     const char * os;
    00123     int isSource;
    00125     rpmte parent;
    00126     int degree;
    00127     int npreds;
    00128     int tree;
    00129     int depth;
    00130     int breadth;
    00131     unsigned int db_instance;
    00132 /*@owned@*/
    00133     tsortInfo tsi;
    00135 /*@null@*/
    00136     rpmPRCO PRCO;
    00138 /*@refcounted@*/ /*@null@*/
    00139     rpmfi fi;
    00141     rpmuint32_t depFlags;
    00142     rpmuint32_t transFlags;
    00143     rpmuint32_t color;
    00144     rpmuint32_t pkgFileSize;
    00146 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00147     fnpyKey key;
    00148 /*@owned@*/ /*@null@*/
    00149     rpmRelocation relocs;
    00150     int nrelocs;
    00151     int autorelocatex;
    00152 /*@refcounted@*/ /*@null@*/
    00153     FD_t fd;
    00155 /*@owned@*/ /*@null@*/
    00156     sharedFileInfo replaced;
    00157     int nreplaced;
    00159     struct rpmChainLink_s blink;
    00160     struct rpmChainLink_s flink;
    00161     int linkFailed;
    00162     int done;
    00163     rpmuint32_t originTid[2];
    00164     rpmuint32_t originTime[2];
    00166     int installed;
    00167     int downgrade;
    00169     struct {
    00170 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00171         alKey addedKey;
    00172         struct {
    00173 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00174             alKey dependsOnKey;
    00175             int dboffset;
    00176         } removed;
    00177     } u;
    00178 #if defined(__LCLINT__)
    00179 /*@refs@*/
    00180     int nrefs;
    00181 #endif
    00182 };
    00183
    00187 struct rpmtsi_s {
    00188     struct rpmioItem_s _item;
    00189 /*@refcounted@*/
    00190     rpmts ts;
    00191     int reverse;
    00192     int ocsave;
    00193     int oc;
    00194 #if defined(__LCLINT__)
    00195 /*@refs@*/
    00196     int nrefs;
    00197 #endif
    00198 };
    00199
    00200 #endif  /* _RPMTE_INTERNAL */
    00201
    00202 #ifdef __cplusplus
    00203 extern "C" {
    00204 #endif
    00205
    00206 #if     defined(_RPMTE_INTERNAL)
    00207
    00212 /*@unused@*/ /*@null@*/
    00213 rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
    00214         /*@globals fileSystem @*/
    00215         /*@modifies te, fileSystem @*/;
    00216 #define rpmteFree(_te)  \
    00217     ((rpmte) rpmioFreePoolItem((rpmioItem)(_te), __FUNCTION__, __FILE__, __LINE__))
    00218
    00230 /*@only@*/ /*@null@*/
    00231 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
    00232                 /*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
    00233                 /*@null@*/ rpmRelocation relocs,
    00234                 int dboffset,
    00235                 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
    00236         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00237         /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00238 #endif  /* _RPMTE_INTERNAL */
    00239
    00245 extern Header rpmteHeader(rpmte te)
    00246         /*@modifies te @*/;
    00247
    00254 extern Header rpmteSetHeader(rpmte te, Header h)
    00255         /*@modifies te, h @*/;
    00256
    00262 rpmElementType rpmteType(rpmte te)
    00263         /*@*/;
    00264
    00270 /*@observer@*/
    00271 extern const char * rpmteN(rpmte te)
    00272         /*@*/;
    00273
    00279 /*@observer@*/ /*@null@*/
    00280 extern const char * rpmteE(rpmte te)
    00281         /*@*/;
    00282
    00288 /*@observer@*/ /*@null@*/
    00289 extern const char * rpmteV(rpmte te)
    00290         /*@*/;
    00291
    00297 /*@observer@*/ /*@null@*/
    00298 extern const char * rpmteR(rpmte te)
    00299         /*@*/;
    00300
    00301 #ifdef  RPM_VENDOR_MANDRIVA
    00302
    00307 /*@observer@*/ /*@null@*/
    00308 extern const char * rpmteD(rpmte te)
    00309         /*@*/;
    00310 #endif
    00311
    00317 /*@observer@*/ /*@null@*/
    00318 extern const char * rpmteA(rpmte te)
    00319         /*@*/;
    00320
    00326 /*@observer@*/ /*@null@*/
    00327 extern const char * rpmteO(rpmte te)
    00328         /*@*/;
    00329
    00335 extern int rpmteIsSource(rpmte te)
    00336         /*@*/;
    00337
    00343 rpmuint32_t rpmteColor(rpmte te)
    00344         /*@*/;
    00345
    00352 rpmuint32_t rpmteSetColor(rpmte te, rpmuint32_t color)
    00353         /*@modifies te @*/;
    00354
    00360 unsigned int rpmteDBInstance(rpmte te)
    00361         /*@*/;
    00362
    00369 void rpmteSetDBInstance(rpmte te, unsigned int instance)
    00370         /*@modifies te @*/;
    00371
    00378 rpmuint32_t rpmtePkgFileSize(rpmte te)
    00379         /*@*/;
    00380
    00386 /*@observer@*/
    00387 rpmuint32_t * rpmteOriginTid(rpmte te)
    00388         /*@*/;
    00389
    00395 /*@observer@*/
    00396 rpmuint32_t * rpmteOriginTime(rpmte te)
    00397         /*@*/;
    00398
    00404 int rpmteDepth(rpmte te)
    00405         /*@*/;
    00406
    00413 int rpmteSetDepth(rpmte te, int ndepth)
    00414         /*@modifies te @*/;
    00415
    00421 int rpmteBreadth(rpmte te)
    00422         /*@*/;
    00423
    00430 int rpmteSetBreadth(rpmte te, int nbreadth)
    00431         /*@modifies te @*/;
    00432
    00438 int rpmteNpreds(rpmte te)
    00439         /*@*/;
    00440
    00447 int rpmteSetNpreds(rpmte te, int npreds)
    00448         /*@modifies te @*/;
    00449
    00455 int rpmteTree(rpmte te)
    00456         /*@*/;
    00457
    00464 int rpmteSetTree(rpmte te, int ntree)
    00465         /*@modifies te @*/;
    00466
    00472 /*@observer@*/ /*@unused@*/
    00473 rpmte rpmteParent(rpmte te)
    00474         /*@*/;
    00475
    00482 /*@null@*/
    00483 rpmte rpmteSetParent(rpmte te, rpmte pte)
    00484         /*@modifies te @*/;
    00485
    00491 int rpmteDegree(rpmte te)
    00492         /*@*/;
    00493
    00500 int rpmteSetDegree(rpmte te, int ndegree)
    00501         /*@modifies te @*/;
    00502
    00508 tsortInfo rpmteTSI(rpmte te)
    00509         /*@*/;
    00510
    00515 void rpmteFreeTSI(rpmte te)
    00516         /*@modifies te @*/;
    00517
    00522 void rpmteNewTSI(rpmte te)
    00523         /*@modifies te @*/;
    00524
    00529 /*@unused@*/
    00530 void rpmteCleanDS(rpmte te)
    00531         /*@modifies te @*/;
    00532
    00533 #if     defined(_RPMTE_INTERNAL)
    00534
    00539 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00540 alKey rpmteAddedKey(rpmte te)
    00541         /*@*/;
    00542
    00549 /*@exposed@*/ /*@dependent@*/ /*@null@*/
    00550 alKey rpmteSetAddedKey(rpmte te,
    00551                 /*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
    00552         /*@modifies te @*/;
    00553 #endif  /* _RPMTE_INTERNAL */
    00554
    00560 int rpmteDBOffset(rpmte te)
    00561         /*@*/;
    00562
    00568 /*@observer@*/
    00569 extern const char * rpmteNEVR(rpmte te)
    00570         /*@*/;
    00571
    00577 /*@-exportlocal@*/
    00578 /*@observer@*/
    00579 extern const char * rpmteNEVRA(rpmte te)
    00580         /*@*/;
    00581 /*@=exportlocal@*/
    00582
    00588 /*@-exportlocal@*/
    00589 /*@observer@*/ /*@null@*/
    00590 extern const char * rpmtePkgid(rpmte te)
    00591         /*@*/;
    00592 /*@=exportlocal@*/
    00593
    00599 /*@-exportlocal@*/
    00600 /*@observer@*/ /*@null@*/
    00601 extern const char * rpmteHdrid(rpmte te)
    00602         /*@*/;
    00603 /*@=exportlocal@*/
    00604
    00610 /*@-exportlocal@*/
    00611 /*@observer@*/ /*@null@*/
    00612 extern const char * rpmteSourcerpm(rpmte te)
    00613         /*@*/;
    00614 /*@=exportlocal@*/
    00615
    00621 FD_t rpmteFd(rpmte te)
    00622         /*@*/;
    00623
    00629 /*@exposed@*/
    00630 fnpyKey rpmteKey(rpmte te)
    00631         /*@*/;
    00632
    00639 rpmds rpmteDS(rpmte te, rpmTag tag)
    00640         /*@*/;
    00641
    00648 rpmfi rpmteFI(rpmte te, rpmTag tag)
    00649         /*@*/;
    00650
    00656 /*@-exportlocal@*/
    00657 void rpmteColorDS(rpmte te, rpmTag tag)
    00658         /*@modifies te @*/;
    00659 /*@=exportlocal@*/
    00660
    00669 int rpmteChain(rpmte p, rpmte q, Header oh, /*@null@*/ const char * msg)
    00670         /*@globals internalState @*/
    00671         /*@modifies p, q, oh, internalState @*/;
    00672
    00673 #define RPMTE_CHAIN_END "CHAIN END"
    00680 int rpmtsiOc(rpmtsi tsi)
    00681         /*@*/;
    00682
    00688 /*@unused@*/ /*@null@*/
    00689 rpmtsi rpmtsiFree(/*@killref@*//*@null@*/ rpmtsi tsi)
    00690         /*@globals fileSystem @*/
    00691         /*@modifies fileSystem @*/;
    00692 #define rpmtsiFree(_tsi)        \
    00693         ((rpmtsi)rpmioFreePoolItem((rpmioItem)(_tsi), __FUNCTION__, __FILE__, __LINE__))
    00694
    00700 /*@unused@*/ /*@only@*/
    00701 rpmtsi rpmtsiInit(rpmts ts)
    00702         /*@modifies ts @*/;
    00703
    00711 /*@unused@*/ /*@only@*/
    00712 rpmtsi XrpmtsiInit(rpmts ts,
    00713                 const char * fn, unsigned int ln)
    00714         /*@modifies ts @*/;
    00715 #define rpmtsiInit(_ts)         XrpmtsiInit(_ts, __FILE__, __LINE__)
    00716
    00723 /*@dependent@*/ /*@null@*/
    00724 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
    00725         /*@modifies tsi @*/;
    00726
    00727 #if     defined(DYING)
    00728 #if !defined(SWIG)
    00729
    00731 static inline void rpmtePrintID(rpmte p)
    00732         /*@globals fileSystem @*/
    00733         /*@modifies fileSystem @*/
    00734 {
    00735     if (p != NULL) {
    00736         if (p->blink.Pkgid) argvPrint("blink.Pkgid", p->blink.Pkgid, NULL);
    00737         if (p->blink.Hdrid) argvPrint("blink.Hdrid", p->blink.Hdrid, NULL);
    00738         if (p->blink.NEVRA) argvPrint("blink.NEVRA", p->blink.NEVRA, NULL);
    00739         if (p->flink.Pkgid) argvPrint("flink.Pkgid", p->flink.Pkgid, NULL);
    00740         if (p->flink.Hdrid) argvPrint("flink.Hdrid", p->flink.Hdrid, NULL);
    00741         if (p->flink.NEVRA) argvPrint("flink.NEVRA", p->flink.NEVRA, NULL);
    00742     }
    00743 };
    00744
    00747 static inline void hdrPrintInstalled(Header h)
    00748         /*@globals fileSystem @*/
    00749         /*@modifies h, fileSystem @*/
    00750 {
    00751     const char * qfmt = "[%{erasednevra} O:%{packageorigin} P:%{erasedpkgid} H:%{erasedhdrid}\n]";
    00752     const char * errstr = "(unknown error)";
    00753 /*@-modobserver@*/
    00754     const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
    00755 /*@=modobserver@*/
    00756
    00757     if (str == NULL)
    00758         fprintf(stderr, "error: %s\n", errstr);
    00759     else {
    00760         fprintf(stderr, "%s", str);
    00761         str = _free(str);
    00762     }
    00763 }
    00764
    00767 static inline void hdrPrintErased(Header h)
    00768         /*@globals fileSystem @*/
    00769         /*@modifies h, fileSystem @*/
    00770 {
    00771     const char * qfmt = "[%{installednevra} O:%{packageorigin} P:%{installedpkgid} H:%{installedhdrid}\n]";
    00772     const char * errstr = "(unknown error)";
    00773 /*@-modobserver@*/
    00774     const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
    00775 /*@=modobserver@*/
    00776     if (str == NULL)
    00777         fprintf(stderr, "error: %s\n", errstr);
    00778     else {
    00779         fprintf(stderr, "%s", str);
    00780         str = _free(str);
    00781     }
    00782 }
    00783 #endif
    00784 #endif
    00785
    00786 #ifdef __cplusplus
    00787 }
    00788 #endif
    00789
    00790 #endif  /* H_RPMTE */