Main Page Modules Data Structures File List Data Fields Globals Related Pages

# lib/rpmcli.h

Go to the documentation of this file.

    00001 #ifndef H_RPMCLI
    00002 #define H_RPMCLI
    00003
    00008 #include "rpmlib.h"
    00009 #include "rpmurl.h"
    00010 #include "rpmmacro.h"
    00011
    00015 /*@-redecl@*/
    00016 /*@unchecked@*/
    00017 extern int _noDirTokens;
    00018 /*@=redecl@*/
    00019
    00020 #ifdef __cplusplus
    00021 extern "C" {
    00022 #endif
    00023
    00024 /* ==================================================================== */
    00027
    00031 struct rpmBuildArguments_s {
    00032     int buildAmount;
    00033 /*@null@*/
    00034     const char * buildRootOverride;
    00035 /*@null@*/
    00036     char * targets;
    00037     int force;
    00038     int noBuild;
    00039     int noDeps;
    00040     int noLang;
    00041     int shortCircuit;
    00042     int sign;
    00043     int useCatalog;
    00044     char buildMode;
    00045     char buildChar;
    00046 /*@observer@*/ /*@null@*/
    00047     const char * rootdir;
    00048 };
    00049
    00052 typedef struct rpmBuildArguments_s *    BTA_t;
    00053
    00056 /*@unchecked@*/
    00057 extern struct rpmBuildArguments_s       rpmBTArgs;
    00058
    00061 /*@unchecked@*/
    00062 extern struct poptOption                rpmBuildPoptTable[];
    00063
    00065 /* ==================================================================== */
    00068
    00073 typedef enum rpmQueryFlags_e {
    00074     QUERY_FOR_DEFAULT   = 0,
    00075 /*@-enummemuse@*/
    00076     QUERY_MD5           = (1 << 0),
    00077     QUERY_SIZE          = (1 << 1),
    00078     QUERY_LINKTO        = (1 << 2),
    00079     QUERY_USER          = (1 << 3),
    00080     QUERY_GROUP         = (1 << 4),
    00081     QUERY_MTIME         = (1 << 5),
    00082     QUERY_MODE          = (1 << 6),
    00083     QUERY_RDEV          = (1 << 7),
    00084         /* bits 8-15 unused, reserved for rpmVerifyAttrs */
    00085     QUERY_FILES         = (1 << 16),
    00086     QUERY_DEPS          = (1 << 17),
    00087     QUERY_SCRIPT        = (1 << 18),
    00088     QUERY_DIGEST        = (1 << 19),
    00089 /*@=enummemuse@*/
    00090         /* bits 20-22 unused */
    00091     QUERY_FOR_LIST      = (1 << 23),
    00092     QUERY_FOR_STATE     = (1 << 24),
    00093     QUERY_FOR_DOCS      = (1 << 25),
    00094     QUERY_FOR_CONFIG    = (1 << 26),
    00095     QUERY_FOR_DUMPFILES = (1 << 27)
    00096 } rpmQueryFlags;
    00097
    00102 typedef enum rpmVerifyFlags_e {
    00103 /*@-enummemuse@*/
    00104     VERIFY_DEFAULT      = 0,
    00105 /*@=enummemuse@*/
    00106     VERIFY_MD5          = (1 << 0),
    00107     VERIFY_SIZE         = (1 << 1),
    00108     VERIFY_LINKTO       = (1 << 2),
    00109     VERIFY_USER         = (1 << 3),
    00110     VERIFY_GROUP        = (1 << 4),
    00111     VERIFY_MTIME        = (1 << 5),
    00112     VERIFY_MODE         = (1 << 6),
    00113     VERIFY_RDEV         = (1 << 7),
    00114         /* bits 8-15 unused, reserved for rpmVerifyAttrs */
    00115     VERIFY_FILES        = (1 << 16),
    00116     VERIFY_DEPS         = (1 << 17),
    00117     VERIFY_SCRIPT       = (1 << 18),
    00118     VERIFY_DIGEST       = (1 << 19),
    00119         /* bits 20-22 unused */
    00120 /*@-enummemuse@*/
    00121     VERIFY_FOR_LIST     = (1 << 23),
    00122     VERIFY_FOR_STATE    = (1 << 24),
    00123     VERIFY_FOR_DOCS     = (1 << 25),
    00124     VERIFY_FOR_CONFIG   = (1 << 26),
    00125     VERIFY_FOR_DUMPFILES= (1 << 27)
    00126 /*@=enummemuse@*/
    00127         /* bits 28-30 used in rpmVerifyAttrs */
    00128 } rpmVerifyFlags;
    00129
    00130 #define VERIFY_ATTRS    \
    00131   ( VERIFY_MD5 | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \
    00132     VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV )
    00133 #define VERIFY_ALL      \
    00134   ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST )
    00135
    00141 typedef int (*QVF_t) (QVA_t qva, rpmdb db, Header h)
    00142         /*@globals fileSystem @*/
    00143         /*@modifies db, fileSystem @*/;
    00144
    00152 int showMatches(QVA_t qva, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi,
    00153                 QVF_t showPackage)
    00154         /*@modifies mi @*/;
    00155
    00160 void rpmDisplayQueryTags(FILE * fp)
    00161         /*@globals fileSystem @*/
    00162         /*@modifies *fp, fileSystem @*/;
    00163
    00173 int rpmQueryVerify(QVA_t qva, rpmQVSources source, const char * arg,
    00174                 rpmdb db, QVF_t showPackage)
    00175         /*@globals rpmGlobalMacroContext, fileSystem @*/
    00176         /*@modifies db, rpmGlobalMacroContext, fileSystem @*/;
    00177
    00186 int showQueryPackage(QVA_t qva, rpmdb db, Header h)
    00187         /*@globals fileSystem @*/
    00188         /*@modifies db, fileSystem @*/;
    00189
    00198 int rpmQuery(QVA_t qva, rpmQVSources source, const char * arg)
    00199         /*@globals rpmGlobalMacroContext, fileSystem @*/
    00200         /*@modifies rpmGlobalMacroContext, fileSystem @*/;
    00201
    00209 int showVerifyPackage(QVA_t qva, /*@only@*/ rpmdb db, Header h)
    00210         /*@globals rpmGlobalMacroContext, fileSystem @*/
    00211         /*@modifies db, h, rpmGlobalMacroContext, fileSystem @*/;
    00212
    00219 int rpmVerifyDigest(Header h)
    00220         /*@modifies nothing @*/;
    00221
    00229 int rpmVerify(QVA_t qva, rpmQVSources source, const char *arg)
    00230         /*@globals rpmGlobalMacroContext, fileSystem @*/
    00231         /*@modifies rpmGlobalMacroContext, fileSystem @*/;
    00232
    00236 struct rpmQVArguments_s {
    00237     rpmQVSources qva_source;
    00238     int         qva_sourceCount;
    00239     rpmQueryFlags qva_flags;
    00240     rpmfileAttrs qva_fflags;
    00241 /*@unused@*/
    00242     int qva_verbose;
    00243 /*@only@*/ /*@null@*/
    00244     const char * qva_queryFormat;
    00245 /*@observer@*/ /*@null@*/
    00246     const char * qva_prefix;
    00247     char        qva_mode;
    00248     char        qva_char;
    00249 };
    00250
    00253 /*@unchecked@*/
    00254 extern struct rpmQVArguments_s rpmQVArgs;
    00255
    00258 /*@unchecked@*/
    00259 extern struct poptOption rpmQVSourcePoptTable[];
    00260
    00263 /*@unchecked@*/
    00264 extern int specedit;
    00265
    00268 /*@unchecked@*/
    00269 extern struct poptOption rpmQueryPoptTable[];
    00270
    00273 /*@unchecked@*/
    00274 extern struct poptOption rpmVerifyPoptTable[];
    00275
    00277 /* ==================================================================== */
    00280 /* --- install/upgrade/erase modes */
    00281
    00292 int rpmInstall(/*@null@*/ const char * rootdir,
    00293                 /*@null@*/ const char ** fileArgv,
    00294                 rpmtransFlags transFlags,
    00295                 rpmInstallInterfaceFlags interfaceFlags,
    00296                 rpmprobFilterFlags probFilter,
    00297                 /*@null@*/ rpmRelocation * relocations)
    00298         /*@globals rpmGlobalMacroContext, fileSystem @*/
    00299         /*@modifies *relocations, rpmGlobalMacroContext, fileSystem @*/;
    00300
    00309 int rpmInstallSource(const char * rootdir, const char * arg,
    00310                 /*@null@*/ /*@out@*/ const char ** specFile,
    00311                 /*@null@*/ /*@out@*/ char ** cookie)
    00312         /*@globals fileSystem @*/
    00313         /*@modifies *specFile, *cookie, fileSystem @*/;
    00314
    00323 int rpmErase(/*@null@*/ const char * rootdir, /*@null@*/ const char ** argv,
    00324                 rpmtransFlags transFlags,
    00325                 rpmEraseInterfaceFlags interfaceFlags)
    00326         /*@globals rpmGlobalMacroContext, fileSystem @*/
    00327         /*@modifies rpmGlobalMacroContext, fileSystem @*/;
    00328
    00332 struct rpmInstallArguments_s {
    00333     rpmtransFlags transFlags;
    00334     rpmprobFilterFlags probFilter;
    00335     rpmInstallInterfaceFlags installInterfaceFlags;
    00336     rpmEraseInterfaceFlags eraseInterfaceFlags;
    00337 /*@only@*/ /*@null@*/
    00338     rpmRelocation * relocations;
    00339     int numRelocations;
    00340     int noDeps;
    00341     int incldocs;
    00342 /*@null@*/
    00343     const char * prefix;
    00344 /*@observer@*/ /*@null@*/
    00345     const char * rootdir;
    00346     uint_32 rbtid;
    00347 };
    00348
    00352 typedef /*@abstract@*/ struct IDT_s {
    00353     unsigned int instance;
    00354 /*@owned@*/ /*@null@*/
    00355     const char * key;
    00356     Header h;
    00357     const char * n;
    00358     const char * v;
    00359     const char * r;
    00360     union {
    00361         uint_32 u32;
    00362     } val;
    00363 } * IDT;
    00364
    00368 typedef /*@abstract@*/ struct IDTindex_s {
    00369     int delta;
    00370     int size;
    00371     int alloced;
    00372     int nidt;
    00373 /*@only@*/ /*@null@*/
    00374     IDT idt;
    00375 } * IDTX;
    00376
    00382 /*@null@*/ IDTX IDTXfree(/*@only@*/ /*@null@*/ IDTX idtx)
    00383         /*@modifies idtx @*/;
    00384
    00389 /*@only@*/ IDTX IDTXnew(void)
    00390         /*@*/;
    00391
    00398 /*@only@*/ /*@null@*/ IDTX IDTXgrow(/*@only@*/ /*@null@*/ IDTX idtx, int need)
    00399         /*@modifies idtx @*/;
    00400
    00406 /*@only@*/ /*@null@*/ IDTX IDTXsort(/*@only@*/ /*@null@*/ IDTX idtx)
    00407         /*@modifies idtx @*/;
    00408
    00415 /*@only@*/ /*@null@*/ IDTX IDTXload(rpmdb db, rpmTag tag)
    00416         /*@modifies db @*/;
    00417
    00424 /*@only@*/ /*@null@*/ IDTX IDTXglob(const char * globstr, rpmTag tag)
    00425         /*@globals fileSystem @*/
    00426         /*@modifies fileSystem @*/;
    00427
    00428
    00442 /*@null@*/ void * rpmShowProgress(/*@null@*/ const void * arg,
    00443                 const rpmCallbackType what,
    00444                 const unsigned long amount,
    00445                 const unsigned long total,
    00446                 /*@null@*/ const void * pkgKey,
    00447                 /*@null@*/ void * data)
    00448         /*@globals internalState, fileSystem @*/
    00449         /*@modifies internalState, fileSystem @*/;
    00450
    00451 /*@unchecked@*/
    00452 extern int packagesTotal;
    00453
    00458 int rpmRollback(struct rpmInstallArguments_s * ia,
    00459                 /*@null@*/ const char ** argv)
    00460         /*@globals rpmGlobalMacroContext, fileSystem @*/
    00461         /*@modifies rpmGlobalMacroContext, fileSystem @*/;
    00462
    00465 /*@unchecked@*/
    00466 extern struct rpmInstallArguments_s rpmIArgs;
    00467
    00470 /*@unchecked@*/
    00471 extern struct poptOption rpmInstallPoptTable[];
    00472
    00474 /* ==================================================================== */
    00477 /* --- database modes */
    00478
    00482 struct rpmDatabaseArguments_s {
    00483     int init;
    00484     int rebuild;
    00485     int verify;
    00486 };
    00487
    00490 /*@unchecked@*/
    00491 extern struct rpmDatabaseArguments_s rpmDBArgs;
    00492
    00495 /*@unchecked@*/
    00496 extern struct poptOption rpmDatabasePoptTable[];
    00497
    00499 /* ==================================================================== */
    00502
    00506 typedef enum rpmCheckSigFlags_e {
    00507 /*@-enummemuse@*/
    00508     CHECKSIG_NONE       = 0,
    00509 /*@=enummemuse@*/
    00510     CHECKSIG_PGP        = (1 << 0),
    00511     CHECKSIG_MD5        = (1 << 1),
    00512     CHECKSIG_GPG        = (1 << 2)
    00513 } rpmCheckSigFlags;
    00514 #define CHECKSIG_ALL    (CHECKSIG_PGP|CHECKSIG_MD5|CHECKSIG_GPG)
    00515
    00522 int rpmCheckSig(rpmCheckSigFlags flags, /*@null@*/ const char ** argv)
    00523         /*@globals rpmGlobalMacroContext, fileSystem @*/
    00524         /*@modifies rpmGlobalMacroContext, fileSystem @*/;
    00525
    00529 typedef enum rpmResignFlags_e {
    00530     RESIGN_NONE = 0,
    00531     RESIGN_CHK_SIGNATURE = 1,
    00532     RESIGN_NEW_SIGNATURE,
    00533     RESIGN_ADD_SIGNATURE
    00534 } rpmResignFlags;
    00535
    00543 int rpmReSign(rpmResignFlags add, char * passPhrase,
    00544                 /*@null@*/ const char ** argv)
    00545         /*@globals rpmGlobalMacroContext, fileSystem @*/
    00546         /*@modifies rpmGlobalMacroContext, fileSystem @*/;
    00547
    00551 struct rpmSignArguments_s {
    00552     rpmResignFlags addSign;
    00553     rpmCheckSigFlags checksigFlags;
    00554     int sign;
    00555 /*@unused@*/ char * passPhrase;
    00556 };
    00557
    00560 /*@unchecked@*/
    00561 extern struct rpmSignArguments_s rpmKArgs;
    00562
    00565 /*@unchecked@*/
    00566 extern struct poptOption rpmSignPoptTable[];
    00567
    00570 #ifdef __cplusplus
    00571 }
    00572 #endif
    00573
    00574 #endif  /* H_RPMCLI */