00001 #ifndef H_RPMTS
00002 #define H_RPMTS
00003
00009 #include "rpmps.h"
00010 #include "rpmsw.h"
00011 #include "rpmsx.h"
00012
00013
00014
00015 extern int _rpmts_debug;
00016
00017 extern int _rpmts_stats;
00018
00019 extern int _fps_debug;
00020
00021
00025 typedef enum rpmVSFlags_e {
00026 RPMVSF_DEFAULT = 0,
00027 RPMVSF_NOHDRCHK = (1 << 0),
00028 RPMVSF_NEEDPAYLOAD = (1 << 1),
00029
00030 RPMVSF_NOSHA1HEADER = (1 << 8),
00031 RPMVSF_NOMD5HEADER = (1 << 9),
00032 RPMVSF_NODSAHEADER = (1 << 10),
00033 RPMVSF_NORSAHEADER = (1 << 11),
00034
00035 RPMVSF_NOSHA1 = (1 << 16),
00036 RPMVSF_NOMD5 = (1 << 17),
00037 RPMVSF_NODSA = (1 << 18),
00038 RPMVSF_NORSA = (1 << 19)
00039
00040 } rpmVSFlags;
00041
00045 typedef enum rpmtsType_e {
00046 RPMTRANS_TYPE_NORMAL = 0,
00047 RPMTRANS_TYPE_ROLLBACK = (1 << 0),
00048 RPMTRANS_TYPE_AUTOROLLBACK = (1 << 1)
00049 } rpmtsType;
00050
00051 #define _RPMVSF_NODIGESTS \
00052 ( RPMVSF_NOSHA1HEADER | \
00053 RPMVSF_NOMD5HEADER | \
00054 RPMVSF_NOSHA1 | \
00055 RPMVSF_NOMD5 )
00056
00057 #define _RPMVSF_NOSIGNATURES \
00058 ( RPMVSF_NODSAHEADER | \
00059 RPMVSF_NORSAHEADER | \
00060 RPMVSF_NODSA | \
00061 RPMVSF_NORSA )
00062
00063 #define _RPMVSF_NOHEADER \
00064 ( RPMVSF_NOSHA1HEADER | \
00065 RPMVSF_NOMD5HEADER | \
00066 RPMVSF_NODSAHEADER | \
00067 RPMVSF_NORSAHEADER )
00068
00069 #define _RPMVSF_NOPAYLOAD \
00070 ( RPMVSF_NOSHA1 | \
00071 RPMVSF_NOMD5 | \
00072 RPMVSF_NODSA | \
00073 RPMVSF_NORSA )
00074
00078 typedef enum rpmtsOpX_e {
00079 RPMTS_OP_TOTAL = 0,
00080 RPMTS_OP_CHECK = 1,
00081 RPMTS_OP_ORDER = 2,
00082 RPMTS_OP_FINGERPRINT = 3,
00083 RPMTS_OP_REPACKAGE = 4,
00084 RPMTS_OP_INSTALL = 5,
00085 RPMTS_OP_ERASE = 6,
00086 RPMTS_OP_SCRIPTLETS = 7,
00087 RPMTS_OP_COMPRESS = 8,
00088 RPMTS_OP_UNCOMPRESS = 9,
00089 RPMTS_OP_DIGEST = 10,
00090 RPMTS_OP_SIGNATURE = 11,
00091 RPMTS_OP_DBADD = 12,
00092 RPMTS_OP_DBREMOVE = 13,
00093 RPMTS_OP_DBGET = 14,
00094 RPMTS_OP_DBPUT = 15,
00095 RPMTS_OP_DBDEL = 16,
00096 RPMTS_OP_MAX = 17
00097 } rpmtsOpX;
00098
00099 #if defined(_RPMTS_INTERNAL)
00100
00101 #include "rpmhash.h"
00102 #include "rpmal.h"
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 struct rpmtsScoreEntry_s {
00126 char * N;
00127 rpmElementType te_types;
00128 int installed;
00129 int erased;
00130 };
00131
00132 typedef struct rpmtsScoreEntry_s * rpmtsScoreEntry;
00133
00134 struct rpmtsScore_s {
00135 int entries;
00136 rpmtsScoreEntry * scores;
00137 int nrefs;
00138 };
00139
00140 typedef struct rpmtsScore_s * rpmtsScore;
00141
00142
00150 rpmRC rpmtsScoreInit(rpmts runningTS, rpmts rollbackTS)
00151
00152 ;
00153
00159
00160
00161 rpmtsScore rpmtsScoreFree( rpmtsScore score)
00162 ;
00163
00164
00170
00171 rpmtsScore rpmtsGetScore(rpmts ts)
00172 ;
00173
00179
00180 rpmtsScoreEntry rpmtsScoreGetEntry(rpmtsScore score, const char *N)
00181 ;
00182
00188
00189
00190
00191
00192
00193
00194 extern int _cacheDependsRC;
00195
00196
00199 typedef struct diskspaceInfo_s * rpmDiskSpaceInfo;
00200
00203 struct diskspaceInfo_s {
00204 dev_t dev;
00205 signed long bneeded;
00206 signed long ineeded;
00207 int bsize;
00208 signed long long bavail;
00209 signed long long iavail;
00210 };
00211
00215 #define adj_fs_blocks(_nb) (((_nb) * 21) / 20)
00216
00217
00218
00219 #define BLOCK_ROUND(size, block) (((size) + (block) - 1) / (block))
00220
00223 typedef enum tsStage_e {
00224 TSM_UNKNOWN = 0,
00225 TSM_INSTALL = 7,
00226 TSM_ERASE = 8,
00227 } tsmStage;
00228
00232 struct rpmts_s {
00233 rpmtransFlags transFlags;
00234 tsmStage goal;
00235 rpmtsType type;
00237
00238 rpmdb sdb;
00239 int sdbmode;
00240
00241 int (*solve) (rpmts ts, rpmds key, const void * data)
00242 ;
00243
00244 const void * solveData;
00245 int nsuggests;
00246
00247 const void ** suggests;
00249
00250 rpmCallbackFunction notify;
00251
00252 rpmCallbackData notifyData;
00254
00255 rpmps probs;
00256 rpmprobFilterFlags ignoreSet;
00259 int filesystemCount;
00260
00261 const char ** filesystems;
00262
00263 rpmDiskSpaceInfo dsi;
00265
00266 rpmdb rdb;
00267 int dbmode;
00268
00269 hashTable ht;
00271
00272 int * removedPackages;
00273 int numRemovedPackages;
00274 int allocedRemovedPackages;
00276
00277 rpmal addedPackages;
00278 int numAddedPackages;
00280 #ifndef DYING
00281
00282 rpmal availablePackages;
00283 int numAvailablePackages;
00284 #endif
00285
00286
00287 rpmsx sx;
00289
00290 rpmte relocateElement;
00292
00293 rpmte * order;
00294 int orderCount;
00295 int orderAlloced;
00296 int unorderedSuccessors;
00297 int ntrees;
00298 int maxDepth;
00300 int selinuxEnabled;
00301 int chrootDone;
00302
00303 const char * rootDir;
00304
00305 const char * currDir;
00306
00307 FD_t scriptFd;
00308 int delta;
00309 int_32 tid;
00311 uint_32 color;
00312 uint_32 prefcolor;
00314 rpmVSFlags vsflags;
00316
00317 const char * fn;
00318 int_32 sigtag;
00319 int_32 sigtype;
00320
00321 const void * sig;
00322 int_32 siglen;
00324
00325 const unsigned char * pkpkt;
00326 size_t pkpktlen;
00327 unsigned char pksignid[8];
00329 struct rpmop_s ops[RPMTS_OP_MAX];
00330
00331
00332 pgpDig dig;
00334
00335 Spec spec;
00337
00338 rpmtsScore score;
00340
00341 int nrefs;
00342 };
00343 #endif
00344
00345 #ifdef __cplusplus
00346 extern "C" {
00347 #endif
00348
00354 int rpmtsCheck(rpmts ts)
00355
00356 ;
00357
00374 int rpmtsOrder(rpmts ts)
00375
00376 ;
00377
00395 int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
00396
00397 ;
00398
00405
00406 rpmts rpmtsUnlink ( rpmts ts,
00407 const char * msg)
00408 ;
00409
00411
00412
00413 rpmts XrpmtsUnlink ( rpmts ts,
00414 const char * msg, const char * fn, unsigned ln)
00415 ;
00416
00417 #define rpmtsUnlink(_ts, _msg) XrpmtsUnlink(_ts, _msg, __FILE__, __LINE__)
00418
00425
00426 rpmts rpmtsLink (rpmts ts, const char * msg)
00427 ;
00428
00430 rpmts XrpmtsLink (rpmts ts,
00431 const char * msg, const char * fn, unsigned ln)
00432 ;
00433 #define rpmtsLink(_ts, _msg) XrpmtsLink(_ts, _msg, __FILE__, __LINE__)
00434
00440 int rpmtsCloseDB(rpmts ts)
00441
00442 ;
00443
00450 int rpmtsOpenDB(rpmts ts, int dbmode)
00451
00452 ;
00453
00461 int rpmtsInitDB(rpmts ts, int dbmode)
00462
00463 ;
00464
00470 int rpmtsRebuildDB(rpmts ts)
00471
00472 ;
00473
00479 int rpmtsVerifyDB(rpmts ts)
00480
00481 ;
00482
00491
00492 rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
00493 const void * keyp, size_t keylen)
00494
00495 ;
00496
00502
00503 rpmRC rpmtsFindPubkey(rpmts ts)
00504
00505 ;
00506
00507
00513
00514 int rpmtsCloseSDB(rpmts ts)
00515
00516 ;
00517
00518
00525
00526 int rpmtsOpenSDB(rpmts ts, int dbmode)
00527
00528 ;
00529
00530
00538
00539 int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
00540
00541 ;
00542
00543
00551
00552 int rpmtsAvailable(rpmts ts, const rpmds ds)
00553
00554 ;
00555
00563 int rpmtsSetSolveCallback(rpmts ts,
00564 int (*solve) (rpmts ts, rpmds ds, const void * data),
00565 const void * solveData)
00566 ;
00567
00573 rpmtsType rpmtsGetType(rpmts ts)
00574 ;
00575
00587 void rpmtsSetType(rpmts ts, rpmtsType type)
00588 ;
00589
00595
00596 rpmps rpmtsProblems(rpmts ts)
00597 ;
00598
00603 void rpmtsCleanDig(rpmts ts)
00604 ;
00605
00610 void rpmtsClean(rpmts ts)
00611
00612 ;
00613
00618 void rpmtsEmpty(rpmts ts)
00619
00620 ;
00621
00627
00628 rpmts rpmtsFree( rpmts ts)
00629
00630 ;
00631
00637 rpmVSFlags rpmtsVSFlags(rpmts ts)
00638 ;
00639
00646 rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
00647 ;
00648
00655 int rpmtsUnorderedSuccessors(rpmts ts, int first)
00656 ;
00657
00663
00664 extern const char * rpmtsRootDir(rpmts ts)
00665 ;
00666
00672 void rpmtsSetRootDir(rpmts ts, const char * rootDir)
00673 ;
00674
00680
00681 extern const char * rpmtsCurrDir(rpmts ts)
00682 ;
00683
00689 void rpmtsSetCurrDir(rpmts ts, const char * currDir)
00690 ;
00691
00697
00698 FD_t rpmtsScriptFd(rpmts ts)
00699 ;
00700
00706 void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
00707 ;
00708
00714 int rpmtsSELinuxEnabled(rpmts ts)
00715 ;
00716
00722 int rpmtsChrootDone(rpmts ts)
00723 ;
00724
00731 int rpmtsSetChrootDone(rpmts ts, int chrootDone)
00732 ;
00733
00739
00740 rpmsx rpmtsREContext(const rpmts ts)
00741 ;
00742
00749 int rpmtsSetREContext(rpmts ts, rpmsx sx)
00750 ;
00751
00757 int_32 rpmtsGetTid(rpmts ts)
00758 ;
00759
00766 int_32 rpmtsSetTid(rpmts ts, int_32 tid)
00767 ;
00768
00774 int_32 rpmtsSigtag(const rpmts ts)
00775 ;
00776
00782 int_32 rpmtsSigtype(const rpmts ts)
00783 ;
00784
00790
00791 extern const void * rpmtsSig(const rpmts ts)
00792 ;
00793
00799 int_32 rpmtsSiglen(const rpmts ts)
00800 ;
00801
00811 int rpmtsSetSig(rpmts ts,
00812 int_32 sigtag, int_32 sigtype,
00813 const void * sig, int_32 siglen)
00814 ;
00815
00821
00822 pgpDig rpmtsDig(rpmts ts)
00823 ;
00824
00830
00831 pgpDigParams rpmtsSignature(const rpmts ts)
00832 ;
00833
00839
00840 pgpDigParams rpmtsPubkey(const rpmts ts)
00841 ;
00842
00848
00849 rpmdb rpmtsGetRdb(rpmts ts)
00850 ;
00851
00857 int rpmtsInitDSI(const rpmts ts)
00858
00859 ;
00860
00870 void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
00871 uint_32 fileSize, uint_32 prevSize, uint_32 fixupSize,
00872 fileAction action)
00873 ;
00874
00880 void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
00881 ;
00882
00892
00893 void * rpmtsNotify(rpmts ts, rpmte te,
00894 rpmCallbackType what, unsigned long amount, unsigned long total)
00895 ;
00896
00902 int rpmtsNElements(rpmts ts)
00903 ;
00904
00911
00912 rpmte rpmtsElement(rpmts ts, int ix)
00913 ;
00914
00920 rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
00921 ;
00922
00928 rpmtransFlags rpmtsFlags(rpmts ts)
00929 ;
00930
00937 rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
00938 ;
00939
00945
00946 Spec rpmtsSpec(rpmts ts)
00947 ;
00948
00955
00956 Spec rpmtsSetSpec(rpmts ts, Spec spec)
00957 ;
00958
00964
00965 rpmte rpmtsRelocateElement(rpmts ts)
00966 ;
00967
00974
00975 rpmte rpmtsSetRelocateElement(rpmts ts, rpmte relocateElement)
00976 ;
00977
00983 uint_32 rpmtsColor(rpmts ts)
00984 ;
00985
00991 uint_32 rpmtsPrefColor(rpmts ts)
00992 ;
00993
01000 uint_32 rpmtsSetColor(rpmts ts, uint_32 color)
01001 ;
01002
01009
01010 rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
01011 ;
01012
01024 int rpmtsSetNotifyCallback(rpmts ts,
01025 rpmCallbackFunction notify,
01026 rpmCallbackData notifyData)
01027 ;
01028
01033
01034 rpmts rpmtsCreate(void)
01035
01036 ;
01037
01051 int rpmtsAddInstallElement(rpmts ts, Header h,
01052 const fnpyKey key, int upgrade,
01053 rpmRelocation * relocs)
01054
01055
01056
01057 ;
01058
01066 int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
01067
01068 ;
01069
01078
01079 int rpmtsGetKeys(rpmts ts,
01080 fnpyKey ** ep,
01081 int * nep)
01082
01083 ;
01084
01091 char * hGetNEVR(Header h, const char ** np )
01092 ;
01093
01100 char * hGetNEVRA(Header h, const char ** np )
01101 ;
01102
01108 uint_32 hGetColor(Header h)
01109 ;
01110
01111 #ifdef __cplusplus
01112 }
01113 #endif
01114
01115
01116 #endif