rpmte.h
Go to the documentation of this file.
#ifndef H_RPMTE
#define H_RPMTE
#include <rpmfi.h>
/*@-exportlocal@*/
/*@unchecked@*/
extern int _rpmte_debug;
/*@=exportlocal@*/
typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
typedef /*@abstract@*/ /*@refcounted@*/ struct rpmtsi_s *rpmtsi;
typedef enum rpmElementType_e {
TR_ADDED = (1 << 0),
TR_REMOVED = (1 << 1)
} rpmElementType;
#if defined(_RPMTE_INTERNAL)
#include <argv.h>
#include <rpmal.h>
/*@-fielduse@*/ /* LCL: confused by union? */
struct tsortInfo_s {
union {
int count;
/*@exposed@*/ /*@dependent@*/ /*@null@*/
rpmte suc;
} tsi_u;
#define tsi_count tsi_u.count
#define tsi_suc tsi_u.suc
/*@owned@*/ /*@null@*/
tsortInfo tsi_next;
/*@exposed@*/ /*@dependent@*/ /*@null@*/
rpmte tsi_chain;
int tsi_tagn;
int tsi_reqx;
int tsi_queued;
int tsi_qcnt;
};
/*@=fielduse@*/
struct rpmChainLink_s {
/*@only@*/ /*@null@*/
ARGV_t Pkgid;
/*@only@*/ /*@null@*/
ARGV_t Hdrid;
/*@only@*/ /*@null@*/
ARGV_t NEVRA;
};
typedef struct sharedFileInfo_s * sharedFileInfo;
struct sharedFileInfo_s {
rpmuint32_t pkgFileNum;
rpmuint32_t otherFileNum;
rpmuint32_t otherPkg;
rpmuint32_t isRemoved;
};
struct rpmte_s {
struct rpmioItem_s _item;
rpmElementType type;
/*@refcounted@*/ /*@relnull@*/
Header h;
/*@only@*/
const char * NEVR;
/*@only@*/
const char * NEVRA;
/*@only@*/ /*@relnull@*/
const char * pkgid;
/*@only@*/ /*@relnull@*/
const char * hdrid;
/*@only@*/ /*@null@*/
const char * sourcerpm;
/*@only@*/
const char * name;
/*@only@*/ /*@null@*/
char * epoch;
/*@only@*/ /*@null@*/
char * version;
/*@only@*/ /*@null@*/
char * release;
#ifdef RPM_VENDOR_MANDRIVA
/*@only@*/ /*@null@*/
char * distepoch;
#endif
/*@only@*/ /*@null@*/
const char * arch;
/*@only@*/ /*@null@*/
const char * os;
int isSource;
rpmte parent;
int degree;
int npreds;
int tree;
int depth;
int breadth;
unsigned int db_instance;
/*@owned@*/
tsortInfo tsi;
/*@null@*/
rpmPRCO PRCO;
/*@refcounted@*/ /*@null@*/
rpmfi fi;
rpmuint32_t depFlags;
rpmuint32_t transFlags;
rpmuint32_t color;
rpmuint32_t pkgFileSize;
/*@exposed@*/ /*@dependent@*/ /*@null@*/
fnpyKey key;
/*@owned@*/ /*@null@*/
rpmRelocation relocs;
int nrelocs;
int autorelocatex;
/*@refcounted@*/ /*@null@*/
FD_t fd;
/*@owned@*/ /*@null@*/
sharedFileInfo replaced;
int nreplaced;
struct rpmChainLink_s blink;
struct rpmChainLink_s flink;
int linkFailed;
int done;
rpmuint32_t originTid[2];
rpmuint32_t originTime[2];
int installed;
int downgrade;
struct {
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey addedKey;
struct {
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey dependsOnKey;
int dboffset;
} removed;
} u;
#if defined(__LCLINT__)
/*@refs@*/
int nrefs;
#endif
};
struct rpmtsi_s {
struct rpmioItem_s _item;
/*@refcounted@*/
rpmts ts;
int reverse;
int ocsave;
int oc;
#if defined(__LCLINT__)
/*@refs@*/
int nrefs;
#endif
};
#endif /* _RPMTE_INTERNAL */
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_RPMTE_INTERNAL)
/*@unused@*/ /*@null@*/
rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
/*@globals fileSystem @*/
/*@modifies te, fileSystem @*/;
#define rpmteFree(_te) \
((rpmte) rpmioFreePoolItem((rpmioItem)(_te), __FUNCTION__, __FILE__, __LINE__))
/*@only@*/ /*@null@*/
rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
/*@null@*/ rpmRelocation relocs,
int dboffset,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey pkgKey)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
#endif /* _RPMTE_INTERNAL */
extern Header rpmteHeader(rpmte te)
/*@modifies te @*/;
extern Header rpmteSetHeader(rpmte te, Header h)
/*@modifies te, h @*/;
rpmElementType rpmteType(rpmte te)
/*@*/;
/*@observer@*/
extern const char * rpmteN(rpmte te)
/*@*/;
/*@observer@*/ /*@null@*/
extern const char * rpmteE(rpmte te)
/*@*/;
/*@observer@*/ /*@null@*/
extern const char * rpmteV(rpmte te)
/*@*/;
/*@observer@*/ /*@null@*/
extern const char * rpmteR(rpmte te)
/*@*/;
#ifdef RPM_VENDOR_MANDRIVA
/*@observer@*/ /*@null@*/
extern const char * rpmteD(rpmte te)
/*@*/;
#endif
/*@observer@*/ /*@null@*/
extern const char * rpmteA(rpmte te)
/*@*/;
/*@observer@*/ /*@null@*/
extern const char * rpmteO(rpmte te)
/*@*/;
extern int rpmteIsSource(rpmte te)
/*@*/;
rpmuint32_t rpmteColor(rpmte te)
/*@*/;
rpmuint32_t rpmteSetColor(rpmte te, rpmuint32_t color)
/*@modifies te @*/;
unsigned int rpmteDBInstance(rpmte te)
/*@*/;
void rpmteSetDBInstance(rpmte te, unsigned int instance)
/*@modifies te @*/;
rpmuint32_t rpmtePkgFileSize(rpmte te)
/*@*/;
/*@observer@*/
rpmuint32_t * rpmteOriginTid(rpmte te)
/*@*/;
/*@observer@*/
rpmuint32_t * rpmteOriginTime(rpmte te)
/*@*/;
int rpmteDepth(rpmte te)
/*@*/;
int rpmteSetDepth(rpmte te, int ndepth)
/*@modifies te @*/;
int rpmteBreadth(rpmte te)
/*@*/;
int rpmteSetBreadth(rpmte te, int nbreadth)
/*@modifies te @*/;
int rpmteNpreds(rpmte te)
/*@*/;
int rpmteSetNpreds(rpmte te, int npreds)
/*@modifies te @*/;
int rpmteTree(rpmte te)
/*@*/;
int rpmteSetTree(rpmte te, int ntree)
/*@modifies te @*/;
/*@observer@*/ /*@unused@*/
rpmte rpmteParent(rpmte te)
/*@*/;
/*@null@*/
rpmte rpmteSetParent(rpmte te, rpmte pte)
/*@modifies te @*/;
int rpmteDegree(rpmte te)
/*@*/;
int rpmteSetDegree(rpmte te, int ndegree)
/*@modifies te @*/;
tsortInfo rpmteTSI(rpmte te)
/*@*/;
void rpmteFreeTSI(rpmte te)
/*@modifies te @*/;
void rpmteNewTSI(rpmte te)
/*@modifies te @*/;
/*@unused@*/
void rpmteCleanDS(rpmte te)
/*@modifies te @*/;
#if defined(_RPMTE_INTERNAL)
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey rpmteAddedKey(rpmte te)
/*@*/;
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey rpmteSetAddedKey(rpmte te,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
/*@modifies te @*/;
#endif /* _RPMTE_INTERNAL */
int rpmteDBOffset(rpmte te)
/*@*/;
/*@observer@*/
extern const char * rpmteNEVR(rpmte te)
/*@*/;
/*@-exportlocal@*/
/*@observer@*/
extern const char * rpmteNEVRA(rpmte te)
/*@*/;
/*@=exportlocal@*/
/*@-exportlocal@*/
/*@observer@*/ /*@null@*/
extern const char * rpmtePkgid(rpmte te)
/*@*/;
/*@=exportlocal@*/
/*@-exportlocal@*/
/*@observer@*/ /*@null@*/
extern const char * rpmteHdrid(rpmte te)
/*@*/;
/*@=exportlocal@*/
/*@-exportlocal@*/
/*@observer@*/ /*@null@*/
extern const char * rpmteSourcerpm(rpmte te)
/*@*/;
/*@=exportlocal@*/
FD_t rpmteFd(rpmte te)
/*@*/;
/*@exposed@*/
fnpyKey rpmteKey(rpmte te)
/*@*/;
rpmds rpmteDS(rpmte te, rpmTag tag)
/*@*/;
rpmfi rpmteFI(rpmte te, rpmTag tag)
/*@*/;
/*@-exportlocal@*/
void rpmteColorDS(rpmte te, rpmTag tag)
/*@modifies te @*/;
/*@=exportlocal@*/
int rpmteChain(rpmte p, rpmte q, Header oh, /*@null@*/ const char * msg)
/*@globals internalState @*/
/*@modifies p, q, oh, internalState @*/;
#define RPMTE_CHAIN_END "CHAIN END"
int rpmtsiOc(rpmtsi tsi)
/*@*/;
/*@unused@*/ /*@null@*/
rpmtsi rpmtsiFree(/*@killref@*//*@null@*/ rpmtsi tsi)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
#define rpmtsiFree(_tsi) \
((rpmtsi)rpmioFreePoolItem((rpmioItem)(_tsi), __FUNCTION__, __FILE__, __LINE__))
/*@unused@*/ /*@only@*/
rpmtsi rpmtsiInit(rpmts ts)
/*@modifies ts @*/;
/*@unused@*/ /*@only@*/
rpmtsi XrpmtsiInit(rpmts ts,
const char * fn, unsigned int ln)
/*@modifies ts @*/;
#define rpmtsiInit(_ts) XrpmtsiInit(_ts, __FILE__, __LINE__)
/*@dependent@*/ /*@null@*/
rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
/*@modifies tsi @*/;
#if defined(DYING)
#if !defined(SWIG)
static inline void rpmtePrintID(rpmte p)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/
{
if (p != NULL) {
if (p->blink.Pkgid) argvPrint("blink.Pkgid", p->blink.Pkgid, NULL);
if (p->blink.Hdrid) argvPrint("blink.Hdrid", p->blink.Hdrid, NULL);
if (p->blink.NEVRA) argvPrint("blink.NEVRA", p->blink.NEVRA, NULL);
if (p->flink.Pkgid) argvPrint("flink.Pkgid", p->flink.Pkgid, NULL);
if (p->flink.Hdrid) argvPrint("flink.Hdrid", p->flink.Hdrid, NULL);
if (p->flink.NEVRA) argvPrint("flink.NEVRA", p->flink.NEVRA, NULL);
}
};
static inline void hdrPrintInstalled(Header h)
/*@globals fileSystem @*/
/*@modifies h, fileSystem @*/
{
const char * qfmt = "[%{erasednevra} O:%{packageorigin} P:%{erasedpkgid} H:%{erasedhdrid}\n]";
const char * errstr = "(unknown error)";
/*@-modobserver@*/
const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
/*@=modobserver@*/
if (str == NULL)
fprintf(stderr, "error: %s\n", errstr);
else {
fprintf(stderr, "%s", str);
str = _free(str);
}
}
static inline void hdrPrintErased(Header h)
/*@globals fileSystem @*/
/*@modifies h, fileSystem @*/
{
const char * qfmt = "[%{installednevra} O:%{packageorigin} P:%{installedpkgid} H:%{installedhdrid}\n]";
const char * errstr = "(unknown error)";
/*@-modobserver@*/
const char * str = headerSprintf(h, qfmt, rpmTagTable, rpmHeaderFormats, &errstr);
/*@=modobserver@*/
if (str == NULL)
fprintf(stderr, "error: %s\n", errstr);
else {
fprintf(stderr, "%s", str);
str = _free(str);
}
}
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* H_RPMTE */