diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2013-02-24 16:20:43 +0100 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2013-02-24 16:20:43 +0100 |
commit | 9bfd7b57d82285fd99ae1ae6147c22af15fdbea0 (patch) | |
tree | d95b3494c9d15fa1e8e316c54455aab67e4b81d8 /apt-pkg | |
parent | 0597dcd8fa8f933d8bf0d7fbea395408bf3b7e5d (diff) |
* 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.cc | 31 |
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) { |