apt/apt-0.5.15cnc6-alt-apt-get-TryToInstall.patch
Dmitry V. Levin 8b55ef8c63 0.5.15cnc6-alt11
- apt-get: corrected virtual package remove algorithm (#6276).
- Updated default cdrom mount point (#6152).
2005-05-18 17:03:04 +00:00

48 lines
1.9 KiB
Diff

diff -upk.orig apt-0.5.15cnc6.orig/cmdline/apt-get.cc apt-0.5.15cnc6/cmdline/apt-get.cc
--- apt-0.5.15cnc6.orig/cmdline/apt-get.cc 2005-05-18 20:49:15 +0400
+++ apt-0.5.15cnc6/cmdline/apt-get.cc 2005-05-18 20:57:53 +0400
@@ -1277,13 +1277,19 @@ bool TryToInstall(pkgCache::PkgIterator
}
}
vector<string> GoodSolutionNames;
- for (unsigned int i = 0; i != GoodSolutions.size(); i++)
+ unsigned int GoodSolutionsInstalled = 0, GoodSolutionInstallNumber = 0;
+ for (unsigned int i = 0; i < GoodSolutions.size(); i++)
{
pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[i]);
GoodSolutionNames.push_back(GoodPkg.Name());
+ if (GoodPkg.CurrentVer().end() == false)
+ {
+ GoodSolutionsInstalled++;
+ GoodSolutionInstallNumber = i;
+ }
}
#ifdef WITH_LUA
- if (GoodSolutions.size() > 1)
+ if (GoodSolutions.size() > 1 && !(Remove && GoodSolutionsInstalled == 1))
{
vector<string> VS;
_lua->SetDepCache(&Cache);
@@ -1308,7 +1314,8 @@ bool TryToInstall(pkgCache::PkgIterator
_lua->ResetCaches();
}
#endif
- if (GoodSolutions.size() == 1)
+ if (GoodSolutions.size() == 1 ||
+ ((GoodSolutions.size() > 1) && Remove && GoodSolutionsInstalled == 1))
{
pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[0]);
ioprintf(c1out,_("Selecting %s for '%s'\n"),
@@ -1336,7 +1343,10 @@ bool TryToInstall(pkgCache::PkgIterator
c1out << " " << GoodSolutionNames[i]
<< " " << Cache[GoodPkg].CandVersion << endl;
}
- c1out << _("You should explicitly select one to install.") << endl;
+ if (Remove)
+ c1out << _("You should explicitly select one to remove.") << endl;
+ else
+ c1out << _("You should explicitly select one to install.") << endl;
_error->Error(_("Package %s is a virtual package with multiple "
"good providers.\n"), Pkg.Name());
return false;