rpm: rpmcli.h Source File

rpm 4.10.0

- 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 struct poptOption                rpmcliAllPoptTable[];
    00027
    00028 extern const char * rpmcliPipeOutput;
    00029
    00030 extern const char * rpmcliRcfile;
    00031
    00032 extern const char * rpmcliRootDir;
    00033
    00041 poptContext
    00042 rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable);
    00043
    00048 void rpmcliConfigured(void);
    00049
    00055 poptContext
    00056 rpmcliFini(poptContext optCon);
    00057
    00061 #define RPMCLI_POPT_NODEPS              -1025
    00062 #define RPMCLI_POPT_FORCE               -1026
    00063 #define RPMCLI_POPT_NOMD5               -1027
    00064 #define RPMCLI_POPT_NOFILEDIGEST        -1027   /* same as obsolete RPMCLI_POPT_NOMD5 */
    00065 #define RPMCLI_POPT_NOSCRIPTS           -1028
    00066 #define RPMCLI_POPT_NOSIGNATURE         -1029
    00067 #define RPMCLI_POPT_NODIGEST            -1030
    00068 #define RPMCLI_POPT_NOHDRCHK            -1031
    00069 #define RPMCLI_POPT_NOCONTEXTS          -1032
    00070
    00071 /* ==================================================================== */
    00078 enum rpmQVSources_e {
    00079     RPMQV_PACKAGE = 0,
    00080     RPMQV_PATH,
    00081     RPMQV_ALL,
    00082     RPMQV_RPM,
    00083     RPMQV_GROUP,
    00084     RPMQV_WHATPROVIDES,
    00085     RPMQV_WHATREQUIRES,
    00086     RPMQV_TRIGGEREDBY,
    00087     RPMQV_DBOFFSET,
    00088     RPMQV_SPECRPMS,
    00089     RPMQV_SPECFILE = RPMQV_SPECRPMS,
    00090     RPMQV_PKGID,
    00091     RPMQV_HDRID,
    00092     RPMQV_TID,
    00093     RPMQV_SPECSRPM,
    00094 };
    00095
    00096 typedef rpmFlags rpmQVSources;
    00097
    00102 enum rpmQueryFlags_e {
    00103     QUERY_FOR_DEFAULT   = 0,
    00104     QUERY_MD5           = (1 << 0),
    00105     QUERY_FILEDIGEST    = (1 << 0),
    00106     QUERY_SIZE          = (1 << 1),
    00107     QUERY_LINKTO        = (1 << 2),
    00108     QUERY_USER          = (1 << 3),
    00109     QUERY_GROUP         = (1 << 4),
    00110     QUERY_MTIME         = (1 << 5),
    00111     QUERY_MODE          = (1 << 6),
    00112     QUERY_RDEV          = (1 << 7),
    00113         /* bits 8-14 unused, reserved for rpmVerifyAttrs */
    00114     QUERY_CONTEXTS      = (1 << 15),
    00115     QUERY_FILES         = (1 << 16),
    00116     QUERY_DEPS          = (1 << 17),
    00117     QUERY_SCRIPT        = (1 << 18),
    00118     QUERY_DIGEST        = (1 << 19),
    00119     QUERY_SIGNATURE     = (1 << 20),
    00120     QUERY_PATCHES       = (1 << 21),
    00121     QUERY_HDRCHK        = (1 << 22),
    00122     QUERY_FOR_LIST      = (1 << 23),
    00123     QUERY_FOR_STATE     = (1 << 24),
    00124     QUERY_FOR_DOCS      = (1 << 25),
    00125     QUERY_FOR_CONFIG    = (1 << 26),
    00126     QUERY_FOR_DUMPFILES = (1 << 27)
    00127 };
    00128
    00129 typedef rpmFlags rpmQueryFlags;
    00130
    00131 #define _QUERY_FOR_BITS \
    00132    (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
    00133     QUERY_FOR_DUMPFILES)
    00134
    00138 extern rpmQueryFlags rpmcliQueryFlags;
    00139
    00142 typedef struct rpmQVKArguments_s * QVA_t;
    00143
    00152 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h);
    00153
    00162 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg);
    00163
    00167 struct rpmQVKArguments_s {
    00168     rpmQVSources qva_source;
    00169     int         qva_sourceCount;
    00170     rpmQueryFlags qva_flags;
    00171     rpmfileAttrs qva_fflags;
    00173     QVF_t qva_showPackage;
    00174     QSpecF_t qva_specQuery;
    00175     char * qva_queryFormat;
    00176     char        qva_mode;
    00184 };
    00185
    00188 extern struct rpmQVKArguments_s rpmQVKArgs;
    00189
    00192 extern struct poptOption rpmQVSourcePoptTable[];
    00193
    00196 extern struct poptOption rpmQueryPoptTable[];
    00197
    00200 extern struct poptOption rpmVerifyPoptTable[];
    00201
    00206 void rpmDisplayQueryTags(FILE * fp);
    00207
    00216 int showQueryPackage(QVA_t qva, rpmts ts, Header h);
    00217
    00225 int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00226
    00235 int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00236
    00244 int showVerifyPackage(QVA_t qva, rpmts ts, Header h);
    00245
    00254 int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
    00255
    00264 int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00265
    00266 /* ==================================================================== */
    00268 /* --- install/upgrade/erase modes */
    00269
    00273 enum rpmInstallFlags_e {
    00274     INSTALL_NONE        = 0,
    00275     INSTALL_PERCENT     = (1 << 0),
    00276     INSTALL_HASH        = (1 << 1),
    00277     INSTALL_NODEPS      = (1 << 2),
    00278     INSTALL_NOORDER     = (1 << 3),
    00279     INSTALL_LABEL       = (1 << 4),
    00280     INSTALL_UPGRADE     = (1 << 5),
    00281     INSTALL_FRESHEN     = (1 << 6),
    00282     INSTALL_INSTALL     = (1 << 7),
    00283     INSTALL_ERASE       = (1 << 8),
    00284     INSTALL_ALLMATCHES  = (1 << 9)
    00285 };
    00286
    00287 typedef rpmFlags rpmInstallFlags;
    00288
    00292 #define UNINSTALL_NONE INSTALL_NONE
    00293 #define UNINSTALL_NODEPS INSTALL_NODEPS
    00294 #define UNINSTALL_ALLMATCHES INSTALL_ALLMATCHES
    00295
    00310 void * rpmShowProgress(const void * arg,
    00311                 const rpmCallbackType what,
    00312                 const rpm_loff_t amount,
    00313                 const rpm_loff_t total,
    00314                 fnpyKey key,
    00315                 void * data);
    00316
    00325 int rpmInstallSource(rpmts ts, const char * arg,
    00326                 char ** specFilePtr,
    00327                 char ** cookie);
    00328
    00329
    00333 struct rpmInstallArguments_s {
    00334     rpmtransFlags transFlags;
    00335     rpmprobFilterFlags probFilter;
    00336     rpmInstallFlags installInterfaceFlags;
    00337     int numRelocations;
    00338     int noDeps;
    00339     int incldocs;
    00340     rpmRelocation * relocations;
    00341     char * prefix;
    00342 };
    00343
    00353 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv);
    00354
    00363 int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv);
    00364
    00367 extern struct rpmInstallArguments_s rpmIArgs;
    00368
    00371 extern struct poptOption rpmInstallPoptTable[];
    00372
    00373 /* ==================================================================== */
    00381 int rpmcliImportPubkeys(rpmts ts, ARGV_const_t argv);
    00382
    00389 int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv);
    00390
    00391 #ifdef __cplusplus
    00392 }
    00393 #endif
    00394
    00395 #endif  /* H_RPMCLI */