From be7ce6f1d067fa62b01685e48094f3f73c95189f Mon Sep 17 00:00:00 2001
From: David Kalnischkies <david@kalnischkies.de>
Date: Tue, 11 Mar 2014 15:32:40 +0100
Subject: do IsInstallOk call in MarkInstall unconditionally

Hooked checks could be influenced by AutoInst as a lot can happen
between a call without and one with this bit set. The real cache-hit
check is above this call already. Individual hooked checks can then
inspect the state if they want to cache. Calling them multiple times
shouldn't be a problem either way.
---
 apt-pkg/depcache.cc | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'apt-pkg')

diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index e2c412757..5fa88a5d2 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1059,10 +1059,9 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
       return true;
    }
 
-   // check if we are allowed to install the package (if we haven't already)
-   if (P.Mode != ModeInstall || P.InstallVer != P.CandidateVer)
-      if (IsInstallOk(Pkg,AutoInst,Depth,FromUser) == false)
-	 return false;
+   // check if we are allowed to install the package
+   if (IsInstallOk(Pkg,AutoInst,Depth,FromUser) == false)
+      return false;
 
    ActionGroup group(*this);
    P.iFlags &= ~AutoKept;
@@ -1308,6 +1307,11 @@ bool pkgDepCache::IsInstallOkMultiArchSameVersionSynced(PkgIterator const &Pkg,
    if (FromUser == true) // as always: user is always right
       return true;
 
+   // if we have checked before and it was okay, it will still be okay
+   if (PkgState[Pkg->ID].Mode == ModeInstall &&
+	 PkgState[Pkg->ID].InstallVer == PkgState[Pkg->ID].CandidateVer)
+      return true;
+
    // ignore packages with none-M-A:same candidates
    VerIterator const CandVer = PkgState[Pkg->ID].CandidateVerIter(*this);
    if (unlikely(CandVer.end() == true) || CandVer == Pkg.CurrentVer() ||
-- 
cgit v1.2.3