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
    00027 /*@unchecked@*/
    00028 extern struct poptOption                rpmcliAllPoptTable[];
    00029
    00030 /*@unchecked@*/ /*@observer@*/ /*@null@*/
    00031 extern const char * rpmcliPipeOutput;
    00032
    00033 /*@unchecked@*/ /*@observer@*/ /*@null@*/
    00034 extern const char * rpmcliRcfile;
    00035
    00036 /*@unchecked@*/ /*@observer@*/ /*@null@*/
    00037 extern const char * rpmcliRootDir;
    00038
    00046 /*@null@*/
    00047 poptContext
    00048 rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
    00049         /*@globals rpmCLIMacroContext, rpmGlobalMacroContext, stderr,
    00050                 fileSystem, internalState @*/
    00051         /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext, stderr,
    00052                 fileSystem, internalState @*/;
    00053
    00058 /*@mayexit@*/
    00059 void rpmcliConfigured(void)
    00060         /*@globals rpmCLIMacroContext, rpmGlobalMacroContext,
    00061                 fileSystem, internalState @*/
    00062         /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext,
    00063                 fileSystem, internalState @*/;
    00064
    00070 poptContext
    00071 rpmcliFini(/*@only@*/ /*@null@*/ poptContext optCon)
    00072         /*@modifies optCon @*/;
    00073
    00077 #define RPMCLI_POPT_NODEPS              -1025
    00078 #define RPMCLI_POPT_FORCE               -1026
    00079 #define RPMCLI_POPT_NOMD5               -1027
    00080 #define RPMCLI_POPT_NOSCRIPTS           -1028
    00081 #define RPMCLI_POPT_NOSIGNATURE         -1029
    00082 #define RPMCLI_POPT_NODIGEST            -1030
    00083 #define RPMCLI_POPT_NOHDRCHK            -1031
    00084
    00085 /* ==================================================================== */
    00088
    00093 typedef enum rpmQVSources_e {
    00094     RPMQV_PACKAGE = 0,
    00095     RPMQV_PATH,
    00096     RPMQV_ALL,
    00097     RPMQV_RPM,
    00098     RPMQV_GROUP,
    00099     RPMQV_WHATPROVIDES,
    00100     RPMQV_WHATREQUIRES,
    00101     RPMQV_TRIGGEREDBY,
    00102     RPMQV_DBOFFSET,
    00103     RPMQV_SPECFILE,
    00104     RPMQV_PKGID,
    00105     RPMQV_HDRID,
    00106     RPMQV_FILEID,
    00107     RPMQV_TID
    00108 } rpmQVSources;
    00109
    00113 typedef enum rpmVerifyAttrs_e {
    00114     RPMVERIFY_NONE      = 0,
    00115     RPMVERIFY_MD5       = (1 << 0),
    00116     RPMVERIFY_FILESIZE  = (1 << 1),
    00117     RPMVERIFY_LINKTO    = (1 << 2),
    00118     RPMVERIFY_USER      = (1 << 3),
    00119     RPMVERIFY_GROUP     = (1 << 4),
    00120     RPMVERIFY_MTIME     = (1 << 5),
    00121     RPMVERIFY_MODE      = (1 << 6),
    00122     RPMVERIFY_RDEV      = (1 << 7),
    00123         /* bits 8-15 unused, reserved for rpmVerifyAttrs */
    00124         /* bits 16-20 used in rpmVerifyFlags */
    00125         /* bits 21-22 unused */
    00126         /* bits 23-27 used in rpmQueryFlags */
    00127     RPMVERIFY_READLINKFAIL= (1 << 28),
    00128     RPMVERIFY_READFAIL  = (1 << 29),
    00129     RPMVERIFY_LSTATFAIL = (1 << 30)
    00130         /* bit 31 unused */
    00131 } rpmVerifyAttrs;
    00132 #define RPMVERIFY_ALL           ~(RPMVERIFY_NONE)
    00133
    00138 typedef enum rpmQueryFlags_e {
    00139 /*@-enummemuse@*/
    00140     QUERY_FOR_DEFAULT   = 0,
    00141     QUERY_MD5           = (1 << 0),
    00142     QUERY_SIZE          = (1 << 1),
    00143     QUERY_LINKTO        = (1 << 2),
    00144     QUERY_USER          = (1 << 3),
    00145     QUERY_GROUP         = (1 << 4),
    00146     QUERY_MTIME         = (1 << 5),
    00147     QUERY_MODE          = (1 << 6),
    00148     QUERY_RDEV          = (1 << 7),
    00149         /* bits 8-15 unused, reserved for rpmVerifyAttrs */
    00150     QUERY_FILES         = (1 << 16),
    00151     QUERY_DEPS          = (1 << 17),
    00152     QUERY_SCRIPT        = (1 << 18),
    00153     QUERY_DIGEST        = (1 << 19),
    00154     QUERY_SIGNATURE     = (1 << 20),
    00155     QUERY_PATCHES       = (1 << 21),
    00156     QUERY_HDRCHK        = (1 << 22),
    00157 /*@=enummemuse@*/
    00158     QUERY_FOR_LIST      = (1 << 23),
    00159     QUERY_FOR_STATE     = (1 << 24),
    00160     QUERY_FOR_DOCS      = (1 << 25),
    00161     QUERY_FOR_CONFIG    = (1 << 26),
    00162     QUERY_FOR_DUMPFILES = (1 << 27)
    00163 } rpmQueryFlags;
    00164
    00165 #define _QUERY_FOR_BITS \
    00166    (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
    00167     QUERY_FOR_DUMPFILES)
    00168
    00172 /*@unchecked@*/
    00173 extern rpmQueryFlags rpmcliQueryFlags;
    00174
    00179 typedef enum rpmVerifyFlags_e {
    00180 /*@-enummemuse@*/
    00181     VERIFY_DEFAULT      = 0,
    00182 /*@=enummemuse@*/
    00183     VERIFY_MD5          = (1 << 0),
    00184     VERIFY_SIZE         = (1 << 1),
    00185     VERIFY_LINKTO       = (1 << 2),
    00186     VERIFY_USER         = (1 << 3),
    00187     VERIFY_GROUP        = (1 << 4),
    00188     VERIFY_MTIME        = (1 << 5),
    00189     VERIFY_MODE         = (1 << 6),
    00190     VERIFY_RDEV         = (1 << 7),
    00191         /* bits 8-15 unused, reserved for rpmVerifyAttrs */
    00192     VERIFY_FILES        = (1 << 16),
    00193     VERIFY_DEPS         = (1 << 17),
    00194     VERIFY_SCRIPT       = (1 << 18),
    00195     VERIFY_DIGEST       = (1 << 19),
    00196     VERIFY_SIGNATURE    = (1 << 20),
    00197     VERIFY_PATCHES      = (1 << 21),
    00198     VERIFY_HDRCHK       = (1 << 22),
    00199 /*@-enummemuse@*/
    00200     VERIFY_FOR_LIST     = (1 << 23),
    00201     VERIFY_FOR_STATE    = (1 << 24),
    00202     VERIFY_FOR_DOCS     = (1 << 25),
    00203     VERIFY_FOR_CONFIG   = (1 << 26),
    00204     VERIFY_FOR_DUMPFILES= (1 << 27)
    00205 /*@=enummemuse@*/
    00206         /* bits 28-30 used in rpmVerifyAttrs */
    00207 } rpmVerifyFlags;
    00208
    00209 #define VERIFY_ATTRS    \
    00210   ( VERIFY_MD5 | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \
    00211     VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV )
    00212 #define VERIFY_ALL      \
    00213   ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST |\
    00214     VERIFY_SIGNATURE | VERIFY_HDRCHK )
    00215
    00218 typedef struct rpmQVKArguments_s * QVA_t;
    00219
    00227 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h)
    00228         /*@globals fileSystem@*/
    00229         /*@modifies qva, ts, fileSystem @*/;
    00230
    00234 struct rpmQVKArguments_s {
    00235     rpmQVSources qva_source;
    00236     int         qva_sourceCount;
    00237     rpmQueryFlags qva_flags;
    00238     rpmfileAttrs qva_fflags;
    00239 /*@only@*/ /*@null@*/
    00240     rpmdbMatchIterator qva_mi;
    00241 /*@null@*/
    00242     QVF_t qva_showPackage;
    00243 /*@unused@*/
    00244     int qva_verbose;
    00245 /*@only@*/ /*@null@*/
    00246     const char * qva_queryFormat;
    00247     int sign;
    00248 /*@observer@*/
    00249     const char * passPhrase;
    00250 /*@observer@*/ /*@null@*/
    00251     const char * qva_prefix;
    00252     char        qva_mode;
    00262     char        qva_char;
    00263 };
    00264
    00267 /*@unchecked@*/
    00268 extern struct rpmQVKArguments_s rpmQVKArgs;
    00269
    00272 /*@unchecked@*/
    00273 extern struct poptOption rpmQVSourcePoptTable[];
    00274
    00277 /*@unchecked@*/
    00278 extern int specedit;
    00279
    00282 /*@unchecked@*/
    00283 extern struct poptOption rpmQueryPoptTable[];
    00284
    00287 /*@unchecked@*/
    00288 extern struct poptOption rpmVerifyPoptTable[];
    00289
    00301 int rpmcliShowMatches(QVA_t qva, rpmts ts)
    00302         /*@globals rpmGlobalMacroContext, fileSystem@*/
    00303         /*@modifies qva, rpmGlobalMacroContext, fileSystem @*/;
    00304
    00309 void rpmDisplayQueryTags(FILE * fp)
    00310         /*@globals fileSystem@*/
    00311         /*@modifies *fp, fileSystem @*/;
    00312
    00325 int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
    00326         /*@globals rpmGlobalMacroContext,
    00327                 fileSystem, internalState @*/
    00328         /*@modifies qva, ts, rpmGlobalMacroContext,
    00329                 fileSystem, internalState @*/;
    00330
    00339 int showQueryPackage(QVA_t qva, rpmts ts, Header h)
    00340         /*@globals fileSystem, internalState @*/
    00341         /*@modifies ts, h, fileSystem, internalState @*/;
    00342
    00351 int rpmcliQuery(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
    00352         /*@globals rpmGlobalMacroContext,
    00353                 fileSystem, internalState @*/
    00354         /*@modifies ts, qva, rpmGlobalMacroContext,
    00355                 fileSystem, internalState @*/;
    00356
    00366 /*@-incondefs@*/
    00367 int rpmVerifyFile(const rpmts ts, rpmfi fi,
    00368                 /*@out@*/ rpmVerifyAttrs * res, rpmVerifyAttrs omitMask)
    00369         /*@globals fileSystem, internalState @*/
    00370         /*@modifies fi, *res, fileSystem, internalState @*/
    00371         /*@requires maxSet(res) >= 0 @*/;
    00372 /*@=incondefs@*/
    00373
    00381 int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
    00382         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00383         /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00384
    00393 int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn)
    00394         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00395         /*@modifies qva, ts, fd, rpmGlobalMacroContext,
    00396                 fileSystem, internalState @*/;
    00397
    00406 int rpmcliVerify(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
    00407         /*@globals rpmGlobalMacroContext,
    00408                 fileSystem, internalState @*/
    00409         /*@modifies ts, qva, rpmGlobalMacroContext,
    00410                 fileSystem, internalState @*/;
    00411
    00413 /* ==================================================================== */
    00416
    00420 struct rpmBuildArguments_s {
    00421     rpmQueryFlags qva_flags;
    00422     int buildAmount;
    00423 /*@null@*/
    00424     const char * buildRootOverride;
    00425 /*@null@*/
    00426     char * targets;
    00427 /*@observer@*/
    00428     const char * passPhrase;
    00429 /*@only@*/ /*@null@*/
    00430     const char * cookie;
    00431     int force;
    00432     int noBuild;
    00433     int noDeps;
    00434     int noLang;
    00435     int shortCircuit;
    00436     int sign;
    00437     int useCatalog;
    00438     char buildMode;
    00439     char buildChar;
    00440 /*@observer@*/ /*@null@*/
    00441     const char * rootdir;
    00442 };
    00443
    00446 typedef struct rpmBuildArguments_s *    BTA_t;
    00447
    00450 /*@unchecked@*/
    00451 extern struct rpmBuildArguments_s       rpmBTArgs;
    00452
    00455 /*@unchecked@*/
    00456 extern struct poptOption                rpmBuildPoptTable[];
    00457
    00459 /* ==================================================================== */
    00462 /* --- install/upgrade/erase modes */
    00463
    00464 /*@unchecked@*/
    00465 extern int rpmcliPackagesTotal;
    00466 /*@unchecked@*/
    00467 extern int rpmcliHashesCurrent;
    00468 /*@unchecked@*/
    00469 extern int rpmcliHashesTotal;
    00470 /*@unchecked@*/
    00471 extern int rpmcliProgressCurrent;
    00472 /*@unchecked@*/
    00473 extern int rpmcliProgressTotal;
    00474
    00489 /*@null@*/ void * rpmShowProgress(/*@null@*/ const void * arg,
    00490                 const rpmCallbackType what,
    00491                 const unsigned long amount,
    00492                 const unsigned long total,
    00493                 /*@null@*/ fnpyKey key,
    00494                 /*@null@*/ void * data)
    00495         /*@globals rpmcliHashesCurrent,
    00496                 rpmcliProgressCurrent, rpmcliProgressTotal,
    00497                 fileSystem, internalState @*/
    00498         /*@modifies rpmcliHashesCurrent,
    00499                 rpmcliProgressCurrent, rpmcliProgressTotal,
    00500                 fileSystem, internalState @*/;
    00501
    00510 int rpmInstallSource(rpmts ts, const char * arg,
    00511                 /*@null@*/ /*@out@*/ const char ** specFilePtr,
    00512                 /*@null@*/ /*@out@*/ const char ** cookie)
    00513         /*@globals rpmGlobalMacroContext,
    00514                 fileSystem, internalState@*/
    00515         /*@modifies ts, *specFilePtr, *cookie, rpmGlobalMacroContext,
    00516                 fileSystem, internalState @*/;
    00517
    00521 struct rpmInstallArguments_s {
    00522     rpmtransFlags transFlags;
    00523     rpmprobFilterFlags probFilter;
    00524     rpmInstallInterfaceFlags installInterfaceFlags;
    00525     rpmEraseInterfaceFlags eraseInterfaceFlags;
    00526     rpmQueryFlags qva_flags;
    00527     uint_32 rbtid;
    00528     int numRelocations;
    00529     int noDeps;
    00530     int incldocs;
    00531 /*@owned@*/ /*@null@*/
    00532     rpmRelocation * relocations;
    00533 /*@null@*/
    00534     const char * prefix;
    00535 /*@observer@*/ /*@null@*/
    00536     const char * rootdir;
    00537 };
    00538
    00546 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia,
    00547                 /*@null@*/ const char ** fileArgv)
    00548         /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext,
    00549                 fileSystem, internalState@*/
    00550         /*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext,
    00551                 fileSystem, internalState @*/;
    00552
    00560 int rpmErase(rpmts ts, const struct rpmInstallArguments_s * ia,
    00561                 /*@null@*/ const char ** argv)
    00562         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00563         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00564
    00568 /*@-fielduse@*/
    00569 typedef /*@abstract@*/ struct IDT_s {
    00570     unsigned int instance;
    00571 /*@owned@*/ /*@null@*/
    00572     const char * key;
    00573     Header h;
    00574     union {
    00575         uint_32 u32;
    00576     } val;
    00577 } * IDT;
    00578 /*@=fielduse@*/
    00579
    00583 typedef /*@abstract@*/ struct IDTindex_s {
    00584     int delta;
    00585     int size;
    00586     int alloced;
    00587     int nidt;
    00588 /*@only@*/ /*@null@*/
    00589     IDT idt;
    00590 } * IDTX;
    00591
    00597 /*@null@*/
    00598 IDTX IDTXfree(/*@only@*/ /*@null@*/ IDTX idtx)
    00599         /*@modifies idtx @*/;
    00600
    00605 /*@only@*/
    00606 IDTX IDTXnew(void)
    00607         /*@*/;
    00608
    00615 /*@only@*/ /*@null@*/
    00616 IDTX IDTXgrow(/*@only@*/ /*@null@*/ IDTX idtx, int need)
    00617         /*@modifies idtx @*/;
    00618
    00624 /*@only@*/ /*@null@*/
    00625 IDTX IDTXsort(/*@only@*/ /*@null@*/ IDTX idtx)
    00626         /*@modifies idtx @*/;
    00627
    00634 /*@only@*/ /*@null@*/
    00635 IDTX IDTXload(rpmts ts, rpmTag tag)
    00636         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00637         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState  @*/;
    00638
    00646 /*@only@*/ /*@null@*/
    00647 IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
    00648         /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
    00649         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00650
    00658 int rpmRollback(rpmts ts, struct rpmInstallArguments_s * ia,
    00659                 /*@null@*/ const char ** argv)
    00660         /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext,
    00661                 fileSystem, internalState @*/
    00662         /*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext,
    00663                 fileSystem, internalState @*/;
    00664
    00667 /*@unchecked@*/
    00668 extern struct rpmInstallArguments_s rpmIArgs;
    00669
    00672 /*@unchecked@*/
    00673 extern struct poptOption rpmInstallPoptTable[];
    00674
    00676 /* ==================================================================== */
    00679 /* --- database modes */
    00680
    00684 struct rpmDatabaseArguments_s {
    00685     int init;
    00686     int rebuild;
    00687     int verify;
    00688 };
    00689
    00692 /*@unchecked@*/
    00693 extern struct rpmDatabaseArguments_s rpmDBArgs;
    00694
    00697 /*@unchecked@*/
    00698 extern struct poptOption rpmDatabasePoptTable[];
    00699
    00701 /* ==================================================================== */
    00704
    00713 int rpmcliImportPubkey(const rpmts ts,
    00714                 const unsigned char * pkt, ssize_t pktlen)
    00715         /*@globals RPMVERSION, rpmGlobalMacroContext,
    00716                 fileSystem, internalState @*/
    00717         /*@modifies ts, rpmGlobalMacroContext,
    00718                 fileSystem, internalState @*/;
    00719
    00723 /*@-typeuse@*/
    00724 typedef enum rpmSignFlags_e {
    00725     RPMSIGN_NONE                = 0,
    00726     RPMSIGN_CHK_SIGNATURE       = 'K',
    00727     RPMSIGN_NEW_SIGNATURE       = 'R',
    00728     RPMSIGN_ADD_SIGNATURE       = 'A',
    00729     RPMSIGN_IMPORT_PUBKEY       = 'I',
    00730 } rpmSignFlags;
    00731 /*@=typeuse@*/
    00732
    00735 /*@unchecked@*/
    00736 extern struct poptOption rpmSignPoptTable[];
    00737
    00745 int rpmcliSign(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
    00746         /*@globals RPMVERSION, rpmGlobalMacroContext,
    00747                 fileSystem, internalState @*/
    00748         /*@modifies ts, qva, rpmGlobalMacroContext,
    00749                 fileSystem, internalState @*/;
    00750
    00753 #ifdef __cplusplus
    00754 }
    00755 #endif
    00756
    00757 #endif  /* H_RPMCLI */