rpm 5.2.1

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

- File List
- Globals

lib/rpmcli.h
Go to the documentation of this file.

    00001 #ifndef H_RPMCLI
    00002 #define H_RPMCLI
    00003
    00008 #include <popt.h>
    00009 #include <rpmmacro.h>
    00010 #include <rpmtypes.h>
    00011 #include <rpmtag.h>
    00012 #include <rpmps.h>
    00013 #include <rpmrc.h>
    00014 #include <rpmfi.h>      /* XXX rpmfileAttrs */
    00015 #include <rpmts.h>      /* XXX rpmdepFlags */
    00016
    00021 /*@-redecl@*/
    00022 /*@unchecked@*/
    00023 extern headerSprintfExtension rpmHeaderFormats;
    00024 /*@=redecl@*/
    00025
    00029 /*@-redecl@*/
    00030 /*@unchecked@*/
    00031 extern int _noDirTokens;
    00032 /*@=redecl@*/
    00033
    00034 #ifdef __cplusplus
    00035 extern "C" {
    00036 #endif
    00037
    00041 /*@unchecked@*/
    00042 extern struct poptOption                rpmcliAllPoptTable[];
    00043
    00044 /*@unchecked@*/
    00045 extern int global_depFlags;
    00046
    00047 /*@unchecked@*/
    00048 extern struct poptOption                rpmcliDepFlagsPoptTable[];
    00049
    00050 /*@unchecked@*/ /*@observer@*/ /*@null@*/
    00051 extern const char * rpmcliTargets;
    00052 /*@=redecl@*/
    00053
    00061 /*@null@*/
    00062 poptContext
    00063 rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
    00064         /*@globals rpmCLIMacroContext, rpmGlobalMacroContext, h_errno, stderr,
    00065                 fileSystem, internalState @*/
    00066         /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext, stderr,
    00067                 fileSystem, internalState @*/;
    00068
    00073 /*@mayexit@*/
    00074 void rpmcliConfigured(void)
    00075         /*@globals rpmCLIMacroContext,
    00076                 rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00077         /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext,
    00078                 fileSystem, internalState @*/;
    00079
    00085 poptContext
    00086 rpmcliFini(/*@only@*/ /*@null@*/ poptContext optCon)
    00087         /*@globals rpmTags, rpmGlobalMacroContext,
    00088                 fileSystem, internalState @*/
    00089         /*@modifies optCon, rpmTags, rpmGlobalMacroContext,
    00090                 fileSystem, internalState @*/;
    00091
    00095 #define RPMCLI_POPT_NODEPS              -1026
    00096 #define RPMCLI_POPT_NOFDIGESTS          -1027
    00097 #define RPMCLI_POPT_NOSCRIPTS           -1028
    00098 #define RPMCLI_POPT_NOSIGNATURE         -1029
    00099 #define RPMCLI_POPT_NODIGEST            -1030
    00100 #define RPMCLI_POPT_NOHDRCHK            -1031
    00101 #define RPMCLI_POPT_NOCONTEXTS          -1032
    00102 #define RPMCLI_POPT_TARGETPLATFORM      -1033
    00103
    00104 /* ==================================================================== */
    00107
    00112 typedef enum rpmQVSources_e {
    00113     RPMQV_PACKAGE = 0,
    00114     RPMQV_PATH,
    00115     RPMQV_ALL,
    00116     RPMQV_RPM,
    00117     RPMQV_GROUP         = RPMTAG_GROUP,
    00118     RPMQV_WHATPROVIDES,
    00119     RPMQV_WHATREQUIRES,
    00120     RPMQV_TRIGGEREDBY   = RPMTAG_TRIGGERNAME,
    00121     RPMQV_DBOFFSET,
    00122     RPMQV_SPECFILE,
    00123     RPMQV_PKGID,
    00124     RPMQV_HDRID,
    00125     RPMQV_FILEID,
    00126     RPMQV_TID,
    00127     RPMQV_HDLIST,
    00128     RPMQV_FTSWALK,
    00129     RPMQV_WHATNEEDS,
    00130     RPMQV_SPECSRPM,
    00131     RPMQV_SOURCEPKGID,
    00132     RPMQV_WHATCONFLICTS = RPMTAG_CONFLICTNAME,
    00133     RPMQV_WHATOBSOLETES = RPMTAG_OBSOLETENAME
    00134 } rpmQVSources;
    00135
    00139 typedef enum rpmVerifyAttrs_e {
    00140     RPMVERIFY_NONE      = 0,
    00141     RPMVERIFY_FDIGEST   = (1 << 0),
    00142     RPMVERIFY_FILESIZE  = (1 << 1),
    00143     RPMVERIFY_LINKTO    = (1 << 2),
    00144     RPMVERIFY_USER      = (1 << 3),
    00145     RPMVERIFY_GROUP     = (1 << 4),
    00146     RPMVERIFY_MTIME     = (1 << 5),
    00147     RPMVERIFY_MODE      = (1 << 6),
    00148     RPMVERIFY_RDEV      = (1 << 7),
    00149         /* bits 8-14 unused, reserved for rpmVerifyAttrs */
    00150     RPMVERIFY_CONTEXTS  = (1 << 15),
    00151         /* bits 16-22 used in rpmVerifyFlags */
    00152         /* bits 23-27 used in rpmQueryFlags */
    00153     RPMVERIFY_READLINKFAIL= (1 << 28),
    00154     RPMVERIFY_READFAIL  = (1 << 29),
    00155     RPMVERIFY_LSTATFAIL = (1 << 30),
    00156     RPMVERIFY_LGETFILECONFAIL   = (1 << 31)
    00157 } rpmVerifyAttrs;
    00158 #define RPMVERIFY_MD5   RPMVERIFY_FDIGEST
    00159 #define RPMVERIFY_ALL           ~(RPMVERIFY_NONE)
    00160 #define RPMVERIFY_FAILURES      \
    00161   (RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_LGETFILECONFAIL)
    00162
    00167 typedef enum rpmQueryFlags_e {
    00168 /*@-enummemuse@*/
    00169     QUERY_FOR_DEFAULT   = 0,
    00170     QUERY_FDIGEST       = (1 << 0),
    00171     QUERY_SIZE          = (1 << 1),
    00172     QUERY_LINKTO        = (1 << 2),
    00173     QUERY_USER          = (1 << 3),
    00174     QUERY_GROUP         = (1 << 4),
    00175     QUERY_MTIME         = (1 << 5),
    00176     QUERY_MODE          = (1 << 6),
    00177     QUERY_RDEV          = (1 << 7),
    00178         /* bits 8-14 unused, reserved for rpmVerifyAttrs */
    00179     QUERY_CONTEXTS      = (1 << 15),
    00180     QUERY_FILES         = (1 << 16),
    00181     QUERY_DEPS          = (1 << 17),
    00182     QUERY_SCRIPT        = (1 << 18),
    00183     QUERY_DIGEST        = (1 << 19),
    00184     QUERY_SIGNATURE     = (1 << 20),
    00185     QUERY_PATCHES       = (1 << 21),
    00186     QUERY_HDRCHK        = (1 << 22),
    00187 /*@=enummemuse@*/
    00188     QUERY_FOR_LIST      = (1 << 23),
    00189     QUERY_FOR_STATE     = (1 << 24),
    00190     QUERY_FOR_DOCS      = (1 << 25),
    00191     QUERY_FOR_CONFIG    = (1 << 26),
    00192     QUERY_FOR_DUMPFILES = (1 << 27)
    00193 } rpmQueryFlags;
    00194
    00195 #define _QUERY_FOR_BITS \
    00196    (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\
    00197     QUERY_FOR_DUMPFILES)
    00198
    00202 /*@unchecked@*/
    00203 extern rpmQueryFlags rpmcliQueryFlags;
    00204
    00209 typedef enum rpmVerifyFlags_e {
    00210 /*@-enummemuse@*/
    00211     VERIFY_DEFAULT      = 0,
    00212 /*@=enummemuse@*/
    00213     VERIFY_FDIGEST      = (1 << 0),
    00214     VERIFY_SIZE         = (1 << 1),
    00215     VERIFY_LINKTO       = (1 << 2),
    00216     VERIFY_USER         = (1 << 3),
    00217     VERIFY_GROUP        = (1 << 4),
    00218     VERIFY_MTIME        = (1 << 5),
    00219     VERIFY_MODE         = (1 << 6),
    00220     VERIFY_RDEV         = (1 << 7),
    00221         /* bits 8-14 unused, reserved for rpmVerifyAttrs */
    00222     VERIFY_CONTEXTS     = (1 << 15),
    00223     VERIFY_FILES        = (1 << 16),
    00224     VERIFY_DEPS         = (1 << 17),
    00225     VERIFY_SCRIPT       = (1 << 18),
    00226     VERIFY_DIGEST       = (1 << 19),
    00227     VERIFY_SIGNATURE    = (1 << 20),
    00228     VERIFY_PATCHES      = (1 << 21),
    00229     VERIFY_HDRCHK       = (1 << 22),
    00230 /*@-enummemuse@*/
    00231     VERIFY_FOR_LIST     = (1 << 23),
    00232     VERIFY_FOR_STATE    = (1 << 24),
    00233     VERIFY_FOR_DOCS     = (1 << 25),
    00234     VERIFY_FOR_CONFIG   = (1 << 26),
    00235     VERIFY_FOR_DUMPFILES= (1 << 27)
    00236 /*@=enummemuse@*/
    00237         /* bits 28-31 used in rpmVerifyAttrs */
    00238 } rpmVerifyFlags;
    00239
    00240 #define VERIFY_ATTRS    \
    00241   ( VERIFY_FDIGEST | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \
    00242     VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV | VERIFY_CONTEXTS )
    00243 #define VERIFY_ALL      \
    00244   ( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST |\
    00245     VERIFY_SIGNATURE | VERIFY_HDRCHK )
    00246
    00249 typedef struct rpmQVKArguments_s * QVA_t;
    00250
    00259 typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h)
    00260         /*@globals fileSystem @*/
    00261         /*@modifies qva, ts, fileSystem @*/;
    00262
    00271 typedef int (*QSpecF_t) (rpmts ts, QVA_t qva, const char * arg)
    00272         /*@globals rpmGlobalMacroContext, h_errno,
    00273                 fileSystem, internalState @*/
    00274         /*@modifies ts, qva, rpmGlobalMacroContext,
    00275                 fileSystem, internalState @*/;
    00276
    00279 /*@unchecked@*/
    00280 extern struct poptOption rpmQVSourcePoptTable[];
    00281
    00284 /*@unchecked@*/
    00285 extern int specedit;
    00286
    00289 /*@unchecked@*/
    00290 extern struct poptOption rpmQueryPoptTable[];
    00291
    00294 /*@unchecked@*/
    00295 extern struct poptOption rpmVerifyPoptTable[];
    00296
    00308 int rpmcliShowMatches(QVA_t qva, rpmts ts)
    00309         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00310         /*@modifies qva, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00311
    00324 int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
    00325         /*@globals rpmGlobalMacroContext, h_errno,
    00326                 fileSystem, internalState @*/
    00327         /*@modifies qva, ts, rpmGlobalMacroContext,
    00328                 fileSystem, internalState @*/;
    00329
    00338 int showQueryPackage(QVA_t qva, rpmts ts, Header h)
    00339         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00340         /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00341
    00349 int rpmcliArgIter(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
    00350         /*@globals rpmGlobalMacroContext, h_errno,
    00351                 fileSystem, internalState @*/
    00352         /*@modifies ts, qva, rpmGlobalMacroContext,
    00353                 fileSystem, internalState @*/;
    00354
    00363 int rpmcliQuery(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
    00364         /*@globals rpmGlobalMacroContext, h_errno,
    00365                 fileSystem, internalState @*/
    00366         /*@modifies ts, qva, rpmGlobalMacroContext,
    00367                 fileSystem, internalState @*/;
    00368
    00376 int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
    00377         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00378         /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00379
    00388 int rpmVerifySignatures(QVA_t qva, rpmts ts, void * _fd, const char * fn)
    00389         /*@globals fileSystem, internalState @*/
    00390         /*@modifies qva, ts, fileSystem, internalState @*/;
    00391
    00400 int rpmcliVerify(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
    00401         /*@globals rpmGlobalMacroContext, h_errno,
    00402                 fileSystem, internalState @*/
    00403         /*@modifies ts, qva, rpmGlobalMacroContext,
    00404                 fileSystem, internalState @*/;
    00405
    00407 /* ==================================================================== */
    00410 /* --- install/upgrade/erase modes */
    00411
    00415 typedef enum rpmInstallInterfaceFlags_e {
    00416     INSTALL_NONE        = 0,
    00417     INSTALL_PERCENT     = (1 <<  0),
    00418     INSTALL_HASH        = (1 <<  1),
    00419     INSTALL_NODEPS      = (1 <<  2),
    00420     INSTALL_NOORDER     = (1 <<  3),
    00421     INSTALL_LABEL       = (1 <<  4),
    00422     INSTALL_UPGRADE     = (1 <<  5),
    00423     INSTALL_FRESHEN     = (1 <<  6),
    00424     INSTALL_INSTALL     = (1 <<  7),
    00425     INSTALL_ERASE       = (1 <<  8),
    00426     INSTALL_ALLMATCHES  = (1 <<  9)
    00427 } rpmInstallInterfaceFlags;
    00428
    00429 /*@-redecl@*/
    00430 /*@unchecked@*/
    00431 extern int rpmcliPackagesTotal;
    00432 /*@=redecl@*/
    00433 /*@unchecked@*/
    00434 extern int rpmcliHashesCurrent;
    00435 /*@unchecked@*/
    00436 extern int rpmcliHashesTotal;
    00437 /*@unchecked@*/
    00438 extern rpmuint64_t rpmcliProgressCurrent;
    00439 /*@unchecked@*/
    00440 extern rpmuint64_t rpmcliProgressTotal;
    00441
    00458 /*@null@*/
    00459 void * rpmShowProgress(/*@null@*/ const void * arg,
    00460                 const rpmCallbackType what,
    00461                 const rpmuint64_t amount,
    00462                 const rpmuint64_t total,
    00463                 /*@null@*/ fnpyKey key,
    00464                 /*@null@*/ void * data)
    00465         /*@globals rpmcliHashesCurrent,
    00466                 rpmcliProgressCurrent, rpmcliProgressTotal,
    00467                 h_errno, rpmGlobalMacroContext, fileSystem, internalState @*/
    00468         /*@modifies arg, rpmcliHashesCurrent,
    00469                 rpmcliProgressCurrent, rpmcliProgressTotal,
    00470                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00471
    00480 int rpmInstallSource(rpmts ts, const char * arg,
    00481                 /*@null@*/ /*@out@*/ const char ** specFilePtr,
    00482                 /*@null@*/ /*@out@*/ const char ** cookie)
    00483         /*@globals rpmGlobalMacroContext, h_errno,
    00484                 fileSystem, internalState@*/
    00485         /*@modifies ts, *specFilePtr, *cookie, rpmGlobalMacroContext,
    00486                 fileSystem, internalState @*/;
    00487
    00495 int rpmcliInstallProblems(rpmts ts, /*@null@*/ const char * msg, int rc)
    00496         /*@globals fileSystem, internalState @*/
    00497         /*@modifies ts, fileSystem, internalState @*/;
    00498
    00504 int rpmcliInstallSuggests(rpmts ts)
    00505         /*@globals internalState @*/
    00506         /*@modifies ts, internalState @*/;
    00507
    00513 int rpmcliInstallCheck(rpmts ts)
    00514         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00515         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00516
    00522 int rpmcliInstallOrder(rpmts ts)
    00523         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00524         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00525
    00533 int rpmcliInstallRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
    00534         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00535         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00536
    00545 int rpmcliInstall(rpmts ts, QVA_t ia, /*@null@*/ const char ** argv)
    00546         /*@globals rpmcliPackagesTotal, rpmGlobalMacroContext, h_errno,
    00547                 fileSystem, internalState@*/
    00548         /*@modifies ts, ia, rpmcliPackagesTotal, rpmGlobalMacroContext,
    00549                 fileSystem, internalState @*/;
    00550
    00558 int rpmErase(rpmts ts, QVA_t ia, /*@null@*/ const char ** argv)
    00559         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00560         /*@modifies ts, ia, rpmGlobalMacroContext,
    00561                 fileSystem, internalState @*/;
    00562
    00565 /*@unchecked@*/
    00566 extern struct poptOption rpmInstallPoptTable[];
    00567
    00569 /* ==================================================================== */
    00572
    00575 /*@unchecked@*/
    00576 extern struct poptOption rpmDatabasePoptTable[];
    00577
    00579 /* ==================================================================== */
    00582
    00591 rpmRC rpmcliImportPubkey(const rpmts ts,
    00592                 const unsigned char * pkt, ssize_t pktlen)
    00593         /*@globals rpmGlobalMacroContext, h_errno,
    00594                 fileSystem, internalState @*/
    00595         /*@modifies ts, rpmGlobalMacroContext,
    00596                 fileSystem, internalState @*/;
    00597
    00601 /*@-typeuse@*/
    00602 #if !defined(SWIG)
    00603 typedef enum rpmSignFlags_e {
    00604     RPMSIGN_NONE                = 0,
    00605     RPMSIGN_CHK_SIGNATURE       = 'K',
    00606     RPMSIGN_NEW_SIGNATURE       = 'R',
    00607     RPMSIGN_ADD_SIGNATURE       = 'A',
    00608     RPMSIGN_DEL_SIGNATURE       = 'D',
    00609     RPMSIGN_IMPORT_PUBKEY       = 'I',
    00610 } rpmSignFlags;
    00611 #endif
    00612 /*@=typeuse@*/
    00613
    00616 /*@unchecked@*/
    00617 extern struct poptOption rpmSignPoptTable[];
    00618
    00626 int rpmcliSign(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
    00627         /*@globals rpmGlobalMacroContext, h_errno,
    00628                 fileSystem, internalState @*/
    00629         /*@modifies ts, qva, rpmGlobalMacroContext,
    00630                 fileSystem, internalState @*/;
    00631
    00637 #if !defined(SWIG)
    00638 struct rpmQVKArguments_s {
    00639     rpmQVSources qva_source;
    00640     int         qva_sourceCount;
    00641     rpmQueryFlags qva_flags;
    00642     rpmfileAttrs qva_fflags;
    00643 /*@only@*/ /*@null@*/
    00644     rpmmi qva_mi;
    00645 /*@refccounted@*/ /*@relnull@*/
    00646     rpmgi qva_gi;
    00647     rpmRC qva_rc;
    00649 /*@null@*/
    00650     QVF_t qva_showPackage;
    00651     int qva_showOK;
    00652     int qva_showFAIL;
    00653 /*@null@*/
    00654     QSpecF_t qva_specQuery;
    00655 /*@unused@*/
    00656     int qva_verbose;
    00657 /*@only@*/ /*@null@*/
    00658     const char * qva_queryFormat;
    00659     int sign;
    00660     int nopassword;
    00661     int trust;
    00662 /*@observer@*/
    00663     const char * passPhrase;
    00664 /*@owned@*/ /*@null@*/
    00665     const char * qva_prefix;
    00666     char qva_mode;
    00676     char qva_char;
    00678     /* install/erase mode arguments */
    00679     rpmdepFlags depFlags;
    00680     rpmtransFlags transFlags;
    00681     rpmprobFilterFlags probFilter;
    00682     rpmInstallInterfaceFlags installInterfaceFlags;
    00683     rpmuint32_t arbtid;
    00684     rpmuint32_t rbtid;
    00685     rpmuint32_t *rbtidExcludes;
    00686     int numrbtidExcludes;
    00687     int noDeps;
    00688     int incldocs;
    00689     int no_rollback_links;
    00690 /*@owned@*/ /*@relnull@*/
    00691     rpmRelocation relocations;
    00692     int nrelocations;
    00693
    00694     /* database mode arguments */
    00695     int init;
    00696     int rebuild;
    00697     int verify;
    00699     /* rollback vectors */
    00700     int (*rbCheck) (rpmts ts);
    00701     int (*rbOrder) (rpmts ts);
    00702     int (*rbRun) (rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet);
    00703 };
    00704 #endif
    00705
    00708 /*@unchecked@*/
    00709 extern struct rpmQVKArguments_s rpmQVKArgs;
    00710
    00713 /*@unchecked@*/
    00714 extern struct rpmQVKArguments_s rpmIArgs;
    00715
    00718 /*@unchecked@*/
    00719 extern struct rpmQVKArguments_s rpmDBArgs;
    00720
    00721 /* ==================================================================== */
    00724
    00728 struct rpmBuildArguments_s {
    00729     rpmQueryFlags qva_flags;
    00730     int buildAmount;
    00731 /*@observer@*/
    00732     const char * passPhrase;
    00733 /*@only@*/ /*@null@*/
    00734     const char * cookie;
    00735     int noBuild;
    00736     int noDeps;
    00737     int noLang;
    00738     int shortCircuit;
    00739     int sign;
    00740     int nopassword;
    00741     int useCatalog;
    00742     char buildMode;
    00743     char buildChar;
    00744 /*@observer@*/ /*@null@*/
    00745     const char * rootdir;
    00746 };
    00747
    00750 typedef struct rpmBuildArguments_s *    BTA_t;
    00751
    00754 /*@unchecked@*/
    00755 extern struct rpmBuildArguments_s       rpmBTArgs;
    00756
    00759 /*@unchecked@*/
    00760 extern struct poptOption                rpmBuildPoptTable[];
    00761
    00764 #ifdef __cplusplus
    00765 }
    00766 #endif
    00767
    00768 #endif  /* H_RPMCLI */