Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

lib/rpminstall.c File Reference

More...

#include "system.h"
#include <rpmcli.h>
#include "rpmdb.h"
#include "rpmds.h"
#include "rpmts.h"
#include "manifest.h"
#include "misc.h"
#include "debug.h"

Go to the source code of this file.

Data Structures

struct  rpmEIU

Defines

#define _RPMTS_INTERNAL

Typedefs

typedef const char * str_t

Functions

void printHash (const unsigned long amount, const unsigned long total)
 Print a CLI progress bar.

void * rpmShowProgress (const void *arg, const rpmCallbackType what, const unsigned long amount, const unsigned long total, fnpyKey key, void *data)
int rpmInstall (rpmts ts, struct rpmInstallArguments_s *ia, const char **fileArgv)
int rpmErase (rpmts ts, struct rpmInstallArguments_s *ia, const char **argv)
int rpmInstallSource (rpmts ts, const char *arg, const char **specFilePtr, const char **cookie)
int IDTintcmp (const void *a, const void *b)
IDTX IDTXfree (IDTX idtx)
 Destroy id index.

IDTX IDTXgrow (IDTX idtx, int need)
 Insure that index has room for "need" elements.

IDTX IDTXsort (IDTX idtx)
 Sort tag (instance,value) pairs.

IDTX IDTXload (rpmts ts, rpmTag tag)
 Load tag (instance,value) pairs from rpm databse, and return sorted id index.

IDTX IDTXglob (rpmts ts, const char *globstr, rpmTag tag)
 Load tag (instance,value) pairs from packages, and return sorted id index.

int rpmRollback (rpmts ts, struct rpmInstallArguments_s *ia, const char **argv)

Variables

int rpmcliPackagesTotal = 0
int rpmcliHashesCurrent = 0
int rpmcliHashesTotal = 0
int rpmcliProgressCurrent = 0
int rpmcliProgressTotal = 0
int reverse = -1
IDTX IDTXnew (void)


Detailed Description

Definition in file rpminstall.c.


Define Documentation

#define _RPMTS_INTERNAL
 

Definition at line 12 of file rpminstall.c.


Typedef Documentation

typedef const char* str_t
 

Definition at line 255 of file rpminstall.c.


Function Documentation

int IDTintcmp const void *    a,
const void *    b
[static]
 

Definition at line 880 of file rpminstall.c.

References reverse.

Referenced by IDTXsort().

IDTX IDTXfree IDTX    idtx
 

Destroy id index.

Parameters:
idtx  id index
Returns:
NULL always

Definition at line 888 of file rpminstall.c.

References _free(), IDT_s::h, headerFree(), and IDT_s::key.

Referenced by rpmRollback(), rpmts_IDTXglob(), and rpmts_IDTXload().

IDTX IDTXglob rpmts    ts,
const char *    globstr,
rpmTag    tag
 

Load tag (instance,value) pairs from packages, and return sorted id index.

Parameters:
ts  transaction set
globstr  glob expression
tag  rpm tag
Returns:
id index

Definition at line 983 of file rpminstall.c.

References _, _free(), Fclose(), Ferror(), Fopen(), Fstrerror(), IDT_s::h, headerFree(), headerIsEntry(), headerLink(), HGE_t, IDTindex_s::idt, IDTXgrow(), IDTXsort(), IDT_s::instance, int_32, IDT_s::key, IDTindex_s::nidt, RPMERR_OPEN, rpmError, rpmGlob(), rpmRC, RPMRC_NOKEY, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), rpmTag, RPMTAG_SOURCEPACKAGE, rpmTagType, rpmts, and IDT_s::val.

Referenced by rpmRollback(), and rpmts_IDTXglob().

IDTX IDTXgrow IDTX    idtx,
int    need
 

Insure that index has room for "need" elements.

Parameters:
idtx  id index
need  additional no. of elements needed
Returns:
id index (with room for "need" elements)

Definition at line 912 of file rpminstall.c.

References IDTindex_s::alloced, IDTindex_s::delta, IDTindex_s::idt, IDTXnew, IDTindex_s::nidt, IDTindex_s::size, and xrealloc().

