summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc4
-rw-r--r--apt-pkg/depcache.cc32
-rw-r--r--apt-pkg/depcache.h5
-rw-r--r--apt-pkg/packagemanager.cc7
4 files changed, 37 insertions, 11 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 596473a65..e784ce895 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: algorithms.cc,v 1.26 1999/10/22 04:05:47 jgg Exp $
+// $Id: algorithms.cc,v 1.27 1999/10/22 05:58:54 jgg Exp $
/* ######################################################################
Algorithms - A set of misc algorithms
@@ -574,7 +574,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
/* We let the algorithm deal with conflicts on its next iteration,
it is much smarter than us */
if (Start->Type == pkgCache::Dep::Conflicts)
- continue;
+ break;
if (Debug == true)
clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl;
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 7b7d0b29d..707cb93cd 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: depcache.cc,v 1.20 1999/09/09 06:08:45 jgg Exp $
+// $Id: depcache.cc,v 1.21 1999/10/22 05:58:54 jgg Exp $
/* ######################################################################
Dependency Cache - Caches Dependency information.
@@ -216,8 +216,9 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg,long Mult)
}
// Upgrading
- if (Pkg->CurrentVer != 0 && P.InstallVer != (Version *)Pkg.CurrentVer() &&
- P.InstallVer != 0)
+ if (Pkg->CurrentVer != 0 &&
+ (P.InstallVer != (Version *)Pkg.CurrentVer() ||
+ (P.iFlags & ReInstall) == ReInstall) && P.InstallVer != 0)
{
iUsrSize += Mult*((signed)P.InstVerIter(*this)->InstalledSize -
(signed)Pkg.CurrentVer()->InstalledSize);
@@ -275,9 +276,13 @@ void pkgDepCache::AddStates(const PkgIterator &Pkg,int Add)
// Installed, no upgrade
if (State.Upgradable() == false)
- {
+ {
if (State.Mode == ModeDelete)
iDelCount += Add;
+ else
+ if ((State.iFlags & ReInstall) == ReInstall)
+ iInstCount += Add;
+
return;
}
@@ -703,7 +708,24 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst)
}
}
/*}}}*/
-
+// DepCache::SetReInstall - Set the reinstallation flag /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgDepCache::SetReInstall(PkgIterator const &Pkg,bool To)
+{
+ RemoveSizes(Pkg);
+ RemoveStates(Pkg);
+
+ StateCache &P = PkgState[Pkg->ID];
+ if (To == true)
+ P.iFlags |= ReInstall;
+ else
+ P.iFlags &= ~ReInstall;
+
+ AddStates(Pkg);
+ AddSizes(Pkg);
+}
+ /*}}}*/
// StateCache::Update - Compute the various static display things /*{{{*/
// ---------------------------------------------------------------------
/* This is called whenever the Candidate version changes. */
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 9592e7035..6ce204e65 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: depcache.h,v 1.11 1999/07/10 04:58:42 jgg Exp $
+// $Id: depcache.h,v 1.12 1999/10/22 05:58:54 jgg Exp $
/* ######################################################################
DepCache - Dependency Extension data for the cache
@@ -60,7 +60,7 @@ class pkgDepCache : public pkgCache
DepCandPolicy = (1 << 4), DepCandMin = (1 << 5)};
// These flags are used in StateCache::iFlags
- enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1)};
+ enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1), ReInstall = (1 << 2)};
enum VersionTypes {NowVersion, InstallVersion, CandidateVersion};
enum ModeList {ModeDelete = 0, ModeKeep = 1, ModeInstall = 2};
@@ -164,6 +164,7 @@ class pkgDepCache : public pkgCache
void MarkKeep(PkgIterator const &Pkg,bool Soft = false);
void MarkDelete(PkgIterator const &Pkg,bool Purge = false);
void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true);
+ void SetReInstall(PkgIterator const &Pkg,bool To);
// This is for debuging
void Update(OpProgress *Prog = 0);
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index b76f78b3c..fad40c46a 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: packagemanager.cc,v 1.21 1999/09/30 06:30:34 jgg Exp $
+// $Id: packagemanager.cc,v 1.22 1999/10/22 05:58:54 jgg Exp $
/* ######################################################################
Package Manager - Abstacts the package manager
@@ -157,6 +157,7 @@ bool pkgPackageManager::CreateOrderList()
if ((Cache[I].Keep() == true ||
Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
I.State() == pkgCache::PkgIterator::NeedsNothing &&
+ (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
(I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete ||
(Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
continue;
@@ -556,7 +557,9 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
}
// Sanity check
- if (Cache[Pkg].Keep() == true && Pkg.State() == pkgCache::PkgIterator::NeedsNothing)
+ if (Cache[Pkg].Keep() == true &&
+ Pkg.State() == pkgCache::PkgIterator::NeedsNothing &&
+ (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)
{
_error->Error("Internal Error, trying to manipulate a kept package");
return Failed;