rpmcli.h
Go to the documentation of this file.
#ifndef H_RPMCLI
#define H_RPMCLI
#include <popt.h>
#include <rpmmacro.h>
#include <rpmtypes.h>
#include <rpmtag.h>
#include <rpmps.h>
#include <rpmrc.h>
#include <rpmfi.h> /* XXX rpmfileAttrs */
#include <rpmts.h> /* XXX rpmdepFlags */
/*@-redecl@*/
/*@unchecked@*/
extern headerSprintfExtension rpmHeaderFormats;
/*@=redecl@*/
/*@-redecl@*/
/*@unchecked@*/
extern int _noDirTokens;
/*@=redecl@*/
#ifdef __cplusplus
extern "C" {
#endif
/*@unchecked@*/
extern struct poptOption rpmcliAllPoptTable[];
/*@unchecked@*/
extern int global_depFlags;
/*@unchecked@*/
extern struct poptOption rpmcliDepFlagsPoptTable[];
/*@unchecked@*/ /*@observer@*/ /*@null@*/
extern const char * rpmcliTargets;
/*@=redecl@*/
/*@null@*/
poptContext
rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
/*@globals rpmCLIMacroContext, rpmGlobalMacroContext, h_errno, stderr,
fileSystem, internalState @*/
/*@modifies rpmCLIMacroContext, rpmGlobalMacroContext, stderr,
fileSystem, internalState @*/;
/*@mayexit@*/
void rpmcliConfigured(void)
/*@globals rpmCLIMacroContext,
rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies rpmCLIMacroContext, rpmGlobalMacroContext,
fileSystem, internalState @*/;
poptContext
rpmcliFini(/*@only@*/ /*@null@*/ poptContext optCon)
/*@globals rpmTags, rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies optCon, rpmTags, rpmGlobalMacroContext,
fileSystem, internalState @*/;
#define RPMCLI_POPT_NODEPS -1026
#define RPMCLI_POPT_NOFDIGESTS -1027
#define RPMCLI_POPT_NOSCRIPTS -1028
#define RPMCLI_POPT_NOSIGNATURE -1029
#define RPMCLI_POPT_NODIGEST -1030
#define RPMCLI_POPT_NOHDRCHK -1031
#define RPMCLI_POPT_NOCONTEXTS -1032
#define RPMCLI_POPT_TARGETPLATFORM -1033
/* ==================================================================== */
typedef enum rpmQVSources_e {
RPMQV_PACKAGE = 0,
RPMQV_PATH,
RPMQV_ALL,
RPMQV_RPM,
RPMQV_GROUP = RPMTAG_GROUP,
RPMQV_WHATPROVIDES,
RPMQV_WHATREQUIRES,
RPMQV_TRIGGEREDBY = RPMTAG_TRIGGERNAME,
RPMQV_DBOFFSET,
RPMQV_SPECFILE,
RPMQV_PKGID,
RPMQV_HDRID,
RPMQV_FILEID,
RPMQV_TID,
RPMQV_HDLIST,
RPMQV_FTSWALK,
RPMQV_WHATNEEDS,
RPMQV_SPECSRPM,
RPMQV_SOURCEPKGID,
RPMQV_WHATCONFLICTS = RPMTAG_CONFLICTNAME,
RPMQV_WHATOBSOLETES = RPMTAG_OBSOLETENAME
} rpmQVSources;
typedef enum rpmVerifyAttrs_e {
RPMVERIFY_NONE = 0,
RPMVERIFY_FDIGEST = (1 << 0),
RPMVERIFY_FILESIZE = (1 << 1),
RPMVERIFY_LINKTO = (1 << 2),
RPMVERIFY_USER = (1 << 3),
RPMVERIFY_GROUP = (1 << 4),
RPMVERIFY_MTIME = (1 << 5),
RPMVERIFY_MODE = (1 << 6),
RPMVERIFY_RDEV = (1 << 7),
/* bits 8-14 unused, reserved for rpmVerifyAttrs */
RPMVERIFY_CONTEXTS = (1 << 15),
/* bits 16-22 used in rpmVerifyFlags */
/* bits 23-27 used in rpmQueryFlags */
RPMVERIFY_READLINKFAIL= (1 << 28),
RPMVERIFY_READFAIL = (1 << 29),
RPMVERIFY_LSTATFAIL = (1 << 30),
RPMVERIFY_LGETFILECONFAIL = (1 << 31)
} rpmVerifyAttrs;
#define RPMVERIFY_MD5 RPMVERIFY_FDIGEST
#define RPMVERIFY_ALL ~(RPMVERIFY_NONE)
#define RPMVERIFY_FAILURES \
(RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_LGETFILECONFAIL)
typedef enum rpmQueryFlags_e {
/*@-enummemuse@*/
QUERY_FOR_DEFAULT = 0,
QUERY_FDIGEST = (1 << 0),
QUERY_SIZE = (1 << 1),
QUERY_LINKTO = (1 << 2),
QUERY_USER = (1 << 3),
QUERY_GROUP = (1 << 4),
QUERY_MTIME = (1 << 5),
QUERY_MODE = (1 << 6),
QUERY_RDEV = (1 << 7),
/* bits 8-14 unused, reserved for rpmVerifyAttrs */
QUERY_CONTEXTS = (1 << 15),
QUERY_FILES = (1 << 16),
QUERY_DEPS = (1 << 17),
QUERY_SCRIPT = (1 << 18),
QUERY_DIGEST = (1 << 19),
QUERY_SIGNATURE = (1 << 20),
QUERY_PATCHES = (1 << 21),
QUERY_HDRCHK = (1 << 22),
/*@=enummemuse@*/
QUERY_FOR_LIST = (1 << 23),
QUERY_FOR_STATE = (1 << 24),
QUERY_FOR_DOCS = (1 << 25),
QUERY_FOR_CONFIG = (1 << 26),
QUERY_FOR_DUMPFILES = (1 << 27)
} rpmQueryFlags;
#define _QUERY_FOR_BITS \
(QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
QUERY_FOR_DUMPFILES)
/*@unchecked@*/
extern rpmQueryFlags rpmcliQueryFlags;
typedef enum rpmVerifyFlags_e {
/*@-enummemuse@*/
VERIFY_DEFAULT = 0,
/*@=enummemuse@*/
VERIFY_FDIGEST = (1 << 0),
VERIFY_SIZE = (1 << 1),
VERIFY_LINKTO = (1 << 2),
VERIFY_USER = (1 << 3),
VERIFY_GROUP = (1 << 4),
VERIFY_MTIME = (1 << 5),
VERIFY_MODE = (1 << 6),
VERIFY_RDEV = (1 << 7),
/* bits 8-14 unused, reserved for rpmVerifyAttrs */
VERIFY_CONTEXTS = (1 << 15),
VERIFY_FILES = (1 << 16),
VERIFY_DEPS = (1 << 17),
VERIFY_SCRIPT = (1 << 18),
VERIFY_DIGEST = (1 << 19),
VERIFY_SIGNATURE = (1 << 20),
VERIFY_PATCHES = (1 << 21),
VERIFY_HDRCHK = (1 << 22),
/*@-enummemuse@*/
VERIFY_FOR_LIST = (1 << 23),
VERIFY_FOR_STATE = (1 << 24),
VERIFY_FOR_DOCS = (1 << 25),
VERIFY_FOR_CONFIG = (1 << 26),
VERIFY_FOR_DUMPFILES= (1 << 27)
/*@=enummemuse@*/
/* bits 28-31 used in rpmVerifyAttrs */
} rpmVerifyFlags;
#define VERIFY_ATTRS \
( VERIFY_FDIGEST | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \
VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV | VERIFY_CONTEXTS )
#define VERIFY_ALL \
( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST |\
VERIFY_SIGNATURE | VERIFY_HDRCHK )
typedef struct rpmQVKArguments_s * QVA_t;
typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h)
/*@globals fileSystem @*/
/*@modifies qva, ts, fileSystem @*/;
typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg)
/*@globals rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/
/*@modifies ts, qva, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/*@unchecked@*/
extern struct poptOption rpmQVSourcePoptTable[];
/*@unchecked@*/
extern int specedit;
/*@unchecked@*/
extern struct poptOption rpmQueryPoptTable[];
/*@unchecked@*/
extern struct poptOption rpmVerifyPoptTable[];
int rpmcliShowMatches(QVA_t qva, rpmts ts)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies qva, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
/*@globals rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/
/*@modifies qva, ts, rpmGlobalMacroContext,
fileSystem, internalState @*/;
int showQueryPackage(QVA_t qva, rpmts ts, Header h)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmcliArgIter(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/
/*@modifies ts, qva, rpmGlobalMacroContext,
fileSystem, internalState @*/;
int rpmcliQuery(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/
/*@modifies ts, qva, rpmGlobalMacroContext,
fileSystem, internalState @*/;
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmVerifySignatures(QVA_t qva, rpmts ts, void * _fd, const char * fn)
/*@globals fileSystem, internalState @*/
/*@modifies qva, ts, fileSystem, internalState @*/;
int rpmcliVerify(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/
/*@modifies ts, qva, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/* ==================================================================== */
/* --- install/upgrade/erase modes */
typedef enum rpmInstallInterfaceFlags_e {
INSTALL_NONE = 0,
INSTALL_PERCENT = (1 << 0),
INSTALL_HASH = (1 << 1),
INSTALL_NODEPS = (1 << 2),
INSTALL_NOORDER = (1 << 3),
INSTALL_LABEL = (1 << 4),
INSTALL_UPGRADE = (1 << 5),
INSTALL_FRESHEN = (1 << 6),
INSTALL_INSTALL = (1 << 7),
INSTALL_ERASE = (1 << 8),
INSTALL_ALLMATCHES = (1 << 9)
} rpmInstallInterfaceFlags;
/*@-redecl@*/
/*@unchecked@*/
extern int rpmcliPackagesTotal;
/*@=redecl@*/
/*@unchecked@*/
extern int rpmcliHashesCurrent;
/*@unchecked@*/
extern int rpmcliHashesTotal;
/*@unchecked@*/
extern rpmuint64_t rpmcliProgressCurrent;
/*@unchecked@*/
extern rpmuint64_t rpmcliProgressTotal;
/*@null@*/
void * rpmShowProgress(/*@null@*/ const void * arg,
const rpmCallbackType what,
const rpmuint64_t amount,
const rpmuint64_t total,
/*@null@*/ fnpyKey key,
/*@null@*/ void * data)
/*@globals rpmcliHashesCurrent,
rpmcliProgressCurrent, rpmcliProgressTotal,
h_errno, rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies arg, rpmcliHashesCurrent,
rpmcliProgressCurrent, rpmcliProgressTotal,
rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmInstallSource(rpmts ts, const char * arg,
/*@null@*/ /*@out@*/ const char ** specFilePtr,
/*@null@*/ /*@out@*/ const char ** cookie)
/*@globals rpmGlobalMacroContext, h_errno,
fileSystem, internalState@*/
/*@modifies ts, *specFilePtr, *cookie, rpmGlobalMacroContext,
fileSystem, internalState @*/;
int rpmcliInstallProblems(rpmts ts, /*@null@*/ const char * msg, int rc)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem, internalState @*/;
int rpmcliInstallSuggests(rpmts ts)
/*@globals internalState @*/
/*@modifies ts, internalState @*/;
int rpmcliInstallCheck(rpmts ts)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmcliInstallOrder(rpmts ts)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmcliInstallRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
int rpmcliInstall(rpmts ts, QVA_t ia, /*@null@*/ const char ** argv)
/*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno,
fileSystem, internalState@*/
/*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext,
fileSystem, internalState @*/;
int rpmErase(rpmts ts, QVA_t ia, /*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies ts, ia, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/*@unchecked@*/
extern struct poptOption rpmInstallPoptTable[];
/* ==================================================================== */
/*@unchecked@*/
extern struct poptOption rpmDatabasePoptTable[];
/* ==================================================================== */
rpmRC rpmcliImportPubkey(const rpmts ts,
const unsigned char * pkt, ssize_t pktlen)
/*@globals rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/*@-typeuse@*/
#if !defined(SWIG)
typedef enum rpmSignFlags_e {
RPMSIGN_NONE = 0,
RPMSIGN_CHK_SIGNATURE = 'K',
RPMSIGN_NEW_SIGNATURE = 'R',
RPMSIGN_ADD_SIGNATURE = 'A',
RPMSIGN_DEL_SIGNATURE = 'D',
RPMSIGN_IMPORT_PUBKEY = 'I',
} rpmSignFlags;
#endif
/*@=typeuse@*/
/*@unchecked@*/
extern struct poptOption rpmSignPoptTable[];
int rpmcliSign(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext, h_errno,
fileSystem, internalState @*/
/*@modifies ts, qva, rpmGlobalMacroContext,
fileSystem, internalState @*/;
#if !defined(SWIG)
struct rpmQVKArguments_s {
rpmQVSources qva_source;
int qva_sourceCount;
rpmQueryFlags qva_flags;
rpmfileAttrs qva_fflags;
/*@only@*/ /*@null@*/
rpmmi qva_mi;
/*@refccounted@*/ /*@relnull@*/
rpmgi qva_gi;
rpmRC qva_rc;
/*@null@*/
QVF_t qva_showPackage;
int qva_showOK;
int qva_showFAIL;
/*@null@*/
QSpecF_t qva_specQuery;
/*@unused@*/
int qva_verbose;
/*@only@*/ /*@null@*/
const char * qva_queryFormat;
int sign;
int nopassword;
int trust;
/*@observer@*/
const char * passPhrase;
/*@owned@*/ /*@null@*/
const char * qva_prefix;
char qva_mode;
char qva_char;
/* install/erase mode arguments */
rpmdepFlags depFlags;
rpmtransFlags transFlags;
rpmprobFilterFlags probFilter;
rpmInstallInterfaceFlags installInterfaceFlags;
rpmuint32_t arbtid;
rpmuint32_t rbtid;
rpmuint32_t *rbtidExcludes;
int numrbtidExcludes;
int noDeps;
int incldocs;
int no_rollback_links;
/*@owned@*/ /*@relnull@*/
rpmRelocation relocations;
int nrelocations;
/* database mode arguments */
int init;
int rebuild;
int verify;
/* rollback vectors */
int (*rbCheck) (rpmts ts);
int (*rbOrder) (rpmts ts);
int (*rbRun) (rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet);
};
#endif
/*@unchecked@*/
extern struct rpmQVKArguments_s rpmQVKArgs;
/*@unchecked@*/
extern struct rpmQVKArguments_s rpmIArgs;
/*@unchecked@*/
extern struct rpmQVKArguments_s rpmDBArgs;
/* ==================================================================== */
struct rpmBuildArguments_s {
rpmQueryFlags qva_flags;
int buildAmount;
/*@observer@*/
const char * passPhrase;
/*@only@*/ /*@null@*/
const char * cookie;
int noBuild;
int noDeps;
int noLang;
int shortCircuit;
int sign;
int nopassword;
int useCatalog;
char buildMode;
char buildChar;
/*@observer@*/ /*@null@*/
const char * rootdir;
};
typedef struct rpmBuildArguments_s * BTA_t;
/*@unchecked@*/
extern struct rpmBuildArguments_s rpmBTArgs;
/*@unchecked@*/
extern struct poptOption rpmBuildPoptTable[];
#ifdef __cplusplus
}
#endif
#endif /* H_RPMCLI */