Przeglądaj źródła

* 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 14 lat temu
rodzic
commit
286afa3688
3 zmienionych plików z 39 dodań i 1 usunięć
  1. 13 0
      cmdline/apt-get.cc
  2. 4 1
      debian/changelog
  3. 22 0
      test/integration/test-multiarch-foreign

+ 13 - 0
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;
 			}

+ 4 - 1
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
 

+ 22 - 0
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