summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2013-03-01 17:54:57 -0800
committerSteve Langasek <steve.langasek@canonical.com>2013-03-01 17:54:57 -0800
commitd70f2b7822fce220f85fe63f85fe920dad452d8a (patch)
treef4aa028252800f6e1d0b41da66601537f84b084e /apt-pkg
parent68225779d1337336707c33c0265fc537ae256813 (diff)
* 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)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/depcache.cc31
1 files changed, 31 insertions, 0 deletions
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)
{