[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#718482: Acknowledgement (apt: CompareProviders ranks Priority above native architecture)



At David's request, here's a patch including a test case.

diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 2c6eb43..978a893 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1007,9 +1007,6 @@ struct CompareProviders {
 	 else if ((B->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important)
 	    return true;
       }
-      // higher priority seems like a good idea
-      if (AV->Priority != BV->Priority)
-	 return AV->Priority > BV->Priority;
       // prefer native architecture
       if (strcmp(A.Arch(), B.Arch()) != 0)
       {
@@ -1024,6 +1021,9 @@ struct CompareProviders {
 	    else if (*a == B.Arch())
 	       return true;
       }
+      // higher priority seems like a good idea
+      if (AV->Priority != BV->Priority)
+	 return AV->Priority > BV->Priority;
       // unable to decide…
       return A->ID < B->ID;
    }
diff --git a/test/integration/test-prefer-native-architecture-over-higher-priority b/test/integration/test-prefer-native-architecture-over-higher-priority
new file mode 100755
index 0000000..2e56963
--- /dev/null
+++ b/test/integration/test-prefer-native-architecture-over-higher-priority
@@ -0,0 +1,25 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'arm64'
+
+insertpackage 'unstable' 'm4' 'amd64' '1' 'Multi-Arch: foreign' 'optional'
+insertpackage 'unstable' 'm4' 'arm64' '1' 'Multi-Arch: foreign' 'standard'
+insertpackage 'unstable' 'autoconf' 'all' '1' 'Depends: m4'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+  m4
+The following NEW packages will be installed:
+  autoconf m4
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst m4 (1 unstable [amd64])
+Inst autoconf (1 unstable [all])
+Conf m4 (1 unstable [amd64])
+Conf autoconf (1 unstable [all])' aptget install autoconf -s

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


Reply to: