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

Added in commit 8b55ef8:
0.5.15cnc6-alt11

- apt-get: corrected virtual package remove algorithm (#6276).
- Updated default cdrom mount point (#6152).
This commit is contained in:
Gleb Fotengauer-Malinovskiy 2014-05-16 21:04:21 +04:00
parent 654307ad58
commit c67c739801
2 changed files with 14 additions and 51 deletions

View File

@ -1,47 +0,0 @@
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;

View File

@ -1277,13 +1277,19 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
}
}
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 Pkg,pkgDepCache &Cache,
_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 Pkg,pkgDepCache &Cache,
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;