00001 #ifndef H_RPMTE
00002 #define H_RPMTE
00003
00008 #include <rpmfi.h>
00009
00012
00013
00014 extern int _rpmte_debug;
00015
00016
00020 typedef struct tsortInfo_s * tsortInfo;
00021
00025 typedef 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
00043 struct tsortInfo_s {
00044 union {
00045 int count;
00046
00047 rpmte suc;
00048 } tsi_u;
00049 #define tsi_count tsi_u.count
00050 #define tsi_suc tsi_u.suc
00051
00052 tsortInfo tsi_next;
00053
00054 rpmte tsi_chain;
00055 int tsi_tagn;
00056 int tsi_reqx;
00057 int tsi_queued;
00058 int tsi_qcnt;
00059 };
00060
00061
00065 struct rpmChainLink_s {
00066
00067 ARGV_t Pkgid;
00068
00069 ARGV_t Hdrid;
00070
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
00096 Header h;
00097
00098 const char * NEVR;
00099
00100 const char * NEVRA;
00101
00102 const char * pkgid;
00103
00104 const char * hdrid;
00105
00106 const char * sourcerpm;
00107
00108 const char * name;
00109
00110 char * epoch;
00111
00112 char * version;
00113
00114 char * release;
00115 #ifdef RPM_VENDOR_MANDRIVA
00116
00117 char * distepoch;
00118 #endif
00119
00120 const char * arch;
00121
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
00133 tsortInfo tsi;
00135
00136 rpmPRCO PRCO;
00138
00139 rpmfi fi;
00141 rpmuint32_t depFlags;
00142 rpmuint32_t transFlags;
00143 rpmuint32_t color;
00144 rpmuint32_t pkgFileSize;
00146
00147 fnpyKey key;
00148
00149 rpmRelocation relocs;
00150 int nrelocs;
00151 int autorelocatex;
00152
00153 FD_t fd;
00155
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
00171 alKey addedKey;
00172 struct {
00173
00174 alKey dependsOnKey;
00175 int dboffset;
00176 } removed;
00177 } u;
00178 #if defined(__LCLINT__)
00179
00180 int nrefs;
00181 #endif
00182 };
00183
00187 struct rpmtsi_s {
00188 struct rpmioItem_s _item;
00189
00190 rpmts ts;
00191 int reverse;
00192 int ocsave;
00193 int oc;
00194 #if defined(__LCLINT__)
00195
00196 int nrefs;
00197 #endif
00198 };
00199
00200 #endif
00201
00202 #ifdef __cplusplus
00203 extern "C" {
00204 #endif
00205
00206 #if defined(_RPMTE_INTERNAL)
00207
00212
00213 rpmte rpmteFree( rpmte te)
00214
00215 ;
00216 #define rpmteFree(_te) \
00217 ((rpmte) rpmioFreePoolItem((rpmioItem)(_te), __FUNCTION__, __FILE__, __LINE__))
00218
00230
00231 rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
00232 fnpyKey key,
00233 rpmRelocation relocs,
00234 int dboffset,
00235 alKey pkgKey)
00236
00237 ;
00238 #endif
00239
00245 extern Header rpmteHeader(rpmte te)
00246 ;
00247
00254 extern Header rpmteSetHeader(rpmte te, Header h)
00255 ;
00256
00262 rpmElementType rpmteType(rpmte te)
00263 ;
00264
00270
00271 extern const char * rpmteN(rpmte te)
00272 ;
00273
00279
00280 extern const char * rpmteE(rpmte te)
00281 ;
00282
00288
00289 extern const char * rpmteV(rpmte te)
00290 ;
00291
00297
00298 extern const char * rpmteR(rpmte te)
00299 ;
00300
00301 #ifdef RPM_VENDOR_MANDRIVA
00302
00307
00308 extern const char * rpmteD(rpmte te)
00309 ;
00310 #endif
00311
00317
00318 extern const char * rpmteA(rpmte te)
00319 ;
00320
00326
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 ;
00354
00360 unsigned int rpmteDBInstance(rpmte te)
00361 ;
00362
00369 void rpmteSetDBInstance(rpmte te, unsigned int instance)
00370 ;
00371
00378 rpmuint32_t rpmtePkgFileSize(rpmte te)
00379 ;
00380
00386
00387 rpmuint32_t * rpmteOriginTid(rpmte te)
00388 ;
00389
00395
00396 rpmuint32_t * rpmteOriginTime(rpmte te)
00397 ;
00398
00404 int rpmteDepth(rpmte te)
00405 ;
00406
00413 int rpmteSetDepth(rpmte te, int ndepth)
00414 ;
00415
00421 int rpmteBreadth(rpmte te)
00422 ;
00423
00430 int rpmteSetBreadth(rpmte te, int nbreadth)
00431 ;
00432
00438 int rpmteNpreds(rpmte te)
00439 ;
00440
00447 int rpmteSetNpreds(rpmte te, int npreds)
00448 ;
00449
00455 int rpmteTree(rpmte te)
00456 ;
00457
00464 int rpmteSetTree(rpmte te, int ntree)
00465 ;
00466
00472
00473 rpmte rpmteParent(rpmte te)
00474 ;
00475
00482
00483 rpmte rpmteSetParent(rpmte te, rpmte pte)
00484 ;
00485
00491 int rpmteDegree(rpmte te)
00492 ;
00493
00500 int rpmteSetDegree(rpmte te, int ndegree)
00501 ;
00502
00508 tsortInfo rpmteTSI(rpmte te)
00509 ;
00510
00515 void rpmteFreeTSI(rpmte te)
00516 ;
00517
00522 void rpmteNewTSI(rpmte te)
00523 ;
00524
00529
00530 void rpmteCleanDS(rpmte te)
00531 ;
00532
00533 #if defined(_RPMTE_INTERNAL)
00534
00539
00540 alKey rpmteAddedKey(rpmte te)
00541 ;
00542
00549
00550 alKey rpmteSetAddedKey(rpmte te,
00551 alKey npkgKey)
00552 ;
00553 #endif
00554
00560 int rpmteDBOffset(rpmte te)
00561 ;
00562
00568
00569 extern const char * rpmteNEVR(rpmte te)
00570 ;
00571
00577
00578
00579 extern const char * rpmteNEVRA(rpmte te)
00580 ;
00581
00582
00588
00589
00590 extern const char * rpmtePkgid(rpmte te)
00591 ;
00592
00593
00599
00600
00601 extern const char * rpmteHdrid(rpmte te)
00602 ;
00603
00604
00610
00611
00612 extern const char * rpmteSourcerpm(rpmte te)
00613 ;
00614
00615
00621 FD_t rpmteFd(rpmte te)
00622 ;
00623
00629
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
00657 void rpmteColorDS(rpmte te, rpmTag tag)
00658 ;
00659
00660
00669 int rpmteChain(rpmte p, rpmte q, Header oh, const char * msg)
00670
00671 ;
00672
00673 #define RPMTE_CHAIN_END "CHAIN END"
00680 int rpmtsiOc(rpmtsi tsi)
00681 ;
00682
00688
00689 rpmtsi rpmtsiFree( rpmtsi tsi)
00690
00691 ;
00692 #define rpmtsiFree(_tsi) \
00693 ((rpmtsi)rpmioFreePoolItem((rpmioItem)(_tsi), __FUNCTION__, __FILE__, __LINE__))
00694
00700
00701 rpmtsi rpmtsiInit(rpmts ts)
00702 ;
00703
00711
00712 rpmtsi XrpmtsiInit(rpmts ts,
00713 const char * fn, unsigned int ln)
00714 ;
00715 #define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
00716
00723
00724 rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
00725 ;
00726
00727 #if defined(DYING)
00728 #if !defined(SWIG)
00729
00731 static inline void rpmtePrintID(rpmte p)
00732
00733
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
00749
00750 {
00751 const char * qfmt = "[%{erasednevra} O:%{packageorigin} P:%{erasedpkgid} H:%{erasedhdrid}\n]";
00752 const char * errstr = "(unknown error)";
00753
00754 const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
00755
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
00769
00770 {
00771 const char * qfmt = "[%{installednevra} O:%{packageorigin} P:%{installedpkgid} H:%{installedhdrid}\n]";
00772 const char * errstr = "(unknown error)";
00773
00774 const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
00775
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