From 0de399391372450d0162b5a09bfca554b2d27c3d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 26 Apr 2020 13:11:31 +0200 Subject: Discard candidate if its dependencies can't be satisfied We do pretty much the same in IsInstallOk, but here we have already set the state, so we have to unroll the state as well to sort-of replicate the state we were in before this MarkInstall failed. --- apt-pkg/depcache.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index cd5558461..425918b43 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1324,7 +1324,24 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, break; } while (Start++ != End); if (not foundSolution && End.IsCritical()) + { + StateCache &State = PkgState[Pkg->ID]; + if (not State.Protect()) + { + RemoveSizes(Pkg); + RemoveStates(Pkg); + if (Pkg->CurrentVer != 0) + State.InstallVer = State.CandidateVer = Pkg.CurrentVer(); + else + State.InstallVer = State.CandidateVer = nullptr; + State.Mode = ModeKeep; + State.Update(Pkg, *this); + AddStates(Pkg); + Update(Pkg); + AddSizes(Pkg); + } return false; + } } toInstall.clear(); -- cgit v1.2.3