]> git.saurik.com Git - apt.git/commitdiff
* cmdline/apt-get.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 23 Nov 2011 08:54:17 +0000 (09:54 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 23 Nov 2011 08:54:17 +0000 (09:54 +0100)
  - 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

cmdline/apt-get.cc
debian/changelog
test/integration/test-multiarch-foreign

index 763f0edad0638a013fcbda8e177455fe9e7aa998..ca1169401a7b488a0f8a3f3c01c959e51faae15b 100644 (file)
@@ -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;
                        }
index 0a66d257915660e626c3befc31e0ca2650256df8..3c0de2c624d34dd74191e402807b47bb6f2e518a 100644 (file)
@@ -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
 
index d0ad829a7ebe86e32041e8e8f9e3dd3ac02c86bc..332466d96530d99d7f87cfea8d16f012d4554b79 100755 (executable)
@@ -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