From e406c1756b00ad725988c0da792330f8cf5d63f2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 13 Mar 2007 12:00:21 +0100 Subject: * cmdline/apt-get.cc: - fix show-versions output --- 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 9b6e36e21..6c1b915ab 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1419,7 +1419,7 @@ bool DoAutomaticRemove(CacheFile &Cache) std::cout << "We could delete %s" << Pkg.Name() << std::endl; autoremovelist += string(Pkg.Name()) + " "; - autoremoveversions += string(Cache[Pkg].CandVersion) + " "; + autoremoveversions += string(Cache[Pkg].CandVersion) + "\n"; if (doAutoRemove) { if(Pkg.CurrentVer() != 0 && -- cgit v1.2.3 From e6756cdefaad7818f4a3bb95e7a935bc6cf8ed2e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 13 Mar 2007 13:38:12 +0100 Subject: * apt-pkg/packagemanager.cc: - use ActionGroup() to protect FixMissing() --- apt-pkg/packagemanager.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index b0dd43629..1e57d6455 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -95,9 +95,10 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, be downloaded. */ bool pkgPackageManager::FixMissing() { + pkgDepCache::ActionGroup group(Cache); pkgProblemResolver Resolve(&Cache); List->SetFileList(FileNames); - + bool Bad = false; for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) { -- cgit v1.2.3 From 92b9551f03035f5a875a44588a318773f652da6a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 14 Mar 2007 11:45:33 +0100 Subject: * apt-pkg/depcache.cc: - added APT::Never-MarkAuto-Section variable - that will consider dependencies of packages in this section manual --- apt-pkg/depcache.cc | 17 ++++++- doc/examples/configure-index | 2 + po/apt-all.pot | 112 ++++++++++++++++++++++--------------------- 3 files changed, 76 insertions(+), 55 deletions(-) diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 3dc9bda35..f5673dd5d 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -907,7 +907,22 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, std::clog << "Installing " << InstPkg.Name() << " as dep of " << Pkg.Name() << std::endl; - MarkInstall(InstPkg, true, Depth + 1, false); + // now check if we should consider it a automatic dependency or not + string sec = _config->Find("APT::Never-MarkAuto-Section",""); + if(Pkg.Section() && (string(Pkg.Section()) == sec)) + { + if(_config->FindB("Debug::pkgDepCache::AutoInstall",false) == true) + std::clog << "Setting NOT as auto-installed because its a direct dep of a package in section " << sec << std::endl; + MarkInstall(InstPkg,true,Depth + 1, true); + } + else + { + // mark automatic dependency + MarkInstall(InstPkg,true,Depth + 1, false); + // Set the autoflag, after MarkInstall because MarkInstall unsets it + if (P->CurrentVer == 0) + PkgState[InstPkg->ID].Flags |= Flag::Auto; + } } continue; } diff --git a/doc/examples/configure-index b/doc/examples/configure-index index 1911d091b..32b7168a0 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -94,6 +94,8 @@ APT Cache-Limit "4194304"; Default-Release ""; + // consider dependencies of packages in this section manual + Never-MarkAuto-Section "metapackages"; // Write progress messages on this fd (for stuff like base-config) Status-Fd "-1"; diff --git a/po/apt-all.pot b/po/apt-all.pot index 0a7a30629..0dc932d47 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:58+0200\n" +"POT-Creation-Date: 2007-03-14 11:44+0100\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:2455 cmdline/apt-sortpkgs.cc:144 +#: cmdline/apt-get.cc:2463 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:1569 +#: cmdline/apt-get.cc:143 cmdline/apt-get.cc:1577 #, 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:1886 cmdline/apt-get.cc:1919 +#: cmdline/apt-get.cc:792 cmdline/apt-get.cc:1894 cmdline/apt-get.cc:1927 msgid "Unable to lock the download directory" msgstr "" -#: cmdline/apt-get.cc:802 cmdline/apt-get.cc:1967 cmdline/apt-get.cc:2203 +#: cmdline/apt-get.cc:802 cmdline/apt-get.cc:1975 cmdline/apt-get.cc:2211 #: 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:2057 +#: cmdline/apt-get.cc:847 cmdline/apt-get.cc:2065 #, 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:2100 +#: cmdline/apt-get.cc:962 cmdline/apt-get.cc:1366 cmdline/apt-get.cc:2108 #, 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:2109 +#: cmdline/apt-get.cc:981 cmdline/apt-get.cc:2117 msgid "Download complete and in download only mode" msgstr "" @@ -887,55 +887,59 @@ msgid "" "used instead." msgstr "" -#: cmdline/apt-get.cc:1402 +#: cmdline/apt-get.cc:1406 msgid "We are not supposed to delete stuff, can't start AutoRemover" msgstr "" -#: cmdline/apt-get.cc:1427 +#: cmdline/apt-get.cc:1433 msgid "" -"The following packages where automatically installed and are no longer " +"The following packages were automatically installed and are no longer " "required:" msgstr "" -#: cmdline/apt-get.cc:1432 +#: cmdline/apt-get.cc:1435 +msgid "Use 'apt-get autoremove' to remove them." +msgstr "" + +#: cmdline/apt-get.cc:1440 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:1435 cmdline/apt-get.cc:1637 +#: cmdline/apt-get.cc:1443 cmdline/apt-get.cc:1645 msgid "The following information may help to resolve the situation:" msgstr "" -#: cmdline/apt-get.cc:1439 +#: cmdline/apt-get.cc:1447 msgid "Internal Error, AutoRemover broke stuff" msgstr "" -#: cmdline/apt-get.cc:1458 +#: cmdline/apt-get.cc:1466 msgid "Internal error, AllUpgrade broke stuff" msgstr "" -#: cmdline/apt-get.cc:1556 cmdline/apt-get.cc:1592 +#: cmdline/apt-get.cc:1564 cmdline/apt-get.cc:1600 #, c-format msgid "Couldn't find package %s" msgstr "" -#: cmdline/apt-get.cc:1579 +#: cmdline/apt-get.cc:1587 #, c-format msgid "Note, selecting %s for regex '%s'\n" msgstr "" -#: cmdline/apt-get.cc:1609 +#: cmdline/apt-get.cc:1617 msgid "You might want to run `apt-get -f install' to correct these:" msgstr "" -#: cmdline/apt-get.cc:1612 +#: cmdline/apt-get.cc:1620 msgid "" "Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a " "solution)." msgstr "" -#: cmdline/apt-get.cc:1624 +#: cmdline/apt-get.cc:1632 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" @@ -943,159 +947,159 @@ msgid "" "or been moved out of Incoming." msgstr "" -#: cmdline/apt-get.cc:1632 +#: cmdline/apt-get.cc:1640 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:1640 +#: cmdline/apt-get.cc:1648 msgid "Broken packages" msgstr "" -#: cmdline/apt-get.cc:1669 +#: cmdline/apt-get.cc:1677 msgid "The following extra packages will be installed:" msgstr "" -#: cmdline/apt-get.cc:1758 +#: cmdline/apt-get.cc:1766 msgid "Suggested packages:" msgstr "" -#: cmdline/apt-get.cc:1759 +#: cmdline/apt-get.cc:1767 msgid "Recommended packages:" msgstr "" -#: cmdline/apt-get.cc:1779 +#: cmdline/apt-get.cc:1787 msgid "Calculating upgrade... " msgstr "" -#: cmdline/apt-get.cc:1782 methods/ftp.cc:702 methods/connect.cc:101 +#: cmdline/apt-get.cc:1790 methods/ftp.cc:702 methods/connect.cc:101 msgid "Failed" msgstr "" -#: cmdline/apt-get.cc:1787 +#: cmdline/apt-get.cc:1795 msgid "Done" msgstr "" -#: cmdline/apt-get.cc:1854 cmdline/apt-get.cc:1862 +#: cmdline/apt-get.cc:1862 cmdline/apt-get.cc:1870 msgid "Internal error, problem resolver broke stuff" msgstr "" -#: cmdline/apt-get.cc:1962 +#: cmdline/apt-get.cc:1970 msgid "Must specify at least one package to fetch source for" msgstr "" -#: cmdline/apt-get.cc:1992 cmdline/apt-get.cc:2221 +#: cmdline/apt-get.cc:2000 cmdline/apt-get.cc:2229 #, c-format msgid "Unable to find a source package for %s" msgstr "" -#: cmdline/apt-get.cc:2036 +#: cmdline/apt-get.cc:2044 #, c-format msgid "Skipping already downloaded file '%s'\n" msgstr "" -#: cmdline/apt-get.cc:2060 +#: cmdline/apt-get.cc:2068 #, c-format msgid "You don't have enough free space in %s" msgstr "" -#: cmdline/apt-get.cc:2065 +#: cmdline/apt-get.cc:2073 #, c-format msgid "Need to get %sB/%sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:2068 +#: cmdline/apt-get.cc:2076 #, c-format msgid "Need to get %sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:2074 +#: cmdline/apt-get.cc:2082 #, c-format msgid "Fetch source %s\n" msgstr "" -#: cmdline/apt-get.cc:2105 +#: cmdline/apt-get.cc:2113 msgid "Failed to fetch some archives." msgstr "" -#: cmdline/apt-get.cc:2133 +#: cmdline/apt-get.cc:2141 #, c-format msgid "Skipping unpack of already unpacked source in %s\n" msgstr "" -#: cmdline/apt-get.cc:2145 +#: cmdline/apt-get.cc:2153 #, c-format msgid "Unpack command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2146 +#: cmdline/apt-get.cc:2154 #, c-format msgid "Check if the 'dpkg-dev' package is installed.\n" msgstr "" -#: cmdline/apt-get.cc:2163 +#: cmdline/apt-get.cc:2171 #, c-format msgid "Build command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2182 +#: cmdline/apt-get.cc:2190 msgid "Child process failed" msgstr "" -#: cmdline/apt-get.cc:2198 +#: cmdline/apt-get.cc:2206 msgid "Must specify at least one package to check builddeps for" msgstr "" -#: cmdline/apt-get.cc:2226 +#: cmdline/apt-get.cc:2234 #, c-format msgid "Unable to get build-dependency information for %s" msgstr "" -#: cmdline/apt-get.cc:2246 +#: cmdline/apt-get.cc:2254 #, c-format msgid "%s has no build depends.\n" msgstr "" -#: cmdline/apt-get.cc:2298 +#: cmdline/apt-get.cc:2306 #, c-format msgid "" "%s dependency for %s cannot be satisfied because the package %s cannot be " "found" msgstr "" -#: cmdline/apt-get.cc:2350 +#: cmdline/apt-get.cc:2358 #, 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:2385 +#: cmdline/apt-get.cc:2393 #, c-format msgid "Failed to satisfy %s dependency for %s: Installed package %s is too new" msgstr "" -#: cmdline/apt-get.cc:2410 +#: cmdline/apt-get.cc:2418 #, c-format msgid "Failed to satisfy %s dependency for %s: %s" msgstr "" -#: cmdline/apt-get.cc:2424 +#: cmdline/apt-get.cc:2432 #, c-format msgid "Build-dependencies for %s could not be satisfied." msgstr "" -#: cmdline/apt-get.cc:2428 +#: cmdline/apt-get.cc:2436 msgid "Failed to process build dependencies" msgstr "" -#: cmdline/apt-get.cc:2460 +#: cmdline/apt-get.cc:2468 msgid "Supported modules:" msgstr "" -#: cmdline/apt-get.cc:2501 +#: cmdline/apt-get.cc:2509 msgid "" "Usage: apt-get [options] command\n" " apt-get [options] install|remove pkg1 [pkg2 ...]\n" @@ -2206,7 +2210,7 @@ msgstr "" msgid "Malformed line %u in source list %s (vendor id)" msgstr "" -#: apt-pkg/packagemanager.cc:402 +#: apt-pkg/packagemanager.cc:403 #, c-format msgid "" "This installation run will require temporarily removing the essential " -- cgit v1.2.3 From e4b74e4b347ccde887a3d7d8a585dcf264e13305 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 14 Mar 2007 12:41:37 +0100 Subject: * cmdline/apt-get.cc: - apt-get install foo for a already installed package foo that is marked "auto" will clear the auto-flag --- cmdline/apt-get.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 6c1b915ab..8f4e17898 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1484,6 +1484,7 @@ bool DoInstall(CommandLine &CmdL) if (Cache->BrokenCount() != 0) BrokenFix = true; + unsigned int AutoMarkChanged = 0; unsigned int ExpectedInst = 0; unsigned int Packages = 0; pkgProblemResolver Fix(Cache); @@ -1606,6 +1607,18 @@ bool DoInstall(CommandLine &CmdL) return false; if (TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,ExpectedInst) == false) return false; + + // see if we need to fix the auto-mark flag + // e.g. apt-get install foo + // where foo is marked automatic + if(Cache[Pkg].Install() == false && + (Cache[Pkg].Flags & pkgCache::Flag::Auto)) + { + ioprintf(c1out,_("%s set to manual installed.\n"), + Pkg.Name()); + Cache->MarkAuto(Pkg,false); + AutoMarkChanged++; + } } } @@ -1768,6 +1781,14 @@ bool DoInstall(CommandLine &CmdL) } + // if nothing changed in the cache, but only the automark information + // we write the StateFile here, otherwise it will be written in + // cache.commit() + if (AutoMarkChanged > 0 && + Cache->DelCount() == 0 && Cache->InstCount() == 0 && + Cache->BadCount() == 0) + Cache->writeStateFile(NULL); + // See if we need to prompt if (Cache->InstCount() == ExpectedInst && Cache->DelCount() == 0) return InstallPackages(Cache,false,false); -- cgit v1.2.3 From fd59a713400968e1e9f35a7eaeea08b58e77c53b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 14 Mar 2007 13:47:42 +0100 Subject: * cmdline/apt-get.cc: - do not clean the auto-flag in "remove" mode (e.g. apt-get remove already-installed-pkg) - only show packages in the auto-remove list that are not already marked for removal --- cmdline/apt-get.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 8f4e17898..ed1ef98be 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1417,9 +1417,13 @@ bool DoAutomaticRemove(CacheFile &Cache) 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) + "\n"; + + // only show stuff in the list that is not yet marked for removal + if(Cache[Pkg].Delete() == false) + { + autoremovelist += string(Pkg.Name()) + " "; + autoremoveversions += string(Cache[Pkg].CandVersion) + "\n"; + } if (doAutoRemove) { if(Pkg.CurrentVer() != 0 && @@ -1611,7 +1615,8 @@ bool DoInstall(CommandLine &CmdL) // see if we need to fix the auto-mark flag // e.g. apt-get install foo // where foo is marked automatic - if(Cache[Pkg].Install() == false && + if(!Remove && + Cache[Pkg].Install() == false && (Cache[Pkg].Flags & pkgCache::Flag::Auto)) { ioprintf(c1out,_("%s set to manual installed.\n"), -- cgit v1.2.3 From 7898bd970a791bb8892b0dfdffc683828a447900 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 14 Mar 2007 13:57:57 +0100 Subject: =?UTF-8?q?*=20cmdline/apt-get.cc:=20=20=20-=20applied=20patch=20f?= =?UTF-8?q?rom=20Frode=20M.=20D=C3=B8ving=20=20to=20have=20APT::Get::HideA?= =?UTF-8?q?utoRemove?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmdline/apt-get.cc | 7 ++++--- doc/examples/configure-index | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index ed1ef98be..e8e5a8c39 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1394,8 +1394,8 @@ bool DoAutomaticRemove(CacheFile &Cache) { bool Debug = _config->FindI("Debug::pkgAutoRemove",false); bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false); + bool hideAutoRemove = _config->FindB("APT::Get::HideAutoRemove"); pkgDepCache::ActionGroup group(*Cache); - if(Debug) std::cout << "DoAutomaticRemove()" << std::endl; @@ -1434,8 +1434,9 @@ bool DoAutomaticRemove(CacheFile &Cache) } } } - ShowList(c1out, _("The following packages were automatically installed and are no longer required:"), autoremovelist, autoremoveversions); - if (!doAutoRemove && autoremovelist.size() > 0) + if (!hideAutoRemove) + ShowList(c1out, _("The following packages were automatically installed and are no longer required:"), autoremovelist, autoremoveversions); + if (!doAutoRemove && !hideAutoRemove && autoremovelist.size() > 0) c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl; // Now see if we destroyed anything diff --git a/doc/examples/configure-index b/doc/examples/configure-index index 32b7168a0..d3e061f9a 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -33,6 +33,7 @@ APT { Arch-Only "false"; AutomaticRemove "false"; + HideAutoRemove "false"; Download-Only "false"; Simulate "false"; Assume-Yes "false"; -- cgit v1.2.3