Referenced by IDTXglob(), and IDTXload().

IDTX IDTXload rpmts    ts,
rpmTag    tag
 

Load tag (instance,value) pairs from rpm databse, and return sorted id index.

Parameters:
ts  transaction set
tag  rpm tag
Returns:
id index

Definition at line 936 of file rpminstall.c.

References IDT_s::h, headerLink(), HGE_t, IDTindex_s::idt, IDTXgrow(), IDTXsort(), IDT_s::instance, int_32, IDT_s::key, IDTindex_s::nidt, RPM_INT32_TYPE, RPM_NULL_TYPE, rpmdbFreeIterator(), rpmdbGetIteratorOffset(), rpmdbNextIterator(), rpmdbSetIteratorRE(), RPMMIRE_DEFAULT, rpmTag, RPMTAG_NAME, rpmTagType, rpmts, rpmtsInitIterator(), and IDT_s::val.

Referenced by rpmRollback(), and rpmts_IDTXload().

IDTX IDTXsort IDTX    idtx
 

Sort tag (instance,value) pairs.

Parameters:
idtx  id index
Returns:
id index

Definition at line 929 of file rpminstall.c.

References IDTindex_s::idt, IDTintcmp(), IDTindex_s::nidt, and IDTindex_s::size.

Referenced by IDTXglob(), and IDTXload().

void printHash const unsigned long    amount,
const unsigned long    total
[static]
 

Print a CLI progress bar.

Todo:
Unsnarl isatty(STDOUT_FILENO) from the control flow.
Parameters:
amount  current
total  final

Definition at line 40 of file rpminstall.c.

References rpmcliHashesCurrent, rpmcliHashesTotal, rpmcliProgressCurrent, and rpmcliProgressTotal.

Referenced by rpmShowProgress().

int rpmErase rpmts    ts,
struct rpmInstallArguments_s   ia,
const char **    argv
 

Erase binary rpm package.

Parameters:
ts  transaction set
ia  control args/bits
argv  array of package file names (NULL terminated)
Returns:
0 on success

Definition at line 733 of file rpminstall.c.

References _, _RPMVSF_NODIGESTS, _RPMVSF_NOSIGNATURES, argv, rpmInstallArguments_s::eraseInterfaceFlags, INSTALL_LABEL, rpmInstallArguments_s::qva_flags, rpmdbFreeIterator(), rpmdbGetIteratorOffset(), RPMDBI_LABEL, rpmdbNextIterator(), rpmExpandNumeric(), rpmIsVerbose, RPMMESS_ERROR, rpmMessage, rpmpsFree(), rpmpsNumProblems(), rpmpsPrint(), rpmShowProgress(), RPMTRANS_FLAG_REPACKAGE, RPMTRANS_FLAG_REVERSE, rpmts, rpmtsAddEraseElement(), rpmtsCheck(), rpmtsClean(), rpmtsEmpty(), rpmtsFlags(), rpmtsInitIterator(), rpmtsProblems(), rpmtsRun(), rpmtsSetFlags(), rpmtsSetNotifyCallback(), rpmtsSetVSFlags(), RPMVSF_NOHDRCHK, rpmVSFlags, rpmInstallArguments_s::transFlags, UNINSTALL_ALLMATCHES, UNINSTALL_NODEPS, VERIFY_DIGEST, VERIFY_HDRCHK, and VERIFY_SIGNATURE.

Referenced by main().

int rpmInstall rpmts    ts,
struct rpmInstallArguments_s   ia,
const char **    fileArgv
 

Todo:
Generalize --freshen policies.

Definition at line 285 of file rpminstall.c.

