rpmts.h
Go to the documentation of this file.
#ifndef H_RPMTS
#define H_RPMTS
#include "rpmps.h"
#include "rpmsw.h"
#include "rpmsx.h"
#include <rpmpgp.h> /* XXX pgpVSFlags */
/*@-exportlocal@*/
/*@unchecked@*/
extern int _rpmts_debug;
/*@unchecked@*/
extern int _rpmts_macros;
/*@unchecked@*/
extern int _rpmts_stats;
/*@unchecked@*/
extern int _fps_debug;
/*@=exportlocal@*/
typedef pgpVSFlags rpmVSFlags;
typedef enum rpmdepFlags_e {
RPMDEPS_FLAG_NONE = 0,
RPMDEPS_FLAG_NOUPGRADE = (1 << 0),
RPMDEPS_FLAG_NOREQUIRES = (1 << 1),
RPMDEPS_FLAG_NOCONFLICTS = (1 << 2),
RPMDEPS_FLAG_NOOBSOLETES = (1 << 3),
RPMDEPS_FLAG_NOPARENTDIRS = (1 << 4),
RPMDEPS_FLAG_NOLINKTOS = (1 << 5),
RPMDEPS_FLAG_ANACONDA = (1 << 6),
RPMDEPS_FLAG_NOSUGGEST = (1 << 7),
RPMDEPS_FLAG_ADDINDEPS = (1 << 8),
RPMDEPS_FLAG_DEPLOOPS = (1 << 9)
} rpmdepFlags;
typedef enum rpmtransFlags_e {
RPMTRANS_FLAG_NONE = 0,
RPMTRANS_FLAG_TEST = (1 << 0),
RPMTRANS_FLAG_BUILD_PROBS = (1 << 1),
RPMTRANS_FLAG_NOSCRIPTS = (1 << 2),
RPMTRANS_FLAG_JUSTDB = (1 << 3),
RPMTRANS_FLAG_NOTRIGGERS = (1 << 4),
RPMTRANS_FLAG_NODOCS = (1 << 5),
RPMTRANS_FLAG_ALLFILES = (1 << 6),
/* 7 unused */
RPMTRANS_FLAG_NOCONTEXTS = (1 << 8),
RPMTRANS_FLAG_DIRSTASH = (1 << 9),
RPMTRANS_FLAG_REPACKAGE = (1 << 10),
RPMTRANS_FLAG_PKGCOMMIT = (1 << 11),
/*@-enummemuse@*/
RPMTRANS_FLAG_PKGUNDO = (1 << 12),
/*@=enummemuse@*/
RPMTRANS_FLAG_COMMIT = (1 << 13),
/*@-enummemuse@*/
RPMTRANS_FLAG_UNDO = (1 << 14),
/*@=enummemuse@*/
RPMTRANS_FLAG_APPLYONLY = (1 << 25),
RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16),
RPMTRANS_FLAG_NOPRE = (1 << 17),
RPMTRANS_FLAG_NOPOST = (1 << 18),
RPMTRANS_FLAG_NOTRIGGERIN = (1 << 19),
RPMTRANS_FLAG_NOTRIGGERUN = (1 << 20),
RPMTRANS_FLAG_NOPREUN = (1 << 21),
RPMTRANS_FLAG_NOPOSTUN = (1 << 22),
RPMTRANS_FLAG_NOTRIGGERPOSTUN = (1 << 23),
/*@-enummemuse@*/
RPMTRANS_FLAG_NOPAYLOAD = (1 << 24),
/*@=enummemuse@*/
RPMTRANS_FLAG_NORPMDB = (1 << 25),
/* 26 unused */
RPMTRANS_FLAG_NOFDIGESTS = (1 << 27),
RPMTRANS_FLAG_NOPRETRANS = (1 << 28),
RPMTRANS_FLAG_NOPOSTTRANS = (1 << 29),
RPMTRANS_FLAG_NOCONFIGS = (1 << 30),
/* 31 unused */
} rpmtransFlags;
#define _noTransScripts \
( RPMTRANS_FLAG_NOPRETRANS | \
RPMTRANS_FLAG_NOPRE | \
RPMTRANS_FLAG_NOPOST | \
RPMTRANS_FLAG_NOPREUN | \
RPMTRANS_FLAG_NOPOSTUN | \
RPMTRANS_FLAG_NOPOSTTRANS \
)
#define _noTransTriggers \
( RPMTRANS_FLAG_NOTRIGGERPREIN | \
RPMTRANS_FLAG_NOTRIGGERIN | \
RPMTRANS_FLAG_NOTRIGGERUN | \
RPMTRANS_FLAG_NOTRIGGERPOSTUN \
)
typedef enum rpmtsOpX_e {
RPMTS_OP_TOTAL = 0,
RPMTS_OP_CHECK = 1,
RPMTS_OP_ORDER = 2,
RPMTS_OP_FINGERPRINT = 3,
RPMTS_OP_REPACKAGE = 4,
RPMTS_OP_INSTALL = 5,
RPMTS_OP_ERASE = 6,
RPMTS_OP_SCRIPTLETS = 7,
RPMTS_OP_COMPRESS = 8,
RPMTS_OP_UNCOMPRESS = 9,
RPMTS_OP_DIGEST = 10,
RPMTS_OP_SIGNATURE = 11,
RPMTS_OP_DBADD = 12,
RPMTS_OP_DBREMOVE = 13,
RPMTS_OP_DBGET = 14,
RPMTS_OP_DBPUT = 15,
RPMTS_OP_DBDEL = 16,
RPMTS_OP_READHDR = 17,
RPMTS_OP_HDRLOAD = 18,
RPMTS_OP_HDRGET = 19,
RPMTS_OP_DEBUG = 20,
RPMTS_OP_MAX = 20
} rpmtsOpX;
typedef enum rpmTSType_e {
RPMTRANS_TYPE_NORMAL = 0,
RPMTRANS_TYPE_ROLLBACK = (1 << 0),
RPMTRANS_TYPE_AUTOROLLBACK = (1 << 1)
} rpmTSType;
typedef enum tsStage_e {
TSM_UNKNOWN = 0,
TSM_INSTALL = 7,
TSM_ERASE = 8,
} tsmStage;
#if defined(_RPMTS_INTERNAL)
#include "rpmhash.h" /* XXX hashTable */
#include "rpmkeyring.h"
#include "rpmal.h" /* XXX availablePackage/relocateFileList ,*/
/*@unchecked@*/
/*@-exportlocal@*/
extern int _cacheDependsRC;
/*@=exportlocal@*/
typedef /*@abstract@*/ struct diskspaceInfo_s * rpmDiskSpaceInfo;
struct diskspaceInfo_s {
unsigned long f_bsize;
unsigned long f_frsize;
unsigned long long f_blocks;
unsigned long long f_bfree;
signed long long f_bavail;
unsigned long long f_files;
unsigned long long f_ffree;
signed long long f_favail;
unsigned long f_fsid;
unsigned long f_flag;
unsigned long f_namemax;
signed long long bneeded;
signed long long ineeded;
dev_t dev;
};
#define adj_fs_blocks(_nb) (((_nb) * 21) / 20)
#define BLOCK_ROUND(size, block) (((size) + (block) - 1) / (block))
struct rpmts_s {
struct rpmioItem_s _item;
rpmdepFlags depFlags;
rpmtransFlags transFlags;
tsmStage goal;
rpmTSType type;
/*@refcounted@*/ /*@null@*/
rpmdb sdb;
int sdbmode;
/*@null@*/
int (*solve) (rpmts ts, rpmds key, const void * data)
/*@modifies ts @*/;
/*@relnull@*/
const void * solveData;
int nsuggests;
/*@only@*/ /*@null@*/
const void ** suggests;
/*@observer@*/ /*@null@*/
rpmCallbackFunction notify;
/*@observer@*/ /*@null@*/
rpmCallbackData notifyData;
/*@null@*/
rpmPRCO PRCO;
/*@refcounted@*/ /*@null@*/
rpmps probs;
rpmprobFilterFlags ignoreSet;
rpmuint32_t filesystemCount;
/*@dependent@*/ /*@null@*/
const char ** filesystems;
/*@only@*/ /*@relnull@*/
rpmDiskSpaceInfo dsi;
/*@refcounted@*/ /*@null@*/
rpmdb rdb;
int dbmode;
/*@only@*/
hashTable ht;
/*@only@*/ /*@null@*/
int * removedPackages;
int numRemovedPackages;
int allocedRemovedPackages;
/*@only@*/
rpmal addedPackages;
int numAddedPackages;
/*@only@*/
rpmal erasedPackages;
int numErasedPackages;
#ifndef DYING
/*@only@*/
rpmal availablePackages;
int numAvailablePackages;
#endif
/*@refcounted@*/ /*@null@*/
rpmsx sx;
/*@null@*/
rpmte relocateElement;
/*@owned@*/ /*@relnull@*/
rpmte * order;
int orderCount;
int orderAlloced;
int unorderedSuccessors;
int ntrees;
int maxDepth;
/*@dependent@*/ /*@relnull@*/
rpmte teInstall;
/*@dependent@*/ /*@relnull@*/
rpmte teErase;
int selinuxEnabled;
int chrootDone;
/*@only@*/ /*@null@*/
const char * rootDir;
/*@only@*/ /*@null@*/
const char * currDir;
/*@null@*/
FD_t scriptFd;
int delta;
rpmuint32_t tid[2];
rpmuint32_t color;
rpmuint32_t prefcolor;
/*@observer@*/ /*@dependent@*/ /*@null@*/
const char * fn;
/*@refcounted@*/ /*@relnull@*/
rpmKeyring keyring;
/*@relnull@*/
rpmuint8_t * pkpkt;
size_t pkpktlen;
rpmuint8_t pksignid[8];
struct rpmop_s ops[RPMTS_OP_MAX];
/*@refcounted@*/ /*@relnull@*/
pgpDig dig;
/*@null@*/
Spec spec;
rpmuint32_t arbgoal;
#if defined(__LCLINT__)
/*@refs@*/
int nrefs;
#endif
};
#endif /* _RPMTS_INTERNAL */
#ifdef __cplusplus
extern "C" {
#endif
int rpmtsCheck(rpmts ts)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmtsOrder(rpmts ts)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
rpmRC rpmtsRollback(rpmts rbts, rpmprobFilterFlags ignoreSet,
int running, rpmte rbte)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies rbts, rbte, rpmGlobalMacroContext, fileSystem, internalState @*/;
/*@unused@*/ /*@null@*/
rpmts rpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
const char * msg)
/*@modifies ts @*/;
#define rpmtsUnlink(_ts, _msg) \
((rpmts) rpmioUnlinkPoolItem((rpmioItem)(_ts), _msg, __FILE__, __LINE__))
/*@unused@*/ /*@newref@*/
rpmts rpmtsLink (rpmts ts, const char * msg)
/*@modifies ts @*/;
#define rpmtsLink(_ts, _msg) \
((rpmts) rpmioLinkPoolItem((rpmioItem)(_ts), _msg, __FILE__, __LINE__))
int rpmtsCloseDB(rpmts ts)
/*@globals fileSystem @*/
/*@modifies ts, fileSystem @*/;
int rpmtsOpenDB(rpmts ts, int dbmode)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmtsInitDB(rpmts ts, int dbmode)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmtsRebuildDB(rpmts ts)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmtsVerifyDB(rpmts ts)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
/*@only@*/ /*@null@*/
rpmmi rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
/*@null@*/ const void * keyp, size_t keylen)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
/*@-exportlocal@*/
rpmRC rpmtsFindPubkey(rpmts ts, /*@null@*/ void * _dig)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, _dig, rpmGlobalMacroContext, fileSystem, internalState */;
/*@=exportlocal@*/
/*@-exportlocal@*/
int rpmtsCloseSDB(rpmts ts)
/*@globals fileSystem @*/
/*@modifies ts, fileSystem @*/;
/*@=exportlocal@*/
/*@-exportlocal@*/
int rpmtsOpenSDB(rpmts ts, int dbmode)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
/*@=exportlocal@*/
/*@-exportlocal@*/
int rpmtsSolve(rpmts ts, rpmds ds, const void * data)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
/*@=exportlocal@*/
/*@unused@*/
int rpmtsAvailable(rpmts ts, const rpmds ds)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem, internalState @*/;
int rpmtsSetSolveCallback(rpmts ts,
int (*solve) (rpmts ts, rpmds ds, const void * data),
const void * solveData)
/*@modifies ts @*/;
rpmTSType rpmtsType(rpmts ts)
/*@*/;
void rpmtsSetType(rpmts ts, rpmTSType type)
/*@modifies ts @*/;
rpmuint32_t rpmtsARBGoal(rpmts ts)
/*@*/;
void rpmtsSetARBGoal(rpmts ts, rpmuint32_t goal)
/*@modifies ts @*/;
/*@null@*/
rpmps rpmtsProblems(rpmts ts)
/*@modifies ts @*/;
void rpmtsCleanDig(rpmts ts)
/*@globals fileSystem @*/
/*@modifies ts, fileSystem @*/;
void rpmtsClean(rpmts ts)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem , internalState@*/;
void rpmtsEmpty(rpmts ts)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem, internalState @*/;
/*@null@*/
rpmts rpmtsFree(/*@killref@*/ /*@null@*/ rpmts ts)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem, internalState @*/;
#define rpmtsFree(_ts) \
((rpmts) rpmioFreePoolItem((rpmioItem)(_ts), __FUNCTION__, __FILE__, __LINE__))
void * rpmtsGetKeyring(rpmts ts, int autoload)
/*@*/;
int rpmtsSetKeyring(rpmts ts, void * _keyring)
/*modifies ts, _keyring @*/;
rpmVSFlags rpmtsVSFlags(rpmts ts)
/*@*/;
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
/*@modifies ts @*/;
int rpmtsUnorderedSuccessors(rpmts ts, int first)
/*@modifies ts @*/;
/*@observer@*/ /*@null@*/
extern const char * rpmtsRootDir(rpmts ts)
/*@*/;
void rpmtsSetRootDir(rpmts ts, /*@null@*/ const char * rootDir)
/*@modifies ts @*/;
/*@observer@*/ /*@null@*/
extern const char * rpmtsCurrDir(rpmts ts)
/*@*/;
void rpmtsSetCurrDir(rpmts ts, /*@null@*/ const char * currDir)
/*@modifies ts @*/;
#if defined(_RPMTS_INTERNAL) /* XXX avoid FD_t in API. */
/*@null@*/
FD_t rpmtsScriptFd(rpmts ts)
/*@*/;
void rpmtsSetScriptFd(rpmts ts, /*@null@*/ FD_t scriptFd)
/*@globals fileSystem @*/
/*@modifies ts, scriptFd, fileSystem @*/;
#endif
int rpmtsSELinuxEnabled(rpmts ts)
/*@*/;
int rpmtsChrootDone(rpmts ts)
/*@*/;
int rpmtsSetChrootDone(rpmts ts, int chrootDone)
/*@modifies ts @*/;
rpmuint32_t rpmtsGetTid(rpmts ts)
/*@*/;
rpmuint32_t rpmtsSetTid(rpmts ts, rpmuint32_t tid)
/*@modifies ts @*/;
pgpDig rpmtsDig(rpmts ts)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
/*@-exportlocal@*/
/*@exposed@*/ /*@null@*/
pgpDigParams rpmtsPubkey(const rpmts ts)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
/*@=exportlocal@*/
/*@null@*/
rpmdb rpmtsGetRdb(rpmts ts)
/*@*/;
/*@null@*/
rpmPRCO rpmtsPRCO(rpmts ts)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmtsInitDSI(const rpmts ts)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem, internalState @*/;
void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
rpmuint32_t fileSize, rpmuint32_t prevSize, rpmuint32_t fixupSize,
int _action)
/*@modifies ts @*/;
void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
/*@modifies ts @*/;
/*@null@*/
void * rpmtsNotify(rpmts ts, rpmte te,
rpmCallbackType what, rpmuint64_t amount, rpmuint64_t total)
/*@modifies te @*/;
int rpmtsNElements(rpmts ts)
/*@*/;
/*@null@*/ /*@dependent@*/
rpmte rpmtsElement(rpmts ts, int ix)
/*@*/;
rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
/*@*/;
rpmtransFlags rpmtsFlags(rpmts ts)
/*@*/;
rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
/*@modifies ts @*/;
rpmdepFlags rpmtsDFlags(rpmts ts)
/*@*/;
rpmdepFlags rpmtsSetDFlags(rpmts ts, rpmdepFlags depFlags)
/*@modifies ts @*/;
/*@null@*/
Spec rpmtsSpec(rpmts ts)
/*@*/;
/*@null@*/
Spec rpmtsSetSpec(rpmts ts, /*@null@*/ Spec spec)
/*@modifies ts @*/;
/*@null@*/
rpmte rpmtsRelocateElement(rpmts ts)
/*@*/;
/*@null@*/
rpmte rpmtsSetRelocateElement(rpmts ts, /*@null@*/ rpmte relocateElement)
/*@modifies ts @*/;
tsmStage rpmtsGoal(rpmts ts)
/*@*/;
tsmStage rpmtsSetGoal(rpmts ts, tsmStage goal)
/*@modifies ts @*/;
int rpmtsDBMode(rpmts ts)
/*@*/;
int rpmtsSetDBMode(rpmts ts, int dbmode)
/*@modifies ts @*/;
rpmuint32_t rpmtsColor(rpmts ts)
/*@*/;
rpmuint32_t rpmtsPrefColor(rpmts ts)
/*@*/;
rpmuint32_t rpmtsSetColor(rpmts ts, rpmuint32_t color)
/*@modifies ts @*/;
/*@relnull@*/
rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
/*@*/;
int rpmtsSetNotifyCallback(rpmts ts,
/*@observer@*/ rpmCallbackFunction notify,
/*@observer@*/ rpmCallbackData notifyData)
/*@modifies ts @*/;
/*@newref@*/
rpmts rpmtsCreate(void)
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies rpmGlobalMacroContext, internalState @*/;
/*@-redecl@*/
/*@unchecked@*/
extern int rpmcliPackagesTotal;
/*@=redecl@*/
int rpmtsAddInstallElement(rpmts ts, Header h,
/*@exposed@*/ /*@null@*/ const fnpyKey key, int upgrade,
/*@null@*/ rpmRelocation relocs)
/*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/
/*@modifies ts, h, rpmcliPackagesTotal, rpmGlobalMacroContext,
fileSystem, internalState @*/;
int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
#if !defined(SWIG)
#if defined(_RPMTS_PRINT)
/*@unused@*/ static inline
int rpmtsPrint(/*@null@*/ rpmts ts, /*@null@*/ FILE * fp)
/*@globals fileSystem @*/
/*@modifies ts, *fp, fileSystem @*/
{
rpmuint32_t tid = rpmtsGetTid(ts);
time_t ttid = tid;
rpmtsi tsi;
rpmte te;
if (fp == NULL)
fp = stderr;
fprintf(fp, _("=== Transaction at %-24.24s (0x%08x):\n"), ctime(&ttid),tid);
tsi = rpmtsiInit(ts);
while ((te = rpmtsiNext(tsi, 0)) != NULL)
fprintf(fp, "t%s> %s\n", (rpmteType(te) == TR_ADDED ? "I" : "E"),
rpmteNEVRA(te));
tsi = rpmtsiFree(tsi);
return 0;
}
#endif /* defined(_RPMTS_PRINT) */
#endif /* !defined(SWIG) */
#ifdef __cplusplus
}
#endif
#endif /* H_RPMTS */