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

# 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_NOSCRIPTS           -1028
    00074 #define RPMCLI_POPT_NOSIGNATURE         -1029
    00075 #define RPMCLI_POPT_NODIGEST            -1030
    00076 #define RPMCLI_POPT_NOHDRCHK            -1031
    00077 #define RPMCLI_POPT_NOCONTEXTS          -1032
    00078
    00079 /* ==================================================================== */
    00086 typedef enum rpmQVSources_e {
    00087     RPMQV_PACKAGE = 0,
    00088     RPMQV_PATH,
    00089     RPMQV_ALL,
    00090     RPMQV_RPM,
    00091     RPMQV_GROUP,
    00092     RPMQV_WHATPROVIDES,
    00093     RPMQV_WHATREQUIRES,
    00094     RPMQV_TRIGGEREDBY,
    00095     RPMQV_DBOFFSET,
    00096     RPMQV_SPECFILE,
    00097     RPMQV_PKGID,
    00098     RPMQV_HDRID,
    00099     RPMQV_FILEID,
    00100     RPMQV_TID,
    00101     RPMQV_HDLIST,
    00102     RPMQV_FTSWALK
    00103 } rpmQVSources;
    00104
    00109 typedef enum rpmQueryFlags_e {
    00110     QUERY_FOR_DEFAULT   = 0,
    00111     QUERY_MD5           = (1 << 0),
    00112     QUERY_SIZE          = (1 << 1),
    00113     QUERY_LINKTO        = (1 << 2),
    00114     QUERY_USER          = (1 << 3),
    00115     QUERY_GROUP         = (1 << 4),
    00116     QUERY_MTIME         = (1 << 5),
    00117     QUERY_MODE          = (1 << 6),
    00118     QUERY_RDEV          = (1 << 7),
    00119         /* bits 8-14 unused, reserved for rpmVerifyAttrs */
    00120     QUERY_CONTEXTS      = (1 << 15),
    00121     QUERY_FILES         = (1 << 16),
    00122     QUERY_DEPS          = (1 << 17),
    00123     QUERY_SCRIPT        = (1 << 18),
    00124     QUERY_DIGEST        = (1 << 19),
    00125     QUERY_SIGNATURE     = (1 << 20),
    00126     QUERY_PATCHES       = (1 << 21),
    00127     QUERY_HDRCHK        = (1 << 22),
    00128     QUERY_FOR_LIST      = (1 << 23),
    00129     QUERY_FOR_STATE     = (1 << 24),
    00130     QUERY_FOR_DOCS      = (1 << 25),
    00131     QUERY_FOR_CONFIG    = (1 << 26),
    00132     QUERY_FOR_DUMPFILES = (1 << 27)
    00133 } rpmQueryFlags;
    00134
    00135 #define _QUERY_FOR_BITS \
    00136    (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
    00137     QUERY_FOR_DUMPFILES)
    00138
    00142 extern rpmQueryFlags rpmcliQueryFlags;
    00143
    00146 typedef struct rpmQVKArguments_s * QVA_t;
    00147
    00156 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h);
    00157
    00166 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg);
    00167
    00171 struct rpmQVKArguments_s {
    00172     rpmQVSources qva_source;
    00173     int         qva_sourceCount;
    00174     rpmQueryFlags qva_flags;
    00175     rpmfileAttrs qva_fflags;
    00176     rpmdbMatchIterator qva_mi;
    00177     rpmgi qva_gi;
    00178     rpmRC qva_rc;
    00180     QVF_t qva_showPackage;
    00181     QSpecF_t qva_specQuery;
    00182     int qva_verbose;
    00183     char * qva_queryFormat;
    00184     int sign;
    00185     const char * passPhrase;
    00186     const char * qva_prefix;
    00187     char        qva_mode;
    00197     char        qva_char;
    00198 };
    00199
    00202 extern struct rpmQVKArguments_s rpmQVKArgs;
    00203
    00206 extern struct poptOption rpmQVSourcePoptTable[];
    00207
    00210 extern struct poptOption rpmQueryPoptTable[];
    00211
    00214 extern struct poptOption rpmVerifyPoptTable[];
    00215
    00227 int rpmcliShowMatches(QVA_t qva, rpmts ts);
    00228
    00233 void rpmDisplayQueryTags(FILE * fp);
    00234
    00247 int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg);
    00248
    00257 int showQueryPackage(QVA_t qva, rpmts ts, Header h);
    00258
    00266 int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00267
    00276 int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00277
    00285 int showVerifyPackage(QVA_t qva, rpmts ts, Header h);
    00286
    00295 int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
    00296
    00305 int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00306
    00307 /* ==================================================================== */
    00313 struct rpmBuildArguments_s {
    00314     rpmQueryFlags qva_flags;
    00315     int buildAmount;
    00316     char * buildRootOverride;
    00317     char * targets;
    00318     const char * passPhrase;
    00319     char * cookie;
    00320     int force;
    00321     int noBuild;
    00322     int noDeps;
    00323     int noLang;
    00324     int shortCircuit;
    00325     int sign;
    00326     int useCatalog;
    00327     char buildMode;
    00328     char buildChar;
    00329     const char * rootdir;
    00330 };
    00331
    00334 typedef struct rpmBuildArguments_s *    BTA_t;
    00335
    00338 extern struct rpmBuildArguments_s       rpmBTArgs;
    00339
    00342 extern struct poptOption                rpmBuildPoptTable[];
    00343
    00344 /* ==================================================================== */
    00346 /* --- install/upgrade/erase modes */
    00347
    00351 typedef enum rpmInstallInterfaceFlags_e {
    00352     INSTALL_NONE        = 0,
    00353     INSTALL_PERCENT     = (1 << 0),
    00354     INSTALL_HASH        = (1 << 1),
    00355     INSTALL_NODEPS      = (1 << 2),
    00356     INSTALL_NOORDER     = (1 << 3),
    00357     INSTALL_LABEL       = (1 << 4),
    00358     INSTALL_UPGRADE     = (1 << 5),
    00359     INSTALL_FRESHEN     = (1 << 6),
    00360     INSTALL_INSTALL     = (1 << 7),
    00361     INSTALL_ERASE       = (1 << 8)
    00362 } rpmInstallInterfaceFlags;
    00363
    00367 typedef enum rpmEraseInterfaceFlags_e {
    00368     UNINSTALL_NONE      = 0,
    00369     UNINSTALL_NODEPS    = (1 << 0),
    00370     UNINSTALL_ALLMATCHES= (1 << 1)
    00371 } rpmEraseInterfaceFlags;
    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     rpmInstallInterfaceFlags installInterfaceFlags;
    00420     rpmEraseInterfaceFlags eraseInterfaceFlags;
    00421     rpmQueryFlags qva_flags;
    00422     int numRelocations;
    00423     int noDeps;
    00424     int incldocs;
    00425     rpmRelocation * relocations;
    00426     char * prefix;
    00427     const char * rootdir;
    00428 };
    00429
    00439 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv);
    00440
    00449 int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv);
    00450
    00453 extern struct rpmInstallArguments_s rpmIArgs;
    00454
    00457 extern struct poptOption rpmInstallPoptTable[];
    00458
    00459 /* ==================================================================== */
    00461 /* --- database modes */
    00462
    00466 struct rpmDatabaseArguments_s {
    00467     int init;
    00468     int rebuild;
    00469     int verify;
    00470 };
    00471
    00474 extern struct rpmDatabaseArguments_s rpmDBArgs;
    00475
    00478 extern struct poptOption rpmDatabasePoptTable[];
    00479
    00480 /* ==================================================================== */
    00486 typedef enum rpmSignFlags_e {
    00487     RPMSIGN_NONE                = 0,
    00488     RPMSIGN_CHK_SIGNATURE       = 'K',
    00489     RPMSIGN_NEW_SIGNATURE       = 'R',
    00490     RPMSIGN_ADD_SIGNATURE       = 'A',
    00491     RPMSIGN_DEL_SIGNATURE       = 'D',
    00492     RPMSIGN_IMPORT_PUBKEY       = 'I',
    00493 } rpmSignFlags;
    00494
    00497 extern struct poptOption rpmSignPoptTable[];
    00498
    00506 int rpmcliSign(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00507
    00508 #ifdef __cplusplus
    00509 }
    00510 #endif
    00511
    00512 #endif  /* H_RPMCLI */