rpm 4.10.90

- 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     QUERY_FOR_LICENSE   = (1 << 28)
    00128 };
    00129
    00130 typedef rpmFlags rpmQueryFlags;
    00131
    00132 #define _QUERY_FOR_BITS \
    00133    (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
    00134     QUERY_FOR_LICENSE|QUERY_FOR_DUMPFILES)
    00135
    00139 extern rpmQueryFlags rpmcliQueryFlags;
    00140
    00143 typedef struct rpmQVKArguments_s * QVA_t;
    00144
    00153 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h);
    00154
    00163 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg);
    00164
    00168 struct rpmQVKArguments_s {
    00169     rpmQVSources qva_source;
    00170     int         qva_sourceCount;
    00171     rpmQueryFlags qva_flags;
    00172     rpmfileAttrs qva_fflags;
    00174     QVF_t qva_showPackage;
    00175     QSpecF_t qva_specQuery;
    00176     char * qva_queryFormat;
    00177     char        qva_mode;
    00185 };
    00186
    00189 extern struct rpmQVKArguments_s rpmQVKArgs;
    00190
    00193 extern struct poptOption rpmQVSourcePoptTable[];
    00194
    00197 extern struct poptOption rpmQueryPoptTable[];
    00198
    00201 extern struct poptOption rpmVerifyPoptTable[];
    00202
    00207 void rpmDisplayQueryTags(FILE * fp);
    00208
    00217 int showQueryPackage(QVA_t qva, rpmts ts, Header h);
    00218
    00226 int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00227
    00236 int rpmcliQuery(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00237
    00245 int showVerifyPackage(QVA_t qva, rpmts ts, Header h);
    00246
    00255 int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
    00256
    00265 int rpmcliVerify(rpmts ts, QVA_t qva, ARGV_const_t argv);
    00266
    00267 /* ==================================================================== */
    00269 /* --- install/upgrade/erase modes */
    00270
    00274 enum rpmInstallFlags_e {
    00275     INSTALL_NONE        = 0,
    00276     INSTALL_PERCENT     = (1 << 0),
    00277     INSTALL_HASH        = (1 << 1),
    00278     INSTALL_NODEPS      = (1 << 2),
    00279     INSTALL_NOORDER     = (1 << 3),
    00280     INSTALL_LABEL       = (1 << 4),
    00281     INSTALL_UPGRADE     = (1 << 5),
    00282     INSTALL_FRESHEN     = (1 << 6),
    00283     INSTALL_INSTALL     = (1 << 7),
    00284     INSTALL_ERASE       = (1 << 8),
    00285     INSTALL_ALLMATCHES  = (1 << 9)
    00286 };
    00287
    00288 typedef rpmFlags rpmInstallFlags;
    00289
    00293 #define UNINSTALL_NONE INSTALL_NONE
    00294 #define UNINSTALL_NODEPS INSTALL_NODEPS
    00295 #define UNINSTALL_ALLMATCHES INSTALL_ALLMATCHES
    00296
    00311 void * rpmShowProgress(const void * arg,
    00312                 const rpmCallbackType what,
    00313                 const rpm_loff_t amount,
    00314                 const rpm_loff_t total,
    00315                 fnpyKey key,
    00316                 void * data);
    00317
    00326 int rpmInstallSource(rpmts ts, const char * arg,
    00327                 char ** specFilePtr,
    00328                 char ** cookie);
    00329
    00330
    00334 struct rpmInstallArguments_s {
    00335     rpmtransFlags transFlags;
    00336     rpmprobFilterFlags probFilter;
    00337     rpmInstallFlags installInterfaceFlags;
    00338     int numRelocations;
    00339     int noDeps;
    00340     int incldocs;
    00341     rpmRelocation * relocations;
    00342     char * prefix;
    00343 };
    00344
    00354 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv);
    00355
    00364 int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv);
    00365
    00368 extern struct rpmInstallArguments_s rpmIArgs;
    00369
    00372 extern struct poptOption rpmInstallPoptTable[];
    00373
    00374 /* ==================================================================== */
    00382 int rpmcliImportPubkeys(rpmts ts, ARGV_const_t argv);
    00383
    00390 int rpmcliVerifySignatures(rpmts ts, ARGV_const_t argv);
    00391
    00392 #ifdef __cplusplus
    00393 }
    00394 #endif
    00395
    00396 #endif  /* H_RPMCLI */