bugfix: update arh waterfall to properly detect armv7 vs arm64 origin/linux-releases
authorAJ ONeal <aj@therootcompany.com>
Wed, 24 Nov 2021 06:59:25 +0000 (06:59 +0000)
committerAJ ONeal <aj@therootcompany.com>
Wed, 24 Nov 2021 06:59:25 +0000 (06:59 +0000)
_webi/normalize.js

index 5fa9abb5895f3a04421ff287469d0a46518e3f0a..fe614bd42651245a3465075fa4ee54c7b3b682a0 100644 (file)
@@ -28,26 +28,37 @@ formats.forEach(function (name) {
 // evaluation order matters
 // (i.e. otherwise x86 and x64 can cross match)
 var arches = [
-  'amd64', // first and most likely match
+  // arm 7 cannot be confused with arm64
+  'armv7l',
+  // amd64 is more likely than arm64
+  'amd64',
+  // arm6 has the same prefix as arm64
+  'armv6l',
+  // arm64 is more likely than arm6, and should be the default
   'arm64',
   'x86',
   'ppc64le',
   'ppc64',
-  'armv7l',
-  'armv6l',
   's390x'
 ];
+// Used for detecting system arch from package download url, for example:
+//
+// https://git.com/org/foo/releases/v0.7.9/foo-aarch64-linux-musl.tar.gz
+// https://git.com/org/foo/releases/v0.7.9/foo-arm-linux-musleabihf.tar.gz
+// https://git.com/org/foo/releases/v0.7.9/foo-armv7-linux-musleabihf.tar.gz
+// https://git.com/org/foo/releases/v0.7.9/foo-x86_64-linux-musl.tar.gz
+//
 var archMap = {
+  armv7l: /(\b|_)(armv?7l?)/i,
   //amd64: /(amd.?64|x64|[_\-]64)/i,
   amd64:
     /(\b|_|amd|(dar)?win(dows)?|mac(os)?|linux|osx|x)64([_\-]?bit)?(\b|_)/i,
   //x86: /(86)(\b|_)/i,
+  armv6l: /(\b|_)(aarch32|armv?6l?)(\b|_)/i,
+  arm64: /(\b|_)((aarch|arm)64|arm)/i,
   x86: /(\b|_|amd|(dar)?win(dows)?|mac(os)?|linux|osx|x)(86|32)([_\-]?bit)(\b|_)/i,
   ppc64le: /(\b|_)(ppc64le)/i,
   ppc64: /(\b|_)(ppc64)(\b|_)/i,
-  arm64: /(\b|_)((aarch|arm)64|arm)/i,
-  armv7l: /(\b|_)(armv?7l)/i,
-  armv6l: /(\b|_)(aarch32|armv?6l)/i,
   s390x: /(\b|_)(s390x)/i
 };
 arches.forEach(function (name) {