diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-06 19:25:51 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-06 19:25:51 +0200 |
commit | 59e4486eb632f4e56eb336fe5a7dc694059e741c (patch) | |
tree | a0421cdb156a15fa7e5fc1bbc1e144b12e36c40c | |
parent | 8e72d2085d7c84466d25178c2eb256ad3e972dde (diff) | |
parent | 9d2938d4e6e86c6afdb9606f76f4ae9ce0ac4ee5 (diff) |
* merged from the auto-install branch
-rw-r--r-- | cmdline/apt-get.cc | 45 | ||||
-rw-r--r-- | debian/apt.conf.autoremove | 8 | ||||
-rw-r--r-- | debian/apt.dirs | 1 | ||||
-rwxr-xr-x | debian/rules | 2 | ||||
-rw-r--r-- | methods/http.cc | 2 |
5 files changed, 38 insertions, 20 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 4bd66383f..7b70de3bd 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1419,31 +1419,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) @@ -1659,10 +1670,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/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 333d4ad5b..ffc23402e 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/ubuntu-archive.gpg debian/$@/usr/share/$@ - + cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove # head -n 500 ChangeLog > debian/ChangeLog # make rosetta happy and remove pot files in po/ (but leave stuff diff --git a/methods/http.cc b/methods/http.cc index 09dab8188..1833f41ef 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -657,7 +657,7 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out) will glitch HTTP/1.0 proxies because they do not filter it out and pass it on, HTTP/1.1 says the connection should default to keep alive and we expect the proxy to do this */ - if (Proxy.empty() == true) + if (Proxy.empty() == true || Proxy.Host.empty()) sprintf(Buf,"GET %s HTTP/1.1\r\nHost: %s\r\nConnection: keep-alive\r\n", QuoteString(Uri.Path,"~").c_str(),ProperHost.c_str()); else |