References _, _free(), _RPMVSF_NODIGESTS, _RPMVSF_NOSIGNATURES, alloca(), rpmEIU::argc, rpmEIU::argv, Fclose(), rpmEIU::fd, Ferror(), rpmEIU::fnp, fnpyKey, Fopen(), ftpStrerror(), rpmEIU::h, headerFree(), headerFreeData(), headerGetEntry(), headerIsEntry(), headerNVR(), INSTALL_FRESHEN, INSTALL_LABEL, INSTALL_NODEPS, INSTALL_NOORDER, INSTALL_UPGRADE, rpmInstallArguments_s::installInterfaceFlags, rpmEIU::isSource, rpmRelocation_s::newPath, rpmEIU::numFailed, rpmEIU::numPkgs, rpmEIU::numRPMS, rpmEIU::numSRPMS, rpmRelocation_s::oldPath, rpmEIU::pkgState, rpmEIU::pkgURL, rpmEIU::pkgx, rpmEIU::prevx, rpmInstallArguments_s::probFilter, rpmInstallArguments_s::qva_flags, rpmEIU::relocations, rpmInstallArguments_s::relocations, rpmcliPackagesTotal, rpmdbFreeIterator(), rpmdbGetIteratorCount(), rpmdbNextIterator(), rpmds, rpmdsFree(), rpmdsSingle(), RPMERR_MANIFEST, RPMERR_OPEN, rpmError, rpmExpandNumeric(), rpmGenPath(), rpmGlob(), rpmInstallSourcePackage(), rpmIsVerbose, RPMMESS_DEBUG, RPMMESS_ERROR, RPMMESS_NORMAL, rpmMessage, rpmprobFilterFlags, rpmpsFree(), rpmpsNumProblems(), rpmpsPrint(), rpmEIU::rpmrc, RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTFOUND, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), rpmReadPackageManifest(), rpmShowProgress(), RPMTAG_NAME, RPMTAG_PREFIXES, RPMTAG_REQUIRENAME, RPMTAG_SOURCEPACKAGE, RPMTRANS_FLAG_REPACKAGE, RPMTRANS_FLAG_TEST, rpmts, rpmtsAddInstallElement(), rpmtsCheck(), rpmtsClean(), rpmtsEmpty(), rpmtsFlags(), rpmtsInitIterator(), rpmtsOrder(), rpmtsProblems(), rpmtsRootDir(), rpmtsRun(), rpmtsSetFlags(), rpmtsSetNotifyCallback(), rpmtsSetVSFlags(), rpmtsSolve(), rpmVersionCompare(), RPMVSF_NEEDPAYLOAD, RPMVSF_NOHDRCHK, rpmVSFlags, rpmEIU::sourceURL, rpmInstallArguments_s::transFlags, Unlink(), URL_IS_FTP, URL_IS_HTTP, URL_IS_PATH, urlGetFile(), urlIsURL(), urlPath(), VERIFY_DIGEST, VERIFY_HDRCHK, VERIFY_SIGNATURE, xrealloc(), and xstrdup().

Referenced by main().

int rpmInstallSource rpmts    ts,
const char *    arg,
const char **    specFilePtr,
const char **    cookie
 

Install source rpm package.

Parameters:
ts  transaction set
arg  source rpm file name
Return values:
specFilePtr  (installed) spec file name
cookie 
Returns:
0 on success

Definition at line 836 of file rpminstall.c.

References RPMMESS_ERROR, rpmRC, RPMRC_OK, rpmts, RPMVSF_NEEDPAYLOAD, and rpmVSFlags.

Referenced by main().

int rpmRollback rpmts    ts,
struct rpmInstallArguments_s   ia,
const char **    argv
 

Todo:
Transaction handling, more, needs work.

Definition at line 1059 of file rpminstall.c.

