From 9d2938d4e6e86c6afdb9606f76f4ae9ce0ac4ee5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 6 Sep 2006 19:12:34 +0200 Subject: * cmdline/apt-get.cc: - always show the autoremove information and give advice how to use it * debian/rules: - install apt.conf.autoremove with blacklist for linux-image and linux-restriceted-modules --- cmdline/apt-get.cc | 45 +++++++++++-------- configure.in | 2 +- debian/apt.conf.autoremove | 8 ++++ debian/apt.dirs | 1 + debian/rules | 2 +- po/apt-all.pot | 108 ++++++++++++++++++++++++--------------------- 6 files changed, 95 insertions(+), 71 deletions(-) create mode 100644 debian/apt.conf.autoremove diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 9e7071988..5e1ccb0c0 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1392,31 +1392,42 @@ bool DoUpdate(CommandLine &CmdL) /* Remove unused automatic packages */ bool DoAutomaticRemove(CacheFile &Cache) { - if(_config->FindI("Debug::pkgAutoRemove",false)) + bool Debug = _config->FindI("Debug::pkgAutoRemove",false); + pkgDepCache::ActionGroup group(*Cache); + + if(Debug) std::cout << "DoAutomaticRemove()" << std::endl; if (_config->FindB("APT::Get::Remove",true) == false) return _error->Error(_("We are not supposed to delete stuff, can't " "start AutoRemover")); + string autoremovelist, autoremoveversions; + // look over the cache to see what can be removed + for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg) { - pkgDepCache::ActionGroup group(*Cache); - - // look over the cache to see what can be removed - for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg) - { - if (Cache[Pkg].Garbage) - { - if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install()) - fprintf(stdout,"We could delete %s\n", Pkg.Name()); - - if(Pkg.CurrentVer() != 0 && Pkg->CurrentState != pkgCache::State::ConfigFiles) + if (Cache[Pkg].Garbage) + { + if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install()) + if(Debug) + std::cout << "We could delete %s" << Pkg.Name() << std::endl; + + autoremovelist += string(Pkg.Name()) + " "; + autoremoveversions += string(Cache[Pkg].CandVersion) + " "; + if (_config->FindB("APT::Get::AutomaticRemove")) + { + if(Pkg.CurrentVer() != 0 && + Pkg->CurrentState != pkgCache::State::ConfigFiles) Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false)); - else + else Cache->MarkKeep(Pkg, false, false); - } - } + } + } } + ShowList(c1out, _("The following packages where automatically installed and are no longer required:"), autoremovelist, autoremoveversions); + if (!_config->FindB("APT::Get::AutomaticRemove") && + autoremovelist.size() > 0) + c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl; // Now see if we destroyed anything if (Cache->BrokenCount() != 0) @@ -1632,10 +1643,8 @@ bool DoInstall(CommandLine &CmdL) return _error->Error(_("Broken packages")); } } - if (_config->FindB("APT::Get::AutomaticRemove")) { - if (!DoAutomaticRemove(Cache)) + if (!DoAutomaticRemove(Cache)) return false; - } /* Print out a list of packages that are going to be installed extra to what the user asked */ diff --git a/configure.in b/configure.in index fc4eff203..f0b0d6703 100644 --- a/configure.in +++ b/configure.in @@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib) AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in) dnl -- SET THIS TO THE RELEASE VERSION -- -AC_DEFINE_UNQUOTED(VERSION,"0.6.45") +AC_DEFINE_UNQUOTED(VERSION,"0.6.45.1") PACKAGE="apt" AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE") AC_SUBST(PACKAGE) diff --git a/debian/apt.conf.autoremove b/debian/apt.conf.autoremove new file mode 100644 index 000000000..98143ce9a --- /dev/null +++ b/debian/apt.conf.autoremove @@ -0,0 +1,8 @@ +APT +{ + NeverAutoRemove + { + "^linux-image.*"; + "^linux-restricted-modules.*"; + }; +}; diff --git a/debian/apt.dirs b/debian/apt.dirs index e1cb738fa..1543e8bb1 100644 --- a/debian/apt.dirs +++ b/debian/apt.dirs @@ -2,6 +2,7 @@ usr/bin usr/lib/apt/methods usr/lib/dpkg/methods/apt etc/apt +etc/apt/apt.conf.d etc/apt/sources.list.d var/cache/apt/archives/partial var/lib/apt/lists/partial diff --git a/debian/rules b/debian/rules index 044f742d0..6a142e759 100755 --- a/debian/rules +++ b/debian/rules @@ -211,7 +211,7 @@ apt: build debian/shlibs.local cp debian/bugscript debian/$@/usr/share/bug/apt/script cp share/debian-archive.gpg debian/$@/usr/share/$@ - + cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove # head -n 500 ChangeLog > debian/ChangeLog dh_installexamples -p$@ $(BLD)/docs/examples/* diff --git a/po/apt-all.pot b/po/apt-all.pot index 2dd720674..0a7a30629 100644 --- a/po/apt-all.pot +++ b/po/apt-all.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-09-06 18:03+0200\n" +"POT-Creation-Date: 2006-09-06 18:58+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -148,7 +148,7 @@ msgstr "" #: cmdline/apt-cache.cc:1652 cmdline/apt-cdrom.cc:138 cmdline/apt-config.cc:70 #: cmdline/apt-extracttemplates.cc:225 ftparchive/apt-ftparchive.cc:550 -#: cmdline/apt-get.cc:2449 cmdline/apt-sortpkgs.cc:144 +#: cmdline/apt-get.cc:2455 cmdline/apt-sortpkgs.cc:144 #, c-format msgid "%s %s for %s %s compiled on %s %s\n" msgstr "" @@ -546,7 +546,7 @@ msgstr "" msgid "Y" msgstr "" -#: cmdline/apt-get.cc:143 cmdline/apt-get.cc:1561 +#: cmdline/apt-get.cc:143 cmdline/apt-get.cc:1569 #, c-format msgid "Regex compilation error - %s" msgstr "" @@ -705,11 +705,11 @@ msgstr "" msgid "Internal error, Ordering didn't finish" msgstr "" -#: cmdline/apt-get.cc:792 cmdline/apt-get.cc:1880 cmdline/apt-get.cc:1913 +#: cmdline/apt-get.cc:792 cmdline/apt-get.cc:1886 cmdline/apt-get.cc:1919 msgid "Unable to lock the download directory" msgstr "" -#: cmdline/apt-get.cc:802 cmdline/apt-get.cc:1961 cmdline/apt-get.cc:2197 +#: cmdline/apt-get.cc:802 cmdline/apt-get.cc:1967 cmdline/apt-get.cc:2203 #: apt-pkg/cachefile.cc:67 msgid "The list of sources could not be read." msgstr "" @@ -738,7 +738,7 @@ msgstr "" msgid "After unpacking %sB disk space will be freed.\n" msgstr "" -#: cmdline/apt-get.cc:847 cmdline/apt-get.cc:2051 +#: cmdline/apt-get.cc:847 cmdline/apt-get.cc:2057 #, c-format msgid "Couldn't determine free space in %s" msgstr "" @@ -772,7 +772,7 @@ msgstr "" msgid "Do you want to continue [Y/n]? " msgstr "" -#: cmdline/apt-get.cc:962 cmdline/apt-get.cc:1366 cmdline/apt-get.cc:2094 +#: cmdline/apt-get.cc:962 cmdline/apt-get.cc:1366 cmdline/apt-get.cc:2100 #, c-format msgid "Failed to fetch %s %s\n" msgstr "" @@ -781,7 +781,7 @@ msgstr "" msgid "Some files failed to download" msgstr "" -#: cmdline/apt-get.cc:981 cmdline/apt-get.cc:2103 +#: cmdline/apt-get.cc:981 cmdline/apt-get.cc:2109 msgid "Download complete and in download only mode" msgstr "" @@ -887,49 +887,55 @@ msgid "" "used instead." msgstr "" -#: cmdline/apt-get.cc:1399 +#: cmdline/apt-get.cc:1402 msgid "We are not supposed to delete stuff, can't start AutoRemover" msgstr "" -#: cmdline/apt-get.cc:1424 +#: cmdline/apt-get.cc:1427 +msgid "" +"The following packages where automatically installed and are no longer " +"required:" +msgstr "" + +#: cmdline/apt-get.cc:1432 msgid "" "Hmm, seems like the AutoRemover destroyed something which really\n" "shouldn't happen. Please file a bug report against apt." msgstr "" -#: cmdline/apt-get.cc:1427 cmdline/apt-get.cc:1629 +#: cmdline/apt-get.cc:1435 cmdline/apt-get.cc:1637 msgid "The following information may help to resolve the situation:" msgstr "" -#: cmdline/apt-get.cc:1431 +#: cmdline/apt-get.cc:1439 msgid "Internal Error, AutoRemover broke stuff" msgstr "" -#: cmdline/apt-get.cc:1450 +#: cmdline/apt-get.cc:1458 msgid "Internal error, AllUpgrade broke stuff" msgstr "" -#: cmdline/apt-get.cc:1548 cmdline/apt-get.cc:1584 +#: cmdline/apt-get.cc:1556 cmdline/apt-get.cc:1592 #, c-format msgid "Couldn't find package %s" msgstr "" -#: cmdline/apt-get.cc:1571 +#: cmdline/apt-get.cc:1579 #, c-format msgid "Note, selecting %s for regex '%s'\n" msgstr "" -#: cmdline/apt-get.cc:1601 +#: cmdline/apt-get.cc:1609 msgid "You might want to run `apt-get -f install' to correct these:" msgstr "" -#: cmdline/apt-get.cc:1604 +#: cmdline/apt-get.cc:1612 msgid "" "Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a " "solution)." msgstr "" -#: cmdline/apt-get.cc:1616 +#: cmdline/apt-get.cc:1624 msgid "" "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" @@ -937,159 +943,159 @@ msgid "" "or been moved out of Incoming." msgstr "" -#: cmdline/apt-get.cc:1624 +#: cmdline/apt-get.cc:1632 msgid "" "Since you only requested a single operation it is extremely likely that\n" "the package is simply not installable and a bug report against\n" "that package should be filed." msgstr "" -#: cmdline/apt-get.cc:1632 +#: cmdline/apt-get.cc:1640 msgid "Broken packages" msgstr "" -#: cmdline/apt-get.cc:1663 +#: cmdline/apt-get.cc:1669 msgid "The following extra packages will be installed:" msgstr "" -#: cmdline/apt-get.cc:1752 +#: cmdline/apt-get.cc:1758 msgid "Suggested packages:" msgstr "" -#: cmdline/apt-get.cc:1753 +#: cmdline/apt-get.cc:1759 msgid "Recommended packages:" msgstr "" -#: cmdline/apt-get.cc:1773 +#: cmdline/apt-get.cc:1779 msgid "Calculating upgrade... " msgstr "" -#: cmdline/apt-get.cc:1776 methods/ftp.cc:702 methods/connect.cc:101 +#: cmdline/apt-get.cc:1782 methods/ftp.cc:702 methods/connect.cc:101 msgid "Failed" msgstr "" -#: cmdline/apt-get.cc:1781 +#: cmdline/apt-get.cc:1787 msgid "Done" msgstr "" -#: cmdline/apt-get.cc:1848 cmdline/apt-get.cc:1856 +#: cmdline/apt-get.cc:1854 cmdline/apt-get.cc:1862 msgid "Internal error, problem resolver broke stuff" msgstr "" -#: cmdline/apt-get.cc:1956 +#: cmdline/apt-get.cc:1962 msgid "Must specify at least one package to fetch source for" msgstr "" -#: cmdline/apt-get.cc:1986 cmdline/apt-get.cc:2215 +#: cmdline/apt-get.cc:1992 cmdline/apt-get.cc:2221 #, c-format msgid "Unable to find a source package for %s" msgstr "" -#: cmdline/apt-get.cc:2030 +#: cmdline/apt-get.cc:2036 #, c-format msgid "Skipping already downloaded file '%s'\n" msgstr "" -#: cmdline/apt-get.cc:2054 +#: cmdline/apt-get.cc:2060 #, c-format msgid "You don't have enough free space in %s" msgstr "" -#: cmdline/apt-get.cc:2059 +#: cmdline/apt-get.cc:2065 #, c-format msgid "Need to get %sB/%sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:2062 +#: cmdline/apt-get.cc:2068 #, c-format msgid "Need to get %sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:2068 +#: cmdline/apt-get.cc:2074 #, c-format msgid "Fetch source %s\n" msgstr "" -#: cmdline/apt-get.cc:2099 +#: cmdline/apt-get.cc:2105 msgid "Failed to fetch some archives." msgstr "" -#: cmdline/apt-get.cc:2127 +#: cmdline/apt-get.cc:2133 #, c-format msgid "Skipping unpack of already unpacked source in %s\n" msgstr "" -#: cmdline/apt-get.cc:2139 +#: cmdline/apt-get.cc:2145 #, c-format msgid "Unpack command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2140 +#: cmdline/apt-get.cc:2146 #, c-format msgid "Check if the 'dpkg-dev' package is installed.\n" msgstr "" -#: cmdline/apt-get.cc:2157 +#: cmdline/apt-get.cc:2163 #, c-format msgid "Build command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2176 +#: cmdline/apt-get.cc:2182 msgid "Child process failed" msgstr "" -#: cmdline/apt-get.cc:2192 +#: cmdline/apt-get.cc:2198 msgid "Must specify at least one package to check builddeps for" msgstr "" -#: cmdline/apt-get.cc:2220 +#: cmdline/apt-get.cc:2226 #, c-format msgid "Unable to get build-dependency information for %s" msgstr "" -#: cmdline/apt-get.cc:2240 +#: cmdline/apt-get.cc:2246 #, c-format msgid "%s has no build depends.\n" msgstr "" -#: cmdline/apt-get.cc:2292 +#: cmdline/apt-get.cc:2298 #, c-format msgid "" "%s dependency for %s cannot be satisfied because the package %s cannot be " "found" msgstr "" -#: cmdline/apt-get.cc:2344 +#: cmdline/apt-get.cc:2350 #, c-format msgid "" "%s dependency for %s cannot be satisfied because no available versions of " "package %s can satisfy version requirements" msgstr "" -#: cmdline/apt-get.cc:2379 +#: cmdline/apt-get.cc:2385 #, c-format msgid "Failed to satisfy %s dependency for %s: Installed package %s is too new" msgstr "" -#: cmdline/apt-get.cc:2404 +#: cmdline/apt-get.cc:2410 #, c-format msgid "Failed to satisfy %s dependency for %s: %s" msgstr "" -#: cmdline/apt-get.cc:2418 +#: cmdline/apt-get.cc:2424 #, c-format msgid "Build-dependencies for %s could not be satisfied." msgstr "" -#: cmdline/apt-get.cc:2422 +#: cmdline/apt-get.cc:2428 msgid "Failed to process build dependencies" msgstr "" -#: cmdline/apt-get.cc:2454 +#: cmdline/apt-get.cc:2460 msgid "Supported modules:" msgstr "" -#: cmdline/apt-get.cc:2495 +#: cmdline/apt-get.cc:2501 msgid "" "Usage: apt-get [options] command\n" " apt-get [options] install|remove pkg1 [pkg2 ...]\n" -- cgit v1.2.3