summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-02-03 14:22:32 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-02-03 14:22:32 +0100
commit3eb9e257855d83d0486d7a5fa7cc5e2edebb6aaa (patch)
tree4739355d87bcbf8f49fa634b692e48e4aee6746d /cmdline/apt-get.cc
parent7c748f4aa1bd47089672353fd1a401d1c5c94723 (diff)
parent875bcb3670c43bd4450e27934ba105611e534df0 (diff)
merge 'after squeeze release'-stuff
[ David Kalnischkies ] * apt-pkg/depcache.cc: - add SetCandidateRelease() to set a candidate version and the candidates of dependencies if needed to a specified release (Closes: #572709) * cmdline/apt-get.cc: - if --print-uris is used don't setup downloader as we don't need progress, lock nor the directories it would create otherwise - show dependencies of essential packages which are going to remove only if they cause the remove of this essential (Closes: #601961) - keep not installed garbage packages uninstalled instead of showing in the autoremove section and installing those (Closes: #604222) - change pkg/release behavior to use the new SetCandidateRelease so installing packages from experimental or backports is easier - really do not show packages in the extra section if they were requested on the commandline, e.g. with a modifier (Closes: #184730) * debian/control: - add Vcs-Browser now that loggerhead works again (Closes: #511168) - depend on debhelper 7 to raise compat level - depend on dpkg-dev (>= 1.15.8) to have c++ symbol mangling * apt-pkg/contrib/fileutl.cc: - add a RealFileExists method and check that your configuration files are real files to avoid endless loops if not (Closes: #604401) - ignore non-regular files in GetListOfFilesInDir (Closes: #594694) * apt-pkg/contrib/weakptr.h: - include stddefs.h to fix compile error (undefined NULL) with gcc-4.6 * methods/https.cc: - fix CURLOPT_SSL_VERIFYHOST by really passing 2 to it if enabled * deb/dpkgpm.cc: - fix popen/fclose mismatch reported by cppcheck. Thanks to Petter Reinholdtsen for report and patch! (Closes: #607803) * doc/apt.conf.5.xml: - fix multipl{y,e} spelling error reported by Jakub Wilk (Closes: #607636) * apt-inst/contrib/extracttar.cc: - let apt-utils work with encoded tar headers if uid/gid are large. Thanks to Nobuhiro Hayashi for the patch! (Closes: #330162) * apt-pkg/cacheiterator.h: - do not segfault if cache is not build (Closes: #254770) * doc/apt-get.8.xml: - remove duplicated mentioning of --install-recommends * doc/sources.list.5.xml: - remove obsolete references to non-us (Closes: #594495) * debian/rules: - use -- instead of deprecated -u for dh_gencontrol - remove shlibs.local creation and usage - show differences in the symbol files, but never fail * pre-build.sh: - remove as it is not needed for a working 'bzr bd' * debian/{apt,apt-utils}.symbols: - ship experimental unmangled c++ symbol files * methods/rred.cc: - operate optional on gzip compressed pdiffs * apt-pkg/acquire-item.cc: - don't uncompress downloaded pdiff files before feeding it to rred - try downloading clearsigned InRelease before trying Release.gpg - change the internal handling of Extensions in pkgAcqIndex - add a special uncompressed compression type to prefer those files - download and use i18n/Index to choose which Translations to download * cmdline/apt-key: - don't set trustdb-name as non-root so 'list' and 'finger' can be used without being root (Closes: #393005, #592107) * apt-pkg/deb/deblistparser.cc: - rewrite LoadReleaseInfo to cope with clearsigned Releasefiles * ftparchive/writer.cc: - add config option to search for more patterns in release command - include Index files by default in the Release file * methods/{gzip,bzip}.cc: - print a good error message if FileSize() is zero * apt-pkg/aptconfiguration.cc: - remove the inbuilt Translation files whitelist
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc101
1 files changed, 68 insertions, 33 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 6e1a5280c..e93d12c2b 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -538,7 +538,9 @@ bool ShowEssential(ostream &out,CacheFile &Cache)
//VersionsList += string(Cache[I].CurVersion) + "\n"; ???
}
}
-
+ else
+ continue;
+
if (I->CurrentVer == 0)
continue;
@@ -626,6 +628,8 @@ class CacheSetHelperAPTGet : public APT::CacheSetHelper {
APT::PackageSet virtualPkgs;
public:
+ std::list<std::pair<pkgCache::VerIterator, std::string> > selectedByRelease;
+
CacheSetHelperAPTGet(std::ostream &out) : APT::CacheSetHelper(true), out(out) {
explicitlyNamed = true;
}
@@ -644,9 +648,9 @@ public:
}
virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
string const &ver, bool const &verIsRel) {
- if (ver != Ver.VerStr())
- ioprintf(out, _("Selected version '%s' (%s) for '%s'\n"),
- Ver.VerStr(), Ver.RelStr().c_str(), Pkg.FullName(true).c_str());
+ if (ver == Ver.VerStr())
+ return;
+ selectedByRelease.push_back(make_pair(Ver, ver));
}
bool showVirtualPackageErrors(pkgCacheFile &Cache) {
@@ -827,6 +831,37 @@ struct TryToInstall {
}
}
+ bool propergateReleaseCandiateSwitching(std::list<std::pair<pkgCache::VerIterator, std::string> > start, std::ostream &out)
+ {
+ for (std::list<std::pair<pkgCache::VerIterator, std::string> >::const_iterator s = start.begin();
+ s != start.end(); ++s)
+ Cache->GetDepCache()->SetCandidateVersion(s->first);
+
+ bool Success = true;
+ std::list<std::pair<pkgCache::VerIterator, pkgCache::VerIterator> > Changed;
+ for (std::list<std::pair<pkgCache::VerIterator, std::string> >::const_iterator s = start.begin();
+ s != start.end(); ++s)
+ {
+ Changed.push_back(std::make_pair(s->first, pkgCache::VerIterator(*Cache)));
+ // We continue here even if it failed to enhance the ShowBroken output
+ Success &= Cache->GetDepCache()->SetCandidateRelease(s->first, s->second, Changed);
+ }
+ for (std::list<std::pair<pkgCache::VerIterator, pkgCache::VerIterator> >::const_iterator c = Changed.begin();
+ c != Changed.end(); ++c)
+ {
+ if (c->second.end() == true)
+ ioprintf(out, _("Selected version '%s' (%s) for '%s'\n"),
+ c->first.VerStr(), c->first.RelStr().c_str(), c->first.ParentPkg().FullName(true).c_str());
+ else if (c->first.ParentPkg()->Group != c->second.ParentPkg()->Group)
+ {
+ pkgCache::VerIterator V = (*Cache)[c->first.ParentPkg()].CandidateVerIter(*Cache);
+ ioprintf(out, _("Selected version '%s' (%s) for '%s' because of '%s'\n"), V.VerStr(),
+ V.RelStr().c_str(), V.ParentPkg().FullName(true).c_str(), c->second.ParentPkg().FullName(true).c_str());
+ }
+ }
+ return Success;
+ }
+
void doAutoInstall() {
for (APT::PackageSet::const_iterator P = doAutoInstallLater.begin();
P != doAutoInstallLater.end(); ++P) {
@@ -1077,8 +1112,6 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
{
// force a hashsum for compatibility reasons
_config->CndSet("Acquire::ForceHash", "md5sum");
- if (Fetcher.Setup(&Stat, "") == false)
- return false;
}
else if (Fetcher.Setup(&Stat, _config->FindDir("Dir::Cache::Archives")) == false)
return false;
@@ -1608,10 +1641,6 @@ bool DoAutomaticRemove(CacheFile &Cache)
if(Debug)
std::cout << "DoAutomaticRemove()" << std::endl;
- // we don't want to autoremove and we don't want to see it, so why calculating?
- if (doAutoRemove == false && hideAutoRemove == true)
- return true;
-
if (doAutoRemove == true &&
_config->FindB("APT::Get::Remove",true) == false)
{
@@ -1622,7 +1651,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
bool purgePkgs = _config->FindB("APT::Get::Purge", false);
bool smallList = (hideAutoRemove == false &&
- strcasecmp(_config->Find("APT::Get::HideAutoRemove","").c_str(),"small") == 0);
+ strcasecmp(_config->Find("APT::Get::HideAutoRemove","").c_str(),"small") == 0);
string autoremovelist, autoremoveversions;
unsigned long autoRemoveCount = 0;
@@ -1645,8 +1674,12 @@ bool DoAutomaticRemove(CacheFile &Cache)
}
else
{
+ // if the package is a new install and already garbage we don't need to
+ // install it in the first place, so nuke it instead of show it
+ if (Cache[Pkg].Install() == true && Pkg.CurrentVer() == 0)
+ Cache->MarkDelete(Pkg, false);
// only show stuff in the list that is not yet marked for removal
- if(Cache[Pkg].Delete() == false)
+ else if(hideAutoRemove == false && Cache[Pkg].Delete() == false)
{
++autoRemoveCount;
// we don't need to fill the strings if we don't need them
@@ -1659,6 +1692,20 @@ bool DoAutomaticRemove(CacheFile &Cache)
}
}
}
+
+ // Now see if we had destroyed anything (if we had done anything)
+ if (Cache->BrokenCount() != 0)
+ {
+ c1out << _("Hmm, seems like the AutoRemover destroyed something which really\n"
+ "shouldn't happen. Please file a bug report against apt.") << endl;
+ c1out << endl;
+ c1out << _("The following information may help to resolve the situation:") << endl;
+ c1out << endl;
+ ShowBroken(c1out,Cache,false);
+
+ return _error->Error(_("Internal Error, AutoRemover broke stuff"));
+ }
+
// if we don't remove them, we should show them!
if (doAutoRemove == false && (autoremovelist.empty() == false || autoRemoveCount != 0))
{
@@ -1671,18 +1718,6 @@ bool DoAutomaticRemove(CacheFile &Cache)
"%lu packages were automatically installed and are no longer required.\n", autoRemoveCount), autoRemoveCount);
c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl;
}
- // Now see if we had destroyed anything (if we had done anything)
- else if (Cache->BrokenCount() != 0)
- {
- c1out << _("Hmm, seems like the AutoRemover destroyed something which really\n"
- "shouldn't happen. Please file a bug report against apt.") << endl;
- c1out << endl;
- c1out << _("The following information may help to resolve the situation:") << endl;
- c1out << endl;
- ShowBroken(c1out,Cache,false);
-
- return _error->Error(_("Internal Error, AutoRemover broke stuff"));
- }
return true;
}
/*}}}*/
@@ -1775,6 +1810,7 @@ bool DoInstall(CommandLine &CmdL)
{
if (order[i] == MOD_INSTALL) {
InstallAction = std::for_each(verset[MOD_INSTALL].begin(), verset[MOD_INSTALL].end(), InstallAction);
+ InstallAction.propergateReleaseCandiateSwitching(helper.selectedByRelease, c0out);
InstallAction.doAutoInstall();
}
else if (order[i] == MOD_REMOVE)
@@ -1839,16 +1875,15 @@ bool DoInstall(CommandLine &CmdL)
pkgCache::PkgIterator I(Cache,Cache.List[J]);
if ((*Cache)[I].Install() == false)
continue;
+ pkgCache::VerIterator Cand = Cache[I].CandidateVerIter(Cache);
+ if (Cand.Pseudo() == true)
+ continue;
- const char **J;
- for (J = CmdL.FileList + 1; *J != 0; J++)
- if (strcmp(*J,I.Name()) == 0)
- break;
-
- if (*J == 0) {
- List += I.FullName(true) + " ";
- VersionsList += string(Cache[I].CandVersion) + "\n";
- }
+ if (verset[MOD_INSTALL].find(Cand) != verset[MOD_INSTALL].end())
+ continue;
+
+ List += I.FullName(true) + " ";
+ VersionsList += string(Cache[I].CandVersion) + "\n";
}
ShowList(c1out,_("The following extra packages will be installed:"),List,VersionsList);