rpmds.h
Go to the documentation of this file.
#ifndef H_RPMDS
#define H_RPMDS
#include "rpmevr.h"
#define _RPMNS_INTERNAL
#include "rpmns.h"
#include "rpmps.h"
/*@-exportlocal@*/
/*@unchecked@*/
extern int _rpmds_debug;
/*@=exportlocal@*/
/*@unchecked@*/ /*@observer@*/ /*@owned@*/ /*@null@*/
extern const char *_sysinfo_path;
/*@-exportlocal@*/
/*@unchecked@*/
extern int _rpmds_nopromote;
/*@=exportlocal@*/
#if defined(_RPMDS_INTERNAL)
#include "mire.h"
struct rpmds_s {
struct rpmioItem_s _item;
/*@observer@*/
const char * Type;
/*@only@*/ /*@null@*/
const char * DNEVR;
/*@refcounted@*/ /*@null@*/
Header h;
/*@only@*/ /*@relnull@*/
const char ** N;
/*@only@*/ /*@relnull@*/
const char ** EVR;
/*@only@*/ /*@relnull@*/
evrFlags * Flags;
/*@only@*/ /*@null@*/
rpmuint32_t * Color;
/*@only@*/ /*@null@*/
rpmuint32_t * Refs;
/*@only@*/ /*@null@*/
rpmint32_t * Result;
/*@null@*/
int (*EVRparse) (const char *evrstr, EVR_t evr); /* EVR parsing. */
int (*EVRcmp) (const char *a, const char *b); /* EVR comparison. */
struct rpmns_s ns;
/*@only@*/ /*@null@*/
miRE exclude;
int nexclude;
/*@only@*/ /*@null@*/
miRE include;
int ninclude;
/*@only@*/ /*@null@*/
const char * A;
rpmuint32_t BT;
rpmTag tagN;
rpmuint32_t Count;
int i;
unsigned l;
unsigned u;
int nopromote;
#if defined(__LCLINT__)
/*@refs@*/
int nrefs;
#endif
};
#endif /* _RPMDS_INTERNAL */
#if defined(_RPMPRCO_INTERNAL)
struct rpmPRCO_s {
struct rpmioItem_s _item;
/*@dependent@*/ /*@relnull@*/
rpmds * Pdsp;
/*@dependent@*/ /*@relnull@*/
rpmds * Rdsp;
/*@dependent@*/ /*@relnull@*/
rpmds * Cdsp;
/*@dependent@*/ /*@relnull@*/
rpmds * Odsp;
/*@dependent@*/ /*@relnull@*/
rpmds * Tdsp;
/*@dependent@*/ /*@relnull@*/
rpmds * Ddsp;
/*@dependent@*/ /*@relnull@*/
rpmds * Ldsp;
/*@refcounted@*/ /*@null@*/
rpmds this;
/*@refcounted@*/ /*@null@*/
rpmds P;
/*@refcounted@*/ /*@null@*/
rpmds R;
/*@refcounted@*/ /*@null@*/
rpmds C;
/*@refcounted@*/ /*@null@*/
rpmds O;
/*@refcounted@*/ /*@null@*/
rpmds T;
/*@refcounted@*/ /*@null@*/
rpmds D;
/*@refcounted@*/ /*@null@*/
rpmds L;
#if defined(__LCLINT__)
/*@refs@*/
int nrefs;
#endif
};
#endif /* _RPMPRCO_INTERNAL */
#ifdef __cplusplus
extern "C" {
#endif
/*@unused@*/ /*@null@*/
rpmds rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
/*@null@*/ const char * msg)
/*@modifies ds @*/;
#define rpmdsUnlink(_ds, _msg) \
((rpmds)rpmioUnlinkPoolItem((rpmioItem)(_ds), _msg, __FILE__, __LINE__))
/*@unused@*/ /*@newref@*/ /*@null@*/
rpmds rpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg)
/*@modifies ds @*/;
#define rpmdsLink(_ds, _msg) \
((rpmds)rpmioLinkPoolItem((rpmioItem)(_ds), _msg, __FILE__, __LINE__))
/*@null@*/
rpmds rpmdsFree(/*@killref@*/ /*@null@*/ rpmds ds)
/*@modifies ds @*/;
#define rpmdsFree(_ds) \
((rpmds)rpmioFreePoolItem((rpmioItem)(_ds), __FUNCTION__, __FILE__, __LINE__))
/*@null@*/
rpmds rpmdsNew(Header h, rpmTag tagN, int flags)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
/*@dependent@*/ /*@observer@*/ /*@null@*/
const char * rpmdsNewN(rpmds ds)
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies ds, rpmGlobalMacroContext, internalState @*/;
char * rpmdsNewDNEVR(const char * dspfx, rpmds ds)
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies ds, rpmGlobalMacroContext, internalState @*/;
/*@null@*/
rpmds rpmdsThis(Header h, rpmTag tagN, evrFlags Flags)
/*@globals internalState @*/
/*@modifies internalState @*/;
/*@null@*/
rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, evrFlags Flags)
/*@*/;
int rpmdsCount(/*@null@*/ const rpmds ds)
/*@*/;
int rpmdsIx(/*@null@*/ const rpmds ds)
/*@*/;
int rpmdsSetIx(/*@null@*/ rpmds ds, int ix)
/*@modifies ds @*/;
/*@observer@*/ /*@relnull@*/
extern const char * rpmdsDNEVR(/*@null@*/ const rpmds ds)
/*@*/;
/*@observer@*/ /*@null@*/
extern const char * rpmdsN(/*@null@*/ rpmds ds)
/*@globals internalState @*/
/*@modifies internalState @*/;
/*@observer@*/ /*@relnull@*/
extern const char * rpmdsEVR(/*@null@*/ const rpmds ds)
/*@*/;
evrFlags rpmdsFlags(/*@null@*/ const rpmds ds)
/*@*/;
rpmTag rpmdsTagN(/*@null@*/ const rpmds ds)
/*@*/;
/*@observer@*/ /*@relnull@*/
extern const char * rpmdsA(/*@null@*/ const rpmds ds)
/*@*/;
time_t rpmdsBT(/*@null@*/ const rpmds ds)
/*@*/;
time_t rpmdsSetBT(/*@null@*/ const rpmds ds, time_t BT)
/*@modifies ds @*/;
nsType rpmdsNSType(/*@null@*/ const rpmds ds)
/*@*/;
int rpmdsNoPromote(/*@null@*/ const rpmds ds)
/*@*/;
int rpmdsSetNoPromote(/*@null@*/ rpmds ds, int nopromote)
/*@modifies ds @*/;
/*@null@*/
void * rpmdsSetEVRparse(/*@null@*/ rpmds ds,
/*@null@*/ int (*EVRparse)(const char *everstr, EVR_t evr))
/*@modifies ds @*/;
/*@null@*/
void * rpmdsSetEVRcmp(/*@null@*/ rpmds ds,
/*@null@*/ int (*EVRcmp)(const char *a, const char *b))
/*@modifies ds @*/;
rpmuint32_t rpmdsColor(/*@null@*/ const rpmds ds)
/*@*/;
rpmuint32_t rpmdsSetColor(/*@null@*/ const rpmds ds, rpmuint32_t color)
/*@modifies ds @*/;
/*@null@*/
void * rpmdsExclude(/*@null@*/ const rpmds ds)
/*@*/;
int rpmdsNExclude(/*@null@*/ const rpmds ds)
/*@*/;
/*@null@*/
void * rpmdsInclude(/*@null@*/ const rpmds ds)
/*@*/;
int rpmdsNInclude(/*@null@*/ const rpmds ds)
/*@*/;
rpmuint32_t rpmdsRefs(/*@null@*/ const rpmds ds)
/*@*/;
rpmuint32_t rpmdsSetRefs(/*@null@*/ const rpmds ds, rpmuint32_t refs)
/*@modifies ds @*/;
rpmint32_t rpmdsResult(/*@null@*/ const rpmds ds)
/*@*/;
rpmint32_t rpmdsSetResult(/*@null@*/ const rpmds ds, rpmint32_t result)
/*@modifies ds @*/;
/*@-globuse@*/ /* FIX: rpmMessage annotation is a lie */
void rpmdsNotify(/*@null@*/ rpmds ds, /*@null@*/ const char * where, int rc)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
/*@=globuse@*/
int rpmdsNext(/*@null@*/ rpmds ds)
/*@modifies ds @*/;
/*@null@*/
rpmds rpmdsInit(/*@null@*/ rpmds ds)
/*@modifies ds @*/;
int rpmdsFind(rpmds ds, /*@null@*/ const rpmds ods)
/*@modifies ds @*/;
int rpmdsMerge(/*@null@*/ /*@out@*/ rpmds * dsp, /*@null@*/ rpmds ods)
/*@modifies *dsp, ods @*/;
int rpmdsSearch(/*@null@*/ rpmds ds, /*@null@*/ rpmds ods)
/*@modifies ds, ods @*/;
/*@unchecked@*/ /*@null@*/
extern const char * _cpuinfo_path;
int rpmdsCpuinfo(/*@out@*/ rpmds * dsp, /*@null@*/ const char * fn)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies *dsp, rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/;
int rpmdsRpmlib(rpmds * dsp, /*@null@*/ void * tblp)
/*@modifies *dsp @*/;
int rpmdsSysinfo(rpmPRCO PRCO, /*@null@*/ const char * fn)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies PRCO, rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/;
int rpmdsGetconf(rpmds * dsp, /*@null@*/ const char * path)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies *dsp, rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/;
int rpmdsMergePRCO(void * context, rpmds ds)
/*@modifies context, ds @*/;
/*@null@*/
rpmPRCO rpmdsFreePRCO(/*@only@*/ /*@null@*/ rpmPRCO PRCO)
/*@modifies PRCO @*/;
rpmPRCO rpmdsNewPRCO(/*@null@*/ Header h)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
/*@null@*/
rpmds rpmdsFromPRCO(/*@null@*/ rpmPRCO PRCO, rpmTag tagN)
/*@*/;
int rpmdsELF(const char * fn, int flags,
int (*add) (void * context, rpmds ds), void * context)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
#define RPMELF_FLAG_SKIPPROVIDES 0x1 /*<! rpmdsELF: skip provides */
#define RPMELF_FLAG_SKIPREQUIRES 0x2 /*<! rpmdsELF: skip requires */
int rpmdsLdconfig(rpmPRCO PRCO, /*@null@*/ const char * fn)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/;
#if defined(__sun)
int rpmdsRldpath(rpmPRCO PRCO, /*@null@*/ const char * rldp)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmdsCrle(rpmPRCO PRCO, /*@null@*/ const char * fn)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies *PRCO, rpmGlobalMacroContext, fileSystem, internalState @*/;
#endif
struct utsname;
int rpmdsUname(rpmds * dsp, /*@null@*/ const struct utsname * un)
/*@globals internalState @*/
/*@modifies *dsp, internalState @*/;
int rpmdsPipe(rpmds * dsp, rpmTag tagN, /*@null@*/ const char * cmd)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies *dsp, rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/;
int rpmdsCompare(const rpmds A, const rpmds B)
/*@*/;
int rpmdsMatch(const rpmds A, rpmds B)
/*@modifies B @*/;
void rpmdsProblem(/*@null@*/ rpmps ps, const char * pkgNEVR, const rpmds ds,
/*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys,
int adding)
/*@globals internalState @*/
/*@modifies ps, internalState @*/;
int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies h, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
/*@globals internalState @*/
/*@modifies internalState @*/;
int rpmdsNegateRC(const rpmds ds, int rc)
/*@*/;
/*@observer@*/
const char * rpmdsType(/*@null@*/ const rpmds ds)
/*@*/;
#if !defined(SWIG)
/*@unused@*/ static inline
int rpmdsPrint(/*@null@*/ rpmds ds, /*@null@*/ FILE * fp)
/*@globals fileSystem @*/
/*@modifies ds, *fp, fileSystem @*/
{
if (fp == NULL)
fp = stderr;
ds = rpmdsInit(ds);
while (rpmdsNext(ds) >= 0)
fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsType(ds), rpmdsDNEVR(ds)+2);
return 0;
}
/*@unused@*/ static inline
int rpmdsPrintResults(/*@null@*/ rpmds ds, /*@null@*/ FILE * fp)
/*@globals fileSystem @*/
/*@modifies ds, *fp, fileSystem @*/
{
if (fp == NULL)
fp = stderr;
ds = rpmdsInit(ds);
while (rpmdsNext(ds) >= 0) {
rpmint32_t rc = rpmdsResult(ds);
if (rc > 0)
continue;
fprintf(fp, "%6d\t%s: %s\n", rpmdsIx(ds), rpmdsType(ds), rpmdsDNEVR(ds)+2);
}
return 0;
}
/*@-mods@*/ /* XXX LCL wonky */
/*@unused@*/ static inline
int rpmdsPrintClosure(/*@null@*/ rpmds P, /*@null@*/ rpmds R,
/*@null@*/ FILE * fp)
/*@globals fileSystem @*/
/*@modifies P, R, *fp, fileSystem @*/
{
int rc;
/* Allocate the R results array (to be filled in by rpmdsSearch). */
(void) rpmdsSetResult(R, 0); /* allocate result array. */
/* Collect the rpmdsSearch results (in the R dependency set). */
R = rpmdsInit(R);
while (rpmdsNext(R) >= 0)
rc = rpmdsSearch(P, R);
return rpmdsPrintResults(R, fp);
}
/*@=mods@*/
#endif
#ifdef __cplusplus
}
#endif
#endif /* H_RPMDS */