- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# rpmcli.h

Go to the documentation of this file.

    00001 #ifndef H_RPMCLI
    00002 #define H_RPMCLI
    00003
    00008 #include <popt.h>
    00009
    00010 #include <rpm/rpmlib.h>
    00011 #include <rpm/rpmurl.h>
    00012 #include <rpm/rpmmacro.h>
    00013 #include <rpm/rpmcallback.h>
    00014 #include <rpm/rpmts.h>
    00015 #include <rpm/rpmfi.h>
    00016 #include <rpm/rpmvf.h>
    00017 #include <rpm/argv.h>
    00018
    00019 #ifdef __cplusplus
    00020 extern "C" {
    00021 #endif
    00022
    00026 extern int _noDirTokens;
    00027
    00031 extern struct poptOption                rpmcliAllPoptTable[];
    00032
    00033 extern int ftsOpts;
    00034
    00035 extern struct poptOption                rpmcliFtsPoptTable[];
    00036
    00037 extern const char * rpmcliPipeOutput;
    00038
    00039 extern const char * rpmcliRcfile;
    00040
    00041 extern const char * rpmcliRootDir;
    00042
    00050 poptContext
    00051 rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable);
    00052
    00057 void rpmcliConfigured(void);
    00058
    00064 poptContext
    00065 rpmcliFini(poptContext optCon);
    00066
    00070 #define RPMCLI_POPT_NODEPS              -1025
    00071 #define RPMCLI_POPT_FORCE               -1026
    00072 #define RPMCLI_POPT_NOMD5               -1027
    00073 #define RPMCLI_POPT_NOFILEDIGEST        -1027   /* same as obsolete RPMCLI_POPT_NOMD5 */
    00074 #define RPMCLI_POPT_NOSCRIPTS           -1028
    00075 #define RPMCLI_POPT_NOSIGNATURE         -1029
    00076 #define RPMCLI_POPT_NODIGEST            -1030
    00077 #define RPMCLI_POPT_NOHDRCHK            -1031
    00078 #define RPMCLI_POPT_NOCONTEXTS          -1032
    00079
    00080 /* ==================================================================== */
    00087 typedef enum rpmQVSources_e {
    00088     RPMQV_PACKAGE = 0,
    00089     RPMQV_PATH,
    00090     RPMQV_ALL,
    00091     RPMQV_RPM,
    00092     RPMQV_GROUP,
    00093     RPMQV_WHATPROVIDES,
    00094     RPMQV_WHATREQUIRES,
    00095     RPMQV_TRIGGEREDBY,
    00096     RPMQV_DBOFFSET,
    00097     RPMQV_SPECFILE,
    00098     RPMQV_PKGID,
    00099     RPMQV_HDRID,
    00100     RPMQV_FILEID,
    00101     RPMQV_TID,
    00102     RPMQV_HDLIST,
    00103     RPMQV_FTSWALK
    00104 } rpmQVSources;
    00105
    00110 typedef enum rpmQueryFlags_e {
    00111     QUERY_FOR_DEFAULT   = 0,
    00112     QUERY_MD5           = (1 << 0),
    00113     QUERY_FILEDIGEST    = (1 << 0),
    00114     QUERY_SIZE          = (1 << 1),
    00115     QUERY_LINKTO        = (1 << 2),
    00116     QUERY_USER          = (1 << 3),
    00117     QUERY_GROUP         = (1 << 4),
    00118     QUERY_MTIME         = (1 << 5),
    00119     QUERY_MODE          = (1 << 6),
    00120     QUERY_RDEV          = (1 << 7),
    00121         /* bits 8-14 unused, reserved for rpmVerifyAttrs */
    00122     QUERY_CONTEXTS      = (1 << 15),
    00123     QUERY_FILES         = (1 << 16),
    00124     QUERY_DEPS          = (1 << 17),
    00125     QUERY_SCRIPT        = (1 << 18),
    00126     QUERY_DIGEST        = (1 << 19),
    00127     QUERY_SIGNATURE     = (1 << 20),
    00128     QUERY_PATCHES       = (1 << 21),
    00129     QUERY_HDRCHK        = (1 << 22),
    00130     QUERY_FOR_LIST      = (1 << 23),
    00131     QUERY_FOR_STATE     = (1 << 24),
    00132     QUERY_FOR_DOCS      = (1 << 25),
    00133     QUERY_FOR_CONFIG    = (1 << 26),
    00134     QUERY_FOR_DUMPFILES = (1 << 27)
    00135 } rpmQueryFlags;
    00136
    00137 #define _QUERY_FOR_BITS \
    00138    (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
    00139     QUERY_FOR_DUMPFILES)
    00140
    00144 extern rpmQueryFlags rpmcliQueryFlags;
    00145
    00148 typedef struct rpmQVKArguments_s * QVA_t;
    00149
    00158 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h);
    00159
    00168 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg);
    00169
    00173 struct rpmQVKArguments_s {
    00174     rpmQVSources qva_source;
    00175     int         qva_sourceCount;
    00176     rpmQueryFlags qva_flags;
    00177     rpmfileAttrs qva_fflags;
    00178     rpmdbMatchIterator qva_mi;
    00179     rpmgi qva_gi;
    00180     rpmRC qva_rc;
    00182     QVF_t qva_showPackage;
    00183     QSpecF_t qva_specQuery;
    00184     int qva_verbose;
    00185     char * qva_queryFormat;
    00186     int sign;
    00187     const char * passPhrase;
    00188     const char * qva_prefix;
    00189     char        qva_mode;
    00199     char        qva_char;
    00200 };
    00201
    00204 extern struct rpmQVKArguments_s rpmQVKArgs;
    00205
    00208 extern struct poptOption rpmQVSourcePoptTable[];
    00209
    00212 extern struct poptOption rpmQueryPoptTable[];
    00213
    00216 extern struct poptOption rpmVerifyPoptTable[];
    00217
    00229 int rpmcliShowMatches(QVA_t qva, rpmts ts);
    00230
    00235 void rpmDisplayQueryTags(FILE * fp);
    00236
    00249 int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg);
    00250
    00259 int showQueryPackage(QVA_t qva, rpmts ts, Header h);
    00260
    00268 int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00269
    00278 int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00279
    00287 int showVerifyPackage(QVA_t qva, rpmts ts, Header h);
    00288
    00297 int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
    00298
    00307 int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00308
    00309 /* ==================================================================== */
    00315 struct rpmBuildArguments_s {
    00316     rpmQueryFlags qva_flags;
    00317     int buildAmount;
    00318     char * buildRootOverride;
    00319     char * targets;
    00320     const char * passPhrase;
    00321     char * cookie;
    00322     int force;
    00323     int noBuild;
    00324     int noDeps;
    00325     int noLang;
    00326     int shortCircuit;
    00327     int sign;
    00328     char buildMode;
    00329     char buildChar;
    00330     const char * rootdir;
    00331 };
    00332
    00335 typedef struct rpmBuildArguments_s *    BTA_t;
    00336
    00339 extern struct rpmBuildArguments_s       rpmBTArgs;
    00340
    00343 extern struct poptOption                rpmBuildPoptTable[];
    00344
    00345 /* ==================================================================== */
    00347 /* --- install/upgrade/erase modes */
    00348
    00352 typedef enum rpmInstallFlags_e {
    00353     INSTALL_NONE        = 0,
    00354     INSTALL_PERCENT     = (1 << 0),
    00355     INSTALL_HASH        = (1 << 1),
    00356     INSTALL_NODEPS      = (1 << 2),
    00357     INSTALL_NOORDER     = (1 << 3),
    00358     INSTALL_LABEL       = (1 << 4),
    00359     INSTALL_UPGRADE     = (1 << 5),
    00360     INSTALL_FRESHEN     = (1 << 6),
    00361     INSTALL_INSTALL     = (1 << 7),
    00362     INSTALL_ERASE       = (1 << 8),
    00363     INSTALL_ALLMATCHES  = (1 << 9)
    00364 } rpmInstallFlags;
    00365
    00369 #define UNINSTALL_NONE INSTALL_NONE
    00370 #define UNINSTALL_NODEPS INSTALL_NODEPS
    00371 #define UNINSTALL_ALLMATCHES INSTALL_ALLMATCHES
    00372
    00373 extern int rpmcliPackagesTotal;
    00374 extern int rpmcliHashesCurrent;
    00375 extern int rpmcliHashesTotal;
    00376 extern int rpmcliProgressCurrent;
    00377 extern int rpmcliProgressTotal;
    00378
    00393 void * rpmShowProgress(const void * arg,
    00394                 const rpmCallbackType what,
    00395                 const rpm_loff_t amount,
    00396                 const rpm_loff_t total,
    00397                 fnpyKey key,
    00398                 void * data);
    00399
    00408 int rpmInstallSource(rpmts ts, const char * arg,
    00409                 char ** specFilePtr,
    00410                 char ** cookie);
    00411
    00412
    00416 struct rpmInstallArguments_s {
    00417     rpmtransFlags transFlags;
    00418     rpmprobFilterFlags probFilter;
    00419     rpmInstallFlags installInterfaceFlags;
    00420     rpmQueryFlags qva_flags;
    00421     int numRelocations;
    00422     int noDeps;
    00423     int incldocs;
    00424     rpmRelocation * relocations;
    00425     char * prefix;
    00426     const char * rootdir;
    00427 };
    00428
    00438 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv);
    00439
    00448 int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv);
    00449
    00452 extern struct rpmInstallArguments_s rpmIArgs;
    00453
    00456 extern struct poptOption rpmInstallPoptTable[];
    00457
    00458 /* ==================================================================== */
    00460 /* --- database modes */
    00461
    00465 struct rpmDatabaseArguments_s {
    00466     int init;
    00467     int rebuild;
    00468     int verify;
    00469 };
    00470
    00473 extern struct rpmDatabaseArguments_s rpmDBArgs;
    00474
    00477 extern struct poptOption rpmDatabasePoptTable[];
    00478
    00479 /* ==================================================================== */
    00485 typedef enum rpmSignFlags_e {
    00486     RPMSIGN_NONE                = 0,
    00487     RPMSIGN_CHK_SIGNATURE       = 'K',
    00488     RPMSIGN_NEW_SIGNATURE       = 'R',
    00489     RPMSIGN_ADD_SIGNATURE       = 'A',
    00490     RPMSIGN_DEL_SIGNATURE       = 'D',
    00491     RPMSIGN_IMPORT_PUBKEY       = 'I',
    00492 } rpmSignFlags;
    00493
    00496 extern struct poptOption rpmSignPoptTable[];
    00497
    00505 int rpmcliSign(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00506
    00507 #ifdef __cplusplus
    00508 }
    00509 #endif
    00510
    00511 #endif  /* H_RPMCLI */