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(-) (limited to 'cmdline') 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 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(+) (limited to 'cmdline') 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(-) (limited to 'cmdline') 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 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cmdline') 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 -- cgit v1.2.3 From 54eda6ae969cd66d06fe82f7175f753a74d2b7dc Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 14 Mar 2007 17:11:31 +0100 Subject: cmdline/apt-mark: fix chmod()/rename() ordering --- cmdline/apt-mark | 1 + 1 file changed, 1 insertion(+) (limited to 'cmdline') diff --git a/cmdline/apt-mark b/cmdline/apt-mark index 533ed8715..dadc01366 100755 --- a/cmdline/apt-mark +++ b/cmdline/apt-mark @@ -60,4 +60,5 @@ if __name__ == "__main__": else: outfile.write(str(tagfile.Section)+"\n") # all done, rename the tmpfile + os.chmod(outfile.name, 0644) os.rename(outfile.name, STATE_FILE) -- cgit v1.2.3