00001 #ifndef H_RPMCLI
00002 #define H_RPMCLI
00003
00008 #include "rpmlib.h"
00009 #include "rpmurl.h"
00010 #include "rpmmacro.h"
00011 #include "argv.h"
00012
00016
00017
00018 extern int _noDirTokens;
00019
00020
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024
00028
00029 extern struct poptOption rpmcliAllPoptTable[];
00030
00031
00032 extern int ftsOpts;
00033
00034
00035 extern struct poptOption rpmcliFtsPoptTable[];
00036
00037
00038 extern const char * rpmcliPipeOutput;
00039
00040
00041 extern const char * rpmcliRcfile;
00042
00043
00044 extern const char * rpmcliRootDir;
00045
00053
00054 poptContext
00055 rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
00056
00057
00058
00059 ;
00060
00065
00066 void rpmcliConfigured(void)
00067
00068
00069
00070 ;
00071
00077 poptContext
00078 rpmcliFini( poptContext optCon)
00079 ;
00080
00084 #define RPMCLI_POPT_NODEPS -1025
00085 #define RPMCLI_POPT_FORCE -1026
00086 #define RPMCLI_POPT_NOMD5 -1027
00087 #define RPMCLI_POPT_NOSCRIPTS -1028
00088 #define RPMCLI_POPT_NOSIGNATURE -1029
00089 #define RPMCLI_POPT_NODIGEST -1030
00090 #define RPMCLI_POPT_NOHDRCHK -1031
00091 #define RPMCLI_POPT_NOCONTEXTS -1032
00092
00093
00096
00101 typedef enum rpmQVSources_e {
00102 RPMQV_PACKAGE = 0,
00103 RPMQV_PATH,
00104 RPMQV_ALL,
00105 RPMQV_RPM,
00106 RPMQV_GROUP,
00107 RPMQV_WHATPROVIDES,
00108 RPMQV_WHATREQUIRES,
00109 RPMQV_TRIGGEREDBY,
00110 RPMQV_DBOFFSET,
00111 RPMQV_SPECFILE,
00112 RPMQV_PKGID,
00113 RPMQV_HDRID,
00114 RPMQV_FILEID,
00115 RPMQV_TID,
00116 RPMQV_HDLIST,
00117 RPMQV_FTSWALK
00118 } rpmQVSources;
00119
00123 typedef enum rpmVerifyAttrs_e {
00124 RPMVERIFY_NONE = 0,
00125 RPMVERIFY_MD5 = (1 << 0),
00126 RPMVERIFY_FILESIZE = (1 << 1),
00127 RPMVERIFY_LINKTO = (1 << 2),
00128 RPMVERIFY_USER = (1 << 3),
00129 RPMVERIFY_GROUP = (1 << 4),
00130 RPMVERIFY_MTIME = (1 << 5),
00131 RPMVERIFY_MODE = (1 << 6),
00132 RPMVERIFY_RDEV = (1 << 7),
00133
00134 RPMVERIFY_CONTEXTS = (1 << 15),
00135
00136
00137 RPMVERIFY_READLINKFAIL= (1 << 28),
00138 RPMVERIFY_READFAIL = (1 << 29),
00139 RPMVERIFY_LSTATFAIL = (1 << 30),
00140 RPMVERIFY_LGETFILECONFAIL = (1 << 31)
00141 } rpmVerifyAttrs;
00142 #define RPMVERIFY_ALL ~(RPMVERIFY_NONE)
00143 #define RPMVERIFY_FAILURES \
00144 (RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_LGETFILECONFAIL)
00145
00150 typedef enum rpmQueryFlags_e {
00151
00152 QUERY_FOR_DEFAULT = 0,
00153 QUERY_MD5 = (1 << 0),
00154 QUERY_SIZE = (1 << 1),
00155 QUERY_LINKTO = (1 << 2),
00156 QUERY_USER = (1 << 3),
00157 QUERY_GROUP = (1 << 4),
00158 QUERY_MTIME = (1 << 5),
00159 QUERY_MODE = (1 << 6),
00160 QUERY_RDEV = (1 << 7),
00161
00162 QUERY_CONTEXTS = (1 << 15),
00163 QUERY_FILES = (1 << 16),
00164 QUERY_DEPS = (1 << 17),
00165 QUERY_SCRIPT = (1 << 18),
00166 QUERY_DIGEST = (1 << 19),
00167 QUERY_SIGNATURE = (1 << 20),
00168 QUERY_PATCHES = (1 << 21),
00169 QUERY_HDRCHK = (1 << 22),
00170
00171 QUERY_FOR_LIST = (1 << 23),
00172 QUERY_FOR_STATE = (1 << 24),
00173 QUERY_FOR_DOCS = (1 << 25),
00174 QUERY_FOR_CONFIG = (1 << 26),
00175 QUERY_FOR_DUMPFILES = (1 << 27)
00176 } rpmQueryFlags;
00177
00178 #define _QUERY_FOR_BITS \
00179 (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
00180 QUERY_FOR_DUMPFILES)
00181
00185
00186 extern rpmQueryFlags rpmcliQueryFlags;
00187
00192 typedef enum rpmVerifyFlags_e {
00193
00194 VERIFY_DEFAULT = 0,
00195
00196 VERIFY_MD5 = (1 << 0),
00197 VERIFY_SIZE = (1 << 1),
00198 VERIFY_LINKTO = (1 << 2),
00199 VERIFY_USER = (1 << 3),
00200 VERIFY_GROUP = (1 << 4),
00201 VERIFY_MTIME = (1 << 5),
00202 VERIFY_MODE = (1 << 6),
00203 VERIFY_RDEV = (1 << 7),
00204
00205 VERIFY_CONTEXTS = (1 << 15),
00206 VERIFY_FILES = (1 << 16),
00207 VERIFY_DEPS = (1 << 17),
00208 VERIFY_SCRIPT = (1 << 18),
00209 VERIFY_DIGEST = (1 << 19),
00210 VERIFY_SIGNATURE = (1 << 20),
00211 VERIFY_PATCHES = (1 << 21),
00212 VERIFY_HDRCHK = (1 << 22),
00213
00214 VERIFY_FOR_LIST = (1 << 23),
00215 VERIFY_FOR_STATE = (1 << 24),
00216 VERIFY_FOR_DOCS = (1 << 25),
00217 VERIFY_FOR_CONFIG = (1 << 26),
00218 VERIFY_FOR_DUMPFILES= (1 << 27)
00219
00220
00221 } rpmVerifyFlags;
00222
00223 #define VERIFY_ATTRS \
00224 ( VERIFY_MD5 | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \
00225 VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV | VERIFY_CONTEXTS )
00226 #define VERIFY_ALL \
00227 ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST |\
00228 VERIFY_SIGNATURE | VERIFY_HDRCHK )
00229
00232 typedef struct rpmQVKArguments_s * QVA_t;
00233
00242 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h)
00243
00244 ;
00245
00254 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg)
00255
00256
00257
00258 ;
00259
00263 struct rpmQVKArguments_s {
00264 rpmQVSources qva_source;
00265 int qva_sourceCount;
00266 rpmQueryFlags qva_flags;
00267 rpmfileAttrs qva_fflags;
00268
00269 rpmdbMatchIterator qva_mi;
00270
00271 rpmgi qva_gi;
00272 rpmRC qva_rc;
00274
00275 QVF_t qva_showPackage;
00276
00277 QSpecF_t qva_specQuery;
00278
00279 int qva_verbose;
00280
00281 const char * qva_queryFormat;
00282 int sign;
00283 int trust;
00284
00285 const char * passPhrase;
00286
00287 const char * qva_prefix;
00288 char qva_mode;
00298 char qva_char;
00299 };
00300
00303
00304 extern struct rpmQVKArguments_s rpmQVKArgs;
00305
00308
00309 extern struct poptOption rpmQVSourcePoptTable[];
00310
00313
00314 extern int specedit;
00315
00318
00319 extern struct poptOption rpmQueryPoptTable[];
00320
00323
00324 extern struct poptOption rpmVerifyPoptTable[];
00325
00337 int rpmcliShowMatches(QVA_t qva, rpmts ts)
00338
00339 ;
00340
00345 void rpmDisplayQueryTags(FILE * fp)
00346
00347 ;
00348
00361 int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
00362
00363
00364
00365 ;
00366
00375 int showQueryPackage(QVA_t qva, rpmts ts, Header h)
00376
00377 ;
00378
00386 int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_t argv)
00387
00388
00389
00390 ;
00391
00400 int rpmcliQuery(rpmts ts, QVA_t qva, const char ** argv)
00401
00402
00403
00404 ;
00405
00415
00416 int rpmVerifyFile(const rpmts ts, rpmfi fi,
00417 rpmVerifyAttrs * res, rpmVerifyAttrs omitMask)
00418
00419
00420 ;
00421
00422
00430 int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
00431
00432 ;
00433
00442 int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn)
00443
00444
00445 ;
00446
00455 int rpmcliVerify(rpmts ts, QVA_t qva, const char ** argv)
00456
00457
00458
00459 ;
00460
00462
00465
00469 struct rpmBuildArguments_s {
00470 rpmQueryFlags qva_flags;
00471 int buildAmount;
00472
00473 const char * buildRootOverride;
00474
00475 char * targets;
00476
00477 const char * passPhrase;
00478
00479 const char * cookie;
00480 int force;
00481 int noBuild;
00482 int noDeps;
00483 int noLang;
00484 int shortCircuit;
00485 int sign;
00486 int useCatalog;
00487 char buildMode;
00488 char buildChar;
00489
00490 const char * rootdir;
00491 };
00492
00495 typedef struct rpmBuildArguments_s * BTA_t;
00496
00499
00500 extern struct rpmBuildArguments_s rpmBTArgs;
00501
00504
00505 extern struct poptOption rpmBuildPoptTable[];
00506
00508
00511
00512
00513
00514 extern int rpmcliPackagesTotal;
00515
00516 extern int rpmcliHashesCurrent;
00517
00518 extern int rpmcliHashesTotal;
00519
00520 extern int rpmcliProgressCurrent;
00521
00522 extern int rpmcliProgressTotal;
00523
00538
00539 void * rpmShowProgress( const void * arg,
00540 const rpmCallbackType what,
00541 const unsigned long amount,
00542 const unsigned long total,
00543 fnpyKey key,
00544 void * data)
00545
00546
00547
00548
00549
00550 ;
00551
00560 int rpmInstallSource(rpmts ts, const char * arg,
00561 const char ** specFilePtr,
00562 const char ** cookie)
00563
00564
00565
00566 ;
00567
00571 struct rpmInstallArguments_s {
00572 rpmtransFlags transFlags;
00573 rpmprobFilterFlags probFilter;
00574 rpmInstallInterfaceFlags installInterfaceFlags;
00575 rpmEraseInterfaceFlags eraseInterfaceFlags;
00576 rpmQueryFlags qva_flags;
00577 uint_32 rbtid;
00578 int numRelocations;
00579 int noDeps;
00580 int incldocs;
00581
00582 rpmRelocation * relocations;
00583
00584 const char * prefix;
00585
00586 const char * rootdir;
00587 };
00588
00596 int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia,
00597 const char ** fileArgv)
00598
00599
00600
00601 ;
00602
00610 int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia,
00611 const char ** argv)
00612
00613
00614 ;
00615
00619
00620 typedef struct IDT_s {
00621 unsigned int instance;
00622
00623 const char * key;
00624 Header h;
00625 union {
00626 uint_32 u32;
00627 } val;
00628 } * IDT;
00629
00630
00634 typedef struct IDTindex_s {
00635 int delta;
00636 int size;
00637 int alloced;
00638 int nidt;
00639
00640 IDT idt;
00641 } * IDTX;
00642
00648
00649 IDTX IDTXfree( IDTX idtx)
00650 ;
00651
00656
00657 IDTX IDTXnew(void)
00658 ;
00659
00666
00667 IDTX IDTXgrow( IDTX idtx, int need)
00668 ;
00669
00675
00676 IDTX IDTXsort( IDTX idtx)
00677 ;
00678
00685
00686 IDTX IDTXload(rpmts ts, rpmTag tag)
00687
00688 ;
00689
00697
00698 IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
00699
00700 ;
00701
00709 int rpmRollback(rpmts ts, struct rpmInstallArguments_s * ia,
00710 const char ** argv)
00711
00712
00713
00714 ;
00715
00718
00719 extern struct rpmInstallArguments_s rpmIArgs;
00720
00723
00724 extern struct poptOption rpmInstallPoptTable[];
00725
00727
00730
00731
00735 struct rpmDatabaseArguments_s {
00736 int init;
00737 int rebuild;
00738 int verify;
00739 };
00740
00743
00744 extern struct rpmDatabaseArguments_s rpmDBArgs;
00745
00748
00749 extern struct poptOption rpmDatabasePoptTable[];
00750
00752
00755
00764 rpmRC rpmcliImportPubkey(const rpmts ts,
00765 const unsigned char * pkt, ssize_t pktlen)
00766
00767
00768
00769 ;
00770
00774
00775 typedef enum rpmSignFlags_e {
00776 RPMSIGN_NONE = 0,
00777 RPMSIGN_CHK_SIGNATURE = 'K',
00778 RPMSIGN_NEW_SIGNATURE = 'R',
00779 RPMSIGN_ADD_SIGNATURE = 'A',
00780 RPMSIGN_DEL_SIGNATURE = 'D',
00781 RPMSIGN_IMPORT_PUBKEY = 'I',
00782 } rpmSignFlags;
00783
00784
00787
00788 extern struct poptOption rpmSignPoptTable[];
00789
00797 int rpmcliSign(rpmts ts, QVA_t qva, const char ** argv)
00798
00799
00800
00801 ;
00802
00805 #ifdef __cplusplus
00806 }
00807 #endif
00808
00809 #endif