// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: depcache.cc,v 1.5 1998/11/13 23:20:06 jgg Exp $
+// $Id: depcache.cc,v 1.15 1999/03/26 07:38:43 jgg Exp $
/* ######################################################################
Dependency Cache - Caches Dependency information.
{
if (_error->PendingError() == false)
Init(&Prog);
+}
+pkgDepCache::pkgDepCache(MMap &Map) :
+ pkgCache(Map), PkgState(0), DepState(0)
+{
+ if (_error->PendingError() == false)
+ Init(0);
}
/*}}}*/
// DepCache::~pkgDepCache - Destructor /*{{{*/
if (Prog != 0)
{
Prog->OverallProgress(0,2*Head().PackageCount,Head().PackageCount,
- "Building Dependancy Tree");
+ "Building Dependency Tree");
Prog->SubProgress(Head().PackageCount,"Candidate Versions");
}
Prog->OverallProgress(Head().PackageCount,2*Head().PackageCount,
Head().PackageCount,
- "Building Dependancy Tree");
+ "Building Dependency Tree");
Prog->SubProgress(Head().PackageCount,"Dependency Generation");
}
// Try to use an explicit target
if (Pkg->TargetVer == 0)
{
- /* Not source versions cannot be a candidate version unless they
- are already installed */
+ /* Not source/not automatic versions cannot be a candidate version
+ unless they are already installed */
for (VerIterator I = Pkg.VersionList(); I.end() == false; I++)
{
if (Pkg.CurrentVer() == I)
return I;
for (VerFileIterator J = I.FileList(); J.end() == false; J++)
- if ((J.File()->Flags & Flag::NotSource) == 0)
+ if ((J.File()->Flags & Flag::NotSource) == 0 &&
+ (J.File()->Flags & Flag::NotAutomatic) == 0)
return I;
}
{
StateCache &P = PkgState[Pkg->ID];
+ if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure &&
+ P.Keep() == true)
+ {
+ iUsrSize += Mult*P.InstVerIter(*this)->InstalledSize;
+ return;
+ }
+
// Compute the size data
if (P.NewInstall() == true)
{
iUsrSize += Mult*P.InstVerIter(*this)->InstalledSize;
iDownloadSize += Mult*P.InstVerIter(*this)->Size;
+ return;
}
// Upgrading
iUsrSize += Mult*((signed)P.InstVerIter(*this)->InstalledSize -
(signed)Pkg.CurrentVer()->InstalledSize);
iDownloadSize += Mult*P.InstVerIter(*this)->Size;
+ return;
+ }
+
+ // Reinstall
+ if (Pkg.State() == pkgCache::PkgIterator::NeedsUnpack &&
+ P.Delete() == false)
+ {
+ iDownloadSize += Mult*P.InstVerIter(*this)->Size;
+ return;
}
// Removing
if (Pkg->CurrentVer != 0 && P.InstallVer == 0)
+ {
iUsrSize -= Mult*Pkg.CurrentVer()->InstalledSize;
+ return;
+ }
}
/*}}}*/
// DepCache::AddStates - Add the package to the state counter /*{{{*/
State = ~State;
// Add to the group if we are within an or..
+ State &= 0x7;
Group |= State;
State |= Group << 3;
if ((D->CompareOp & Dep::Or) != Dep::Or)
RemoveSizes(Pkg);
RemoveStates(Pkg);
- P.Mode = ModeDelete;
+ if (Pkg->CurrentVer == 0)
+ P.Mode = ModeKeep;
+ else
+ P.Mode = ModeDelete;
P.InstallVer = 0;
P.Flags &= Flag::Auto;