diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-11-23 09:54:17 +0100 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-11-23 09:54:17 +0100 |
commit | 286afa36886b60bea0a17d244f8bddad938f27cf (patch) | |
tree | 37843aed0e25c7c4c8cf8c8b0896f9b044827c3c | |
parent | 2b5c35c7bb915dbd46fefd7c79f05364ba22f93b (diff) |
* cmdline/apt-get.cc:
- ignore foreign architectures if we check if a provides has only one
resolver as it's basically the same for the user, so no need to choose
-rw-r--r-- | cmdline/apt-get.cc | 13 | ||||
-rw-r--r-- | debian/changelog | 5 | ||||
-rwxr-xr-x | test/integration/test-multiarch-foreign | 22 |
3 files changed, 39 insertions, 1 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 763f0edad..ca1169401 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -742,6 +742,19 @@ public: Prov = PPkg; found_one = true; } else if (PPkg != Prov) { + // same group, so it's a foreign package + if (PPkg->Group == Prov->Group) { + // do we already have the requested arch? + if (strcmp(Pkg.Arch(), Prov.Arch()) == 0 || + strcmp(Prov.Arch(), "all") == 0 || + unlikely(strcmp(PPkg.Arch(), Prov.Arch()) == 0)) // packages have only on candidate, but just to be sure + continue; + // see which architecture we prefer more and switch to it + std::vector<std::string> archs = APT::Configuration::getArchitectures(); + if (std::find(archs.begin(), archs.end(), PPkg.Arch()) < std::find(archs.begin(), archs.end(), Prov.Arch())) + Prov = PPkg; + continue; + } found_one = false; // we found at least two break; } diff --git a/debian/changelog b/debian/changelog index 0a66d2579..3c0de2c62 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,8 +18,11 @@ apt (0.8.16~exp8) experimental; urgency=low commands accepting lists of packages, e.g. policy (Closes: #625960) * apt-pkg/depcache.cc: - prefer native providers over foreigns even if the chain is foreign + * cmdline/apt-get.cc: + - ignore foreign architectures if we check if a provides has only one + resolver as it's basically the same for the user, so no need to choose - -- David Kalnischkies <kalnischkies@gmail.com> Wed, 23 Nov 2011 00:18:35 +0100 + -- David Kalnischkies <kalnischkies@gmail.com> Wed, 23 Nov 2011 09:52:20 +0100 apt (0.8.16~exp7) experimental; urgency=low diff --git a/test/integration/test-multiarch-foreign b/test/integration/test-multiarch-foreign index d0ad829a7..332466d96 100755 --- a/test/integration/test-multiarch-foreign +++ b/test/integration/test-multiarch-foreign @@ -126,3 +126,25 @@ Inst bar:armel (1.0 unstable [armel]) Inst cool-bar (1.0 unstable [amd64]) Conf bar:armel (1.0 unstable [armel]) Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:armel -s + +testequal "Reading package lists... +Building dependency tree... +Note, selecting 'bar' instead of 'bar-provider' +The following NEW packages will be installed: + bar cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [amd64]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar (1.0 unstable [amd64]) +Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider -s -q=0 + +testequal "Reading package lists... +Building dependency tree... +Note, selecting 'bar:i386' instead of 'bar-provider:i386' +The following NEW packages will be installed: + bar:i386 cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar:i386 (1.0 unstable [i386]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar:i386 (1.0 unstable [i386]) +Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider:i386 -s -q=0 |