408
408
// DepCache::AddSizes - Add the packages sizes to the counters /*{{{*/
409
409
// ---------------------------------------------------------------------
410
/* Call with Mult = -1 to preform the inverse opration */
411
void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult)
413
StateCache &P = PkgState[Pkg->ID];
415
if (Pkg->VersionList == 0)
418
if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
422
// Compute the size data
423
if (P.NewInstall() == true)
425
iUsrSize += (signed)(Mult*P.InstVerIter(*this)->InstalledSize);
426
iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size);
431
if (Pkg->CurrentVer != 0 &&
432
(P.InstallVer != (Version *)Pkg.CurrentVer() ||
433
(P.iFlags & ReInstall) == ReInstall) && P.InstallVer != 0)
435
iUsrSize += (signed)(Mult*((signed)P.InstVerIter(*this)->InstalledSize -
436
(signed)Pkg.CurrentVer()->InstalledSize));
437
iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size);
442
if (Pkg.State() == pkgCache::PkgIterator::NeedsUnpack &&
445
iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size);
450
if (Pkg->CurrentVer != 0 && P.InstallVer == 0)
452
iUsrSize -= (signed)(Mult*Pkg.CurrentVer()->InstalledSize);
410
/* Call with Mult = -1 to preform the inverse opration
411
The Mult increases the complexity of the calulations here and is unused -
412
or do we really have a usecase for removing the size of a package two
413
times? So let us replace it with a simple bool and be done with it… */
414
__deprecated void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult)
416
StateCache &P = PkgState[Pkg->ID];
418
if (Pkg->VersionList == 0)
421
if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
425
// Compute the size data
426
if (P.NewInstall() == true)
428
iUsrSize += (signed long long)(Mult*P.InstVerIter(*this)->InstalledSize);
429
iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size);
434
if (Pkg->CurrentVer != 0 &&
435
(P.InstallVer != (Version *)Pkg.CurrentVer() ||
436
(P.iFlags & ReInstall) == ReInstall) && P.InstallVer != 0)
438
iUsrSize += (signed long long)(Mult*((signed long long)P.InstVerIter(*this)->InstalledSize -
439
(signed long long)Pkg.CurrentVer()->InstalledSize));
440
iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size);
445
if (Pkg.State() == pkgCache::PkgIterator::NeedsUnpack &&
448
iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size);
453
if (Pkg->CurrentVer != 0 && P.InstallVer == 0)
455
iUsrSize -= (signed long long)(Mult*Pkg.CurrentVer()->InstalledSize);
460
// DepCache::AddSizes - Add the packages sizes to the counters /*{{{*/
461
// ---------------------------------------------------------------------
462
/* Call with Inverse = true to preform the inverse opration */
463
void pkgDepCache::AddSizes(const PkgIterator &Pkg, bool const &Inverse)
465
StateCache &P = PkgState[Pkg->ID];
467
if (Pkg->VersionList == 0)
470
if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
474
// Compute the size data
475
if (P.NewInstall() == true)
477
if (Inverse == false) {
478
iUsrSize += P.InstVerIter(*this)->InstalledSize;
479
iDownloadSize += P.InstVerIter(*this)->Size;
481
iUsrSize -= P.InstVerIter(*this)->InstalledSize;
482
iDownloadSize -= P.InstVerIter(*this)->Size;
488
if (Pkg->CurrentVer != 0 &&
489
(P.InstallVer != (Version *)Pkg.CurrentVer() ||
490
(P.iFlags & ReInstall) == ReInstall) && P.InstallVer != 0)
492
if (Inverse == false) {
493
iUsrSize -= Pkg.CurrentVer()->InstalledSize;
494
iUsrSize += P.InstVerIter(*this)->InstalledSize;
495
iDownloadSize += P.InstVerIter(*this)->Size;
497
iUsrSize -= P.InstVerIter(*this)->InstalledSize;
498
iUsrSize += Pkg.CurrentVer()->InstalledSize;
499
iDownloadSize -= P.InstVerIter(*this)->Size;
505
if (Pkg.State() == pkgCache::PkgIterator::NeedsUnpack &&
508
if (Inverse == false)
509
iDownloadSize += P.InstVerIter(*this)->Size;
511
iDownloadSize -= P.InstVerIter(*this)->Size;
516
if (Pkg->CurrentVer != 0 && P.InstallVer == 0)
518
if (Inverse == false)
519
iUsrSize -= Pkg.CurrentVer()->InstalledSize;
521
iUsrSize += Pkg.CurrentVer()->InstalledSize;