X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/f1e8e9da00ccf91c924cd3edad0fc01d1b2dc820..dabe9e2482180ada77d2adda2b3c03db22059fb8:/apt-private/private-install.cc diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 63e7b734d..761e4d175 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -48,6 +48,10 @@ bool CheckNothingBroken(CacheFile &Cache) /*{{{*/ if (Cache->BrokenCount() == 0) return true; + // FIXME: if an external solver showed an error, we shouldn't show one here + if (_error->PendingError() && _config->Find("APT::Solver") == "dump") + return false; + c1out << _("Some packages could not be installed. This may mean that you have\n" "requested an impossible situation or if you are using the unstable\n" @@ -422,11 +426,11 @@ bool DoAutomaticRemove(CacheFile &Cache) { if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install()) if(Debug) - std::cout << "We could delete %s" << Pkg.FullName(true).c_str() << std::endl; + std::cout << "We could delete " << APT::PrettyPkg(Cache, Pkg) << std::endl; if (doAutoRemove) { - if(Pkg.CurrentVer() != 0 && + if(Pkg.CurrentVer() != 0 && Pkg->CurrentState != pkgCache::State::ConfigFiles) Cache->MarkDelete(Pkg, purgePkgs, 0, false); else @@ -471,11 +475,25 @@ bool DoAutomaticRemove(CacheFile &Cache) if (R.IsNegative() == true || Cache->IsImportantDep(R) == false) continue; - pkgCache::PkgIterator N = R.ParentPkg(); - if (N.end() == true || (N->CurrentVer == 0 && (*Cache)[N].Install() == false)) + auto const RV = R.ParentVer(); + if (unlikely(RV.end() == true)) + continue; + auto const RP = RV.ParentPkg(); + // check if that dependency comes from an interesting version + if (RP.CurrentVer() == RV) + { + if ((*Cache)[RP].Keep() == false) + continue; + } + else if (Cache[RP].CandidateVerIter(Cache) == RV) + { + if ((*Cache)[RP].NewInstall() == false && (*Cache)[RP].Upgrade() == false) + continue; + } + else // ignore dependency from a non-candidate version continue; if (Debug == true) - std::clog << "Save " << APT::PrettyPkg(Cache, Pkg) << " as another installed garbage package depends on it" << std::endl; + std::clog << "Save " << APT::PrettyPkg(Cache, Pkg) << " as another installed package depends on it: " << APT::PrettyPkg(Cache, RP) << std::endl; Cache->MarkInstall(Pkg, false, 0, false); if (hideAutoRemove == false) ++autoRemoveCount; @@ -491,6 +509,8 @@ bool DoAutomaticRemove(CacheFile &Cache) } } while (Changed == true); } + // trigger marking now so that the package list below is correct + group.release(); // Now see if we had destroyed anything (if we had done anything) if (Cache->BrokenCount() != 0) @@ -540,15 +560,15 @@ static const unsigned short MOD_INSTALL = 2; bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, int UpgradeMode) { - std::vector VolatileCmdL; + std::vector VolatileCmdL; return DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, UpgradeMode); } -bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector &VolatileCmdL, CacheFile &Cache, int UpgradeMode) +bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector &VolatileCmdL, CacheFile &Cache, int UpgradeMode) { std::map verset; return DoCacheManipulationFromCommandLine(CmdL, VolatileCmdL, Cache, verset, UpgradeMode); } -bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector &VolatileCmdL, CacheFile &Cache, +bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector &VolatileCmdL, CacheFile &Cache, std::map &verset, int UpgradeMode) { // Enter the special broken fixing mode if the user specified arguments @@ -694,7 +714,7 @@ struct PkgIsExtraInstalled { bool DoInstall(CommandLine &CmdL) { CacheFile Cache; - std::vector VolatileCmdL; + std::vector VolatileCmdL; Cache.GetSourceList()->AddVolatileFiles(CmdL, &VolatileCmdL); // then open the cache