References _, _free(), _RPMVSF_NODIGESTS, _RPMVSF_NOSIGNATURES, argv, fnpyKey, IDT_s::h, headerFree(), IDTindex_s::idt, IDTXfree(), IDTXglob(), IDTXload(), INSTALL_ERASE, INSTALL_FRESHEN, INSTALL_INSTALL, INSTALL_LABEL, INSTALL_UPGRADE, rpmInstallArguments_s::installInterfaceFlags, IDT_s::instance, IDT_s::key, IDTindex_s::nidt, rpmInstallArguments_s::probFilter, rpmInstallArguments_s::qva_flags, rpmInstallArguments_s::rbtid, rpmInstallArguments_s::relocations, rpmcliPackagesTotal, rpmExpand(), rpmExpandNumeric(), rpmIsDebug, rpmIsVerbose, RPMMESS_DEBUG, RPMMESS_ERROR, RPMMESS_NORMAL, rpmMessage, RPMPROB_FILTER_OLDPACKAGE, rpmpsFree(), rpmpsNumProblems(), rpmpsPrint(), rpmShowProgress(), RPMTAG_INSTALLTID, RPMTAG_REMOVETID, RPMTRANS_FLAG_REVERSE, rpmtransFlags, rpmts, rpmtsAddEraseElement(), rpmtsAddInstallElement(), rpmtsCheck(), rpmtsClean(), rpmtsEmpty(), rpmtsOrder(), rpmtsProblems(), rpmtsRun(), rpmtsSetFlags(), rpmtsSetNotifyCallback(), rpmtsSetVSFlags(), RPMVSF_NEEDPAYLOAD, RPMVSF_NOHDRCHK, rpmInstallArguments_s::transFlags, IDT_s::val, VERIFY_DIGEST, VERIFY_HDRCHK, and VERIFY_SIGNATURE.

Referenced by main(), and rpmts_Rollback().

void* rpmShowProgress const void *    arg,
const rpmCallbackType    what,
const unsigned long    amount,
const unsigned long    total,
fnpyKey    key,
void *    data
 

The rpm CLI generic transaction callback handler.

Todo:
Remove headerSprintf() from the progress callback.
Deprecated:
Transaction callback arguments need to change, so don't rely on this routine in the rpmcli API.
Parameters:
arg  per-callback private data (e.g. an rpm header)
what  callback identifier
amount  per-callback progress info
total  per-callback progress info
key  opaque header key (e.g. file name or PyObject)
data  private data (e.g. rpmInstallInterfaceFlags)
Returns:
per-callback data (e.g. an opened FD_t)

Definition at line 91 of file rpminstall.c.

References _, _free(), Fclose(), fdFree, fdLink, Ferror(), fnpyKey, Fopen(), Fstrerror(), headerSprintf(), INSTALL_HASH, INSTALL_LABEL, INSTALL_PERCENT, printHash(), RPMCALLBACK_CPIO_ERROR, RPMCALLBACK_INST_CLOSE_FILE, RPMCALLBACK_INST_OPEN_FILE, RPMCALLBACK_INST_PROGRESS, RPMCALLBACK_INST_START, RPMCALLBACK_REPACKAGE_PROGRESS, RPMCALLBACK_REPACKAGE_START, RPMCALLBACK_REPACKAGE_STOP, RPMCALLBACK_TRANS_PROGRESS, RPMCALLBACK_TRANS_START, RPMCALLBACK_TRANS_STOP, RPMCALLBACK_UNINST_PROGRESS, RPMCALLBACK_UNINST_START, RPMCALLBACK_UNINST_STOP, RPMCALLBACK_UNKNOWN, RPMCALLBACK_UNPACK_ERROR, rpmCallbackType, rpmcliHashesCurrent, rpmcliPackagesTotal, rpmcliProgressCurrent, rpmcliProgressTotal, RPMERR_OPEN, and rpmError.

Referenced by rpmErase(), rpmInstall(), and rpmRollback().


Variable Documentation

IDTX IDTXnew(void)
 

Definition at line 904 of file rpminstall.c.

Referenced by IDTXgrow().

int reverse = -1 [static]
 

Definition at line 876 of file rpminstall.c.

Referenced by IDTintcmp().

int rpmcliHashesCurrent = 0
 

Definition at line 26 of file rpminstall.c.

Referenced by printHash(), and rpmShowProgress().

int rpmcliHashesTotal = 0
 

Definition at line 28 of file rpminstall.c.

Referenced by printHash().

int rpmcliPackagesTotal = 0
 

Definition at line 24 of file rpminstall.c.

Referenced by rpmInstall(), rpmRollback(), and rpmShowProgress().

int rpmcliProgressCurrent = 0
 

Definition at line 30 of file rpminstall.c.

Referenced by printHash(), and rpmShowProgress().

int rpmcliProgressTotal = 0
 

Definition at line 32 of file rpminstall.c.

Referenced by printHash(), and rpmShowProgress().


Generated on Sun Oct 26 13:02:05 2003 for rpm by doxygen1.2.18