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. More...
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, const 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)
IDTX | IDTXnew (void)
IDTX | IDTXgrow (IDTX idtx, int need)
IDTX | IDTXsort (IDTX idtx)
IDTX | IDTXload (rpmts ts, rpmTag tag)
IDTX | IDTXglob (rpmts ts, const char *globstr, rpmTag tag)
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

## 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 251 of file rpminstall.c.

## Function Documentation

int IDTintcmp | ( | const void * | a,
|  | const void * | b
| ) | `[static]`

| Definition at line 871 of file rpminstall.c. References reverse. Referenced by IDTXsort.

IDTX IDTXfree | ( | IDTX | idtx | ) |

| Definition at line 879 of file rpminstall.c. References _free, and headerFree. Referenced by rpmRollback, rpmts_IDTXglob, and rpmts_IDTXload.

IDTX IDTXglob | ( | rpmts | ts,
|  | const char * | globstr,
|  | rpmTag | tag
| ) |

| Definition at line 971 of file rpminstall.c. References _, _free, Fclose, Ferror, Fopen, Fstrerror, headerFree, headerIsEntry, headerLink, HGE_t, IDTXgrow, int_32, rpmGlob, rpmRC, RPMRC_NOKEY, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile, rpmTag, RPMTAG_SOURCEPACKAGE, rpmTagType, and rpmts. Referenced by rpmRollback, and rpmts_IDTXglob.

IDTX IDTXgrow | ( | IDTX | idtx,
|  | int | need
| ) |

| Definition at line 903 of file rpminstall.c. References IDTXnew, and xrealloc. Referenced by IDTXglob, and IDTXload.

IDTX IDTXload | ( | rpmts | ts,
|  | rpmTag | tag
| ) |

| Definition at line 927 of file rpminstall.c. References headerLink, HGE_t, IDTXgrow, IDTXsort, int_32, RPM_INT32_TYPE, RPM_NULL_TYPE, rpmdbFreeIterator, rpmdbGetIteratorOffset, rpmdbNextIterator, rpmTag, rpmTagType, rpmts, and rpmtsInitIterator. Referenced by rpmRollback, and rpmts_IDTXload.

IDTX IDTXnew | ( | void |  | ) |

| Definition at line 895 of file rpminstall.c. References xcalloc. Referenced by IDTXgrow.

IDTX IDTXsort | ( | IDTX | idtx | ) |

| Definition at line 920 of file rpminstall.c. References IDTintcmp. Referenced by 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 44 of file rpminstall.c.

References rpmcliHashesCurrent, rpmcliHashesTotal, rpmcliProgressCurrent, and rpmcliProgressTotal.

Referenced by rpmShowProgress.

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

Definition at line 726 of file rpminstall.c.

References _, _RPMVSF_NODIGESTS, _RPMVSF_NOSIGNATURES, rpmdbFreeIterator, rpmdbGetIteratorCount, rpmdbGetIteratorOffset, RPMDBI_LABEL, rpmdbNextIterator, rpmExpandNumeric, rpmpsFree, rpmpsNumProblems, rpmpsPrint, rpmShowProgress, RPMTRANS_FLAG_REPACKAGE, RPMTRANS_FLAG_REVERSE, rpmts, rpmtsAddEraseElement, rpmtsCheck, rpmtsClean, rpmtsEmpty, rpmtsFlags, rpmtsInitIterator, rpmtsProblems, rpmtsRun, rpmtsSetFlags, rpmtsSetNotifyCallback, rpmtsSetVSFlags, RPMVSF_NOHDRCHK, and rpmVSFlags.

Referenced by main.

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

Todo:
  Generalize --freshen policies.

Definition at line 281 of file rpminstall.c.

References _, _free, _RPMVSF_NODIGESTS, _RPMVSF_NOSIGNATURES, alloca, rpmEIU::argc, rpmEIU::argv, Fclose, rpmEIU::fd, Ferror, rpmEIU::fnp, Fopen, Fstrerror, ftpStrerror, rpmEIU::h, headerFree, headerFreeData, headerGetEntry, headerIsEntry, headerNVR, rpmEIU::isSource, rpmRelocation_s::newPath, rpmEIU::numFailed, rpmEIU::numPkgs, rpmEIU::numRPMS, rpmEIU::numSRPMS, rpmRelocation_s::oldPath, rpmEIU::pkgState, rpmEIU::pkgURL, rpmEIU::pkgx, rpmEIU::prevx, rpmEIU::relocations, rpmcliPackagesTotal, rpmdbFreeIterator, rpmdbGetIteratorCount, rpmdbNextIterator, rpmds, rpmdsFree, rpmdsSingle, rpmExpandNumeric, rpmGenPath, rpmGlob, rpmInstallSourcePackage, 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, Unlink, URL_IS_FTP, URL_IS_HTTP, URL_IS_PATH, urlGetFile, urlIsURL, urlPath, xrealloc, and xstrdup.

Referenced by main.

int rpmInstallSource | ( | rpmts | ts,
|  | const char * | arg,
|  | const char ** | specFilePtr,
|  | const char ** | cookie
| ) |

| Definition at line 827 of file rpminstall.c. References _, _free, Fclose, Ferror, Fopen, Fstrerror, rpmInstallSourcePackage, rpmRC, RPMRC_OK, rpmts, rpmtsSetVSFlags, rpmtsVSFlags, 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 1047 of file rpminstall.c.

References _, _free, _RPMVSF_NODIGESTS, _RPMVSF_NOSIGNATURES, headerFree, IDTXfree, IDTXglob, IDTXload, rpmcliPackagesTotal, rpmExpand, rpmExpandNumeric, 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, and RPMVSF_NOHDRCHK.

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
| ) |

| Definition at line 91 of file rpminstall.c. References _, _free, Fclose, fdFree, fdLink, Ferror, Fopen, Fstrerror, headerSprintf, printHash, rpmcliHashesCurrent, rpmcliPackagesTotal, rpmcliProgressCurrent, and rpmcliProgressTotal. Referenced by rpmErase, rpmInstall, and rpmRollback.

## Variable Documentation

int reverse = -1`[static]`

| Definition at line 867 of file rpminstall.c. Referenced by IDTintcmp.

int rpmcliHashesCurrent = 0

| Definition at line 30 of file rpminstall.c. Referenced by printHash, and rpmShowProgress.

int rpmcliHashesTotal = 0

| Definition at line 32 of file rpminstall.c. Referenced by printHash.

int rpmcliPackagesTotal = 0

| Definition at line 28 of file rpminstall.c. Referenced by rpmInstall, rpmRollback, rpmShowProgress, and rpmtsAddInstallElement.

int rpmcliProgressCurrent = 0

| Definition at line 34 of file rpminstall.c. Referenced by printHash, and rpmShowProgress.

int rpmcliProgressTotal = 0

| Definition at line 36 of file rpminstall.c. Referenced by printHash, and rpmShowProgress.