From 8fa042ca39dcb39d544f015f4a924c5dbc10ad2c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 30 Sep 2013 18:51:40 +0200 Subject: don't consider holds for autoremoval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can't remove packages which are held back by the user with a hold, so marking them (or its dependencies) as garbage will lead our autoremover into madness – and given that the package is important enough that the user has held it back it can't be garbage (at least at the moment), so even if a front-end wants to use the info just for information display its a good idea to not consider it garbage for them. Closes: 724995 --- apt-pkg/depcache.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 978a893f7..a06789cdf 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -896,6 +896,7 @@ char const* PrintMode(char const mode) case pkgDepCache::ModeInstall: return "Install"; case pkgDepCache::ModeKeep: return "Keep"; case pkgDepCache::ModeDelete: return "Delete"; + case pkgDepCache::ModeGarbage: return "Garbage"; default: return "UNKNOWN"; } } @@ -1726,8 +1727,6 @@ bool pkgDepCache::MarkRequired(InRootSetFunc &userFunc) follow_recommends = MarkFollowsRecommends(); follow_suggests = MarkFollowsSuggests(); - - // do the mark part, this is the core bit of the algorithm for(PkgIterator p = PkgBegin(); !p.end(); ++p) { @@ -1738,7 +1737,9 @@ bool pkgDepCache::MarkRequired(InRootSetFunc &userFunc) // be nice even then a required package violates the policy (#583517) // and do the full mark process also for required packages (p.CurrentVer().end() != true && - p.CurrentVer()->Priority == pkgCache::State::Required)) + p.CurrentVer()->Priority == pkgCache::State::Required) || + // packages which can't be changed (like holds) can't be garbage + (IsModeChangeOk(ModeGarbage, p, 0, false) == false)) { // the package is installed (and set to keep) if(PkgState[p->ID].Keep() && !p.CurrentVer().end()) -- cgit v1.2.3 From 2f5ed336109d11e06d08bedef6b37d6597c4c09c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 29 Nov 2013 17:10:35 +0100 Subject: fix crash when SetCandidateRelease is used --- apt-pkg/depcache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index a06789cdf..f9c891c86 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1522,7 +1522,7 @@ bool pkgDepCache::SetCandidateRelease(pkgCache::VerIterator TargetVer, if (itsFine == false) { // change the candidate - Changed.push_back(make_pair(oldCand, TargetVer)); + Changed.push_back(make_pair(V, TargetVer)); if (SetCandidateRelease(V, TargetRel, Changed) == false) { if (stillOr == false) -- cgit v1.2.3 From 0dfc7eef47519bd6b48ceaa4341b72ec40560988 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 4 Feb 2014 10:18:16 +0100 Subject: Fix multiarch package upgrade issue When checking for negative dependencies in MarkInstall() ensure that only dependencies that are relevant (i.e. getting installed) are checked. --- apt-pkg/depcache.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index f9c891c86..a3bb4fd3d 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1253,6 +1253,11 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, if (PkgState[Pkg->ID].InstallVer == 0) continue; + /* Ignore negative dependencies that we are not going to + get installed */ + if (PkgState[Pkg->ID].InstallVer != *I) + continue; + if ((Start->Version != 0 || TrgPkg != Pkg) && PkgState[Pkg->ID].CandidateVer != PkgState[Pkg->ID].InstallVer && PkgState[Pkg->ID].CandidateVer != *I && -- cgit v1.2.3 From 446551c8ffd2c9cb9dcd707c94590e73009f7dd9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 6 Feb 2014 00:13:10 +0100 Subject: discard impossible candidates in MarkInstall If a (Pre-)Depends can't be satisfied there is no point in keeping the candidate as is as it is impossible to find a solution for it, so we can just as well reset the candidate to the currently installed version. We avoid trying to install this impossible candidate later on this way. Closes: #735967 --- apt-pkg/depcache.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index f9c891c86..7e75a6fe3 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1134,8 +1134,13 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, std::clog << OutputInDepth(Depth) << Start << " can't be satisfied!" << std::endl; if (Start.IsCritical() == false) continue; - // if the dependency was critical, we can't install it, so remove it again - MarkDelete(Pkg,false,Depth + 1, false); + // if the dependency was critical, we have absolutely no chance to install it, + // so if it wasn't installed remove it again. If it was, discard the candidate + // as the problemresolver will trip over it otherwise trying to install it (#735967) + if (Pkg->CurrentVer == 0) + MarkDelete(Pkg,false,Depth + 1, false); + else + SetCandidateVersion(Pkg.CurrentVer()); return false; } -- cgit v1.2.3 From 1e3f4083db29bba600b9725e9456b0e140975c99 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 22 Feb 2014 18:34:33 +0100 Subject: Fix typos in documentation (codespell) --- apt-pkg/depcache.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index c39e8c628..a12e6963d 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -789,7 +789,7 @@ bool pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser, // - this makes sense as default when all Garbage dependencies // are automatically marked for removal (as aptitude does). // setting a package for keep then makes it no longer autoinstalled - // for all other use-case this action is rather suprising + // for all other use-case this action is rather surprising if(FromUser && !P.Marked) P.Flags &= ~Flag::Auto; #endif @@ -1195,7 +1195,7 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, } } - /* This bit is for processing the possibilty of an install/upgrade + /* This bit is for processing the possibility of an install/upgrade fixing the problem for "positive" dependencies */ if (Start.IsNegative() == false && (DepState[Start->ID] & DepCVer) == DepCVer) { @@ -1315,7 +1315,7 @@ bool pkgDepCache::IsInstallOkMultiArchSameVersionSynced(PkgIterator const &Pkg, // (simple string-compare as stuff like '1' == '0:1-0' can't happen here) if (P->CurrentVer == 0 || strcmp(Pkg.CandVersion(), P.CandVersion()) == 0) continue; - // packages loosing M-A:same can be out-of-sync + // packages losing M-A:same can be out-of-sync VerIterator CV = PkgState[P->ID].CandidateVerIter(*this); if (unlikely(CV.end() == true) || (CV->MultiArch & pkgCache::Version::Same) != pkgCache::Version::Same) -- cgit v1.2.3