apt/apt-0.5.15cnc6-alt-apt-get-TryToInstall.patch

48 lines
1.9 KiB
Diff
Raw Normal View History

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;