From d70f2b7822fce220f85fe63f85fe920dad452d8a Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Fri, 1 Mar 2013 17:54:57 -0800 Subject: * Cherry-pick from David's sid branch to fix a multiarch library installation problem: * apt-pkg/depcache.cc: - prefer to install packages which have an already installed M-A:same sibling while choosing providers (LP: #1130419) --- apt-pkg/depcache.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'apt-pkg/depcache.cc') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 2ec346f0b..a48cd8b0c 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -951,6 +951,37 @@ struct CompareProviders { { pkgCache::PkgIterator const A = AV.ParentPkg(); pkgCache::PkgIterator const B = BV.ParentPkg(); + // Prefer MA:same packages if other architectures for it are installed + if ((AV->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same || + (BV->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same) + { + bool instA = false; + if ((AV->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same) + { + pkgCache::GrpIterator Grp = A.Group(); + for (pkgCache::PkgIterator P = Grp.PackageList(); P.end() == false; P = Grp.NextPkg(P)) + if (P->CurrentVer != 0) + { + instA = true; + break; + } + } + bool instB = false; + if ((BV->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same) + { + pkgCache::GrpIterator Grp = B.Group(); + for (pkgCache::PkgIterator P = Grp.PackageList(); P.end() == false; P = Grp.NextPkg(P)) + { + if (P->CurrentVer != 0) + { + instB = true; + break; + } + } + } + if (instA != instB) + return instA == false; + } // Prefer packages in the same group as the target; e.g. foo:i386, foo:amd64 if (A->Group != B->Group) { -- cgit v1.2.3