summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-11-23 19:02:51 +0100
committerJulian Andres Klode <jak@debian.org>2017-02-22 16:53:45 +0100
commit44c0cf26f9768787ae2ba3e981e862f497c3df30 (patch)
tree0042027d986951259f84259fb858203928a0332f /apt-pkg
parentb75c6dc6018ce22a7419911a66e994e502c4497f (diff)
don't perform implicit crossgrades involving M-A:same
dpkg stumbles over these (#844300) and we haven't dropped 'easier' removes to be implicit and to be scheduled by dpkg by default so far so we shouldn't push the decision in such cases to dpkg either. (cherry picked from commit 53f3fc59f4eb37eea57bbde53fb75f2e15af0378)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc25
1 files changed, 22 insertions, 3 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index abf91fe2a..d76b59449 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1525,11 +1525,30 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
continue;
auto const Grp = I->Pkg.Group();
- size_t installedInstances = 0;
+ size_t installedInstances = 0, wannabeInstances = 0;
+ bool multiArchInstances = false;
for (auto Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
- if (Pkg->CurrentVer != 0 || Cache[Pkg].Install())
+ {
+ if (Pkg->CurrentVer != 0)
+ {
++installedInstances;
- if (installedInstances == 2)
+ if (Cache[Pkg].Delete() == false)
+ ++wannabeInstances;
+ }
+ else if (PackageOps.find(Pkg.FullName()) != PackageOps.end())
+ ++wannabeInstances;
+ if (multiArchInstances == false)
+ {
+ auto const V = Cache[Pkg].InstVerIter(Cache);
+ if (V.end() == false && (Pkg->CurrentVer == 0 || V != Pkg.CurrentVer()))
+ multiArchInstances = ((V->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same);
+ }
+ }
+ /* theoretically the installed check would be enough as some wannabe will
+ be first and hence be the crossgrade we were looking for, but #844300
+ prevents this so we keep these situations explicit removes.
+ It is also the reason why neither of them can be a M-A:same package */
+ if (installedInstances == 1 && wannabeInstances == 1 && multiArchInstances == false)
{
auto const FirstInstall = std::find_if_not(I, List.end(),
[](Item const &i) { return i.Op == Item::Remove || i.Op == Item::Purge; });