From c97fd4ec4a34eb15eb8985890a47e768f4b94f0d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 13 Sep 2006 11:32:32 +0200 Subject: * cmdline/apt-get.cc: - only error out if both "APT::Get::Autoremove" is set to true and "APT::Get::Remove" to false, in this case the the save options wins and apt will abort --- cmdline/apt-get.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 5e1ccb0c0..411b16e90 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1398,7 +1398,8 @@ bool DoAutomaticRemove(CacheFile &Cache) if(Debug) std::cout << "DoAutomaticRemove()" << std::endl; - if (_config->FindB("APT::Get::Remove",true) == false) + if (_config->FindB("APT::Get::AutomaticRemove") && + _config->FindB("APT::Get::Remove",true) == false) return _error->Error(_("We are not supposed to delete stuff, can't " "start AutoRemover")); -- cgit v1.2.3 From 3d0de656b6263d51c288d82ef2b352e53023382c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 13 Sep 2006 11:52:19 +0200 Subject: * cmdline/apt-get.cc: - changed the behaviour of --no-remove and --auto-remove, if --no-remove is given, then that will turn off --auto-remove implicitely --- cmdline/apt-get.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 411b16e90..4af23641b 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1393,15 +1393,20 @@ bool DoUpdate(CommandLine &CmdL) bool DoAutomaticRemove(CacheFile &Cache) { bool Debug = _config->FindI("Debug::pkgAutoRemove",false); + bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove"); pkgDepCache::ActionGroup group(*Cache); + if(Debug) std::cout << "DoAutomaticRemove()" << std::endl; - if (_config->FindB("APT::Get::AutomaticRemove") && - _config->FindB("APT::Get::Remove",true) == false) - return _error->Error(_("We are not supposed to delete stuff, can't " - "start AutoRemover")); + if (_config->FindB("APT::Get::Remove",true) == false && + doAutoRemove == true) + { + c1out << _("We are not supposed to delete stuff, can't start " + "AutoRemover") << std::endl; + doAutoRemove = false; + } string autoremovelist, autoremoveversions; // look over the cache to see what can be removed @@ -1415,7 +1420,7 @@ bool DoAutomaticRemove(CacheFile &Cache) autoremovelist += string(Pkg.Name()) + " "; autoremoveversions += string(Cache[Pkg].CandVersion) + " "; - if (_config->FindB("APT::Get::AutomaticRemove")) + if (doAutoRemove) { if(Pkg.CurrentVer() != 0 && Pkg->CurrentState != pkgCache::State::ConfigFiles) @@ -1426,8 +1431,7 @@ bool DoAutomaticRemove(CacheFile &Cache) } } ShowList(c1out, _("The following packages where automatically installed and are no longer required:"), autoremovelist, autoremoveversions); - if (!_config->FindB("APT::Get::AutomaticRemove") && - autoremovelist.size() > 0) + if (!doAutoRemove && autoremovelist.size() > 0) c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl; // Now see if we destroyed anything -- cgit v1.2.3 From ae24ac67f6bbab1474a5386b946fc7bd97ad86c8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 13 Sep 2006 11:53:26 +0200 Subject: * cmdline/apt-get.cc: - typo --- cmdline/apt-get.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 4af23641b..570e1016c 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1430,7 +1430,7 @@ bool DoAutomaticRemove(CacheFile &Cache) } } } - ShowList(c1out, _("The following packages where automatically installed and are no longer required:"), autoremovelist, autoremoveversions); + ShowList(c1out, _("The following packages were automatically installed and are no longer required:"), autoremovelist, autoremoveversions); if (!doAutoRemove && autoremovelist.size() > 0) c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl; -- cgit v1.2.3