Eliminate archiveSize member from rpmfi

- rpmfi itself doesn't need it for anything, its only really used
  for progress reporting during install. Grab the size into psm
  total directly, this is already passed down to fsm.
- Removes one of the last remaining rpmfi opacity violations, just
  fi->apath to go...
This commit is contained in:
Panu Matilainen 2012-01-11 12:17:31 +02:00
parent ef9b08a5d8
commit 1dc09307d8
3 changed files with 6 additions and 12 deletions

View File

@ -749,10 +749,14 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
} }
if (psm->goal == PKG_INSTALL) { if (psm->goal == PKG_INSTALL) {
Header h = rpmteHeader(psm->te);
psm->scriptArg = psm->npkgs_installed + 1; psm->scriptArg = psm->npkgs_installed + 1;
psm->amount = 0; psm->amount = 0;
psm->total = fi->archiveSize ? fi->archiveSize : 100; psm->total = headerGetNumber(h, RPMTAG_LONGARCHIVESIZE);
/* fake up something for packages with no files */
if (psm->total == 0)
psm->total = 100;
/* HACK: reinstall abuses te instance to remove old header */ /* HACK: reinstall abuses te instance to remove old header */
if (rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEPKG) if (rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEPKG)
@ -761,15 +765,14 @@ static rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
if (rpmfiFC(fi) > 0) { if (rpmfiFC(fi) > 0) {
struct rpmtd_s filenames; struct rpmtd_s filenames;
rpmTag ftag = RPMTAG_FILENAMES; rpmTag ftag = RPMTAG_FILENAMES;
Header h = rpmteHeader(psm->te);
if (headerIsEntry(h, RPMTAG_ORIGBASENAMES)) { if (headerIsEntry(h, RPMTAG_ORIGBASENAMES)) {
ftag = RPMTAG_ORIGFILENAMES; ftag = RPMTAG_ORIGFILENAMES;
} }
headerGet(h, ftag, &filenames, HEADERGET_EXT); headerGet(h, ftag, &filenames, HEADERGET_EXT);
fi->apath = filenames.data; /* Ick.. */ fi->apath = filenames.data; /* Ick.. */
headerFree(h);
} }
headerFree(h);
} }
if (psm->goal == PKG_ERASE) { if (psm->goal == PKG_ERASE) {
psm->scriptArg = psm->npkgs_installed - 1; psm->scriptArg = psm->npkgs_installed - 1;

View File

@ -1125,7 +1125,6 @@ static scidx_t *cacheTag(strcache cache, Header h, rpmTag tag)
rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags) rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags)
{ {
rpmfi fi = NULL; rpmfi fi = NULL;
rpm_loff_t *asize = NULL;
unsigned char * t; unsigned char * t;
struct rpmtd_s fdigests, digalgo; struct rpmtd_s fdigests, digalgo;
struct rpmtd_s td; struct rpmtd_s td;
@ -1143,13 +1142,6 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags)
fi->fiflags = flags; fi->fiflags = flags;
fi->scareFlags = scareFlags; fi->scareFlags = scareFlags;
if (headerGet(h, RPMTAG_LONGARCHIVESIZE, &td, HEADERGET_EXT)) {
asize = rpmtdGetUint64(&td);
}
/* 0 means unknown */
fi->archiveSize = asize ? *asize : 0;
rpmtdFreeData(&td);
if (headerIsSource(h)) fi->fiflags |= RPMFI_ISSOURCE; if (headerIsSource(h)) fi->fiflags |= RPMFI_ISSOURCE;
_hgfi(h, RPMTAG_BASENAMES, &td, defFlags, fi->bnl); _hgfi(h, RPMTAG_BASENAMES, &td, defFlags, fi->bnl);

View File

@ -71,7 +71,6 @@ struct rpmfi_s {
char * fn; /*!< File name buffer. */ char * fn; /*!< File name buffer. */
rpm_loff_t archiveSize;
char ** apath; char ** apath;
FSM_t fsm; /*!< File state machine data. */ FSM_t fsm; /*!< File state machine data. */
rpm_off_t * replacedSizes; /*!< (TR_ADDED) */ rpm_off_t * replacedSizes; /*!< (TR_ADDED) */