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
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 char buildMode;
00327 char buildChar;
00328 const char * rootdir;
00329 };
00330
00333 typedef struct rpmBuildArguments_s * BTA_t;
00334
00337 extern struct rpmBuildArguments_s rpmBTArgs;
00338
00341 extern struct poptOption rpmBuildPoptTable[];
00342
00343
00345
00346
00350 typedef enum rpmInstallInterfaceFlags_e {
00351 INSTALL_NONE = 0,
00352 INSTALL_PERCENT = (1 << 0),
00353 INSTALL_HASH = (1 << 1),
00354 INSTALL_NODEPS = (1 << 2),
00355 INSTALL_NOORDER = (1 << 3),
00356 INSTALL_LABEL = (1 << 4),
00357 INSTALL_UPGRADE = (1 << 5),
00358 INSTALL_FRESHEN = (1 << 6),
00359 INSTALL_INSTALL = (1 << 7),
00360 INSTALL_ERASE = (1 << 8)
00361 } rpmInstallInterfaceFlags;
00362
00366 typedef enum rpmEraseInterfaceFlags_e {
00367 UNINSTALL_NONE = 0,
00368 UNINSTALL_NODEPS = (1 << 0),
00369 UNINSTALL_ALLMATCHES= (1 << 1)
00370 } rpmEraseInterfaceFlags;
00371
00372 extern int rpmcliPackagesTotal;
00373 extern int rpmcliHashesCurrent;
00374 extern int rpmcliHashesTotal;
00375 extern int rpmcliProgressCurrent;
00376 extern int rpmcliProgressTotal;
00377
00392 void * rpmShowProgress(const void * arg,
00393 const rpmCallbackType what,
00394 const rpm_loff_t amount,
00395 const rpm_loff_t total,
00396 fnpyKey key,
00397 void * data);
00398
00407 int rpmInstallSource(rpmts ts, const char * arg,
00408 char ** specFilePtr,
00409 char ** cookie);
00410
00411
00415 struct rpmInstallArguments_s {
00416 rpmtransFlags transFlags;
00417 rpmprobFilterFlags probFilter;
00418 rpmInstallInterfaceFlags installInterfaceFlags;
00419 rpmEraseInterfaceFlags eraseInterfaceFlags;
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
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