From c883d993396a1140ecf344a0979e94f038ac13ca Mon Sep 17 00:00:00 2001 From: Andy Thompson Date: Fri, 5 Nov 2021 16:36:41 +0000 Subject: [PATCH] Fetch the correct architecture mutagen binary for the host In MacOS M1's case though amd64 is the host architecture, but support linux aarch64 still --- .../harness/scripts/latest-mutagen-release.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/_base/harness/scripts/latest-mutagen-release.php b/src/_base/harness/scripts/latest-mutagen-release.php index b5ace9ccd..454f282b3 100644 --- a/src/_base/harness/scripts/latest-mutagen-release.php +++ b/src/_base/harness/scripts/latest-mutagen-release.php @@ -22,9 +22,19 @@ throw new Exception('Could not find latest stable release.'); } +$goArchMap = [ + 'i386' => '386', + 'x86_64' => 'amd64', + 'aarch64' => 'arm64', + 'armv7l' => 'armv7', + 'armv6l' => 'armv6', +]; + $osFamily = strtolower(PHP_OS_FAMILY); -$releaseAssets = array_filter($latestStableRelease['assets'], function ($asset) use ($osFamily) { - return preg_match("/^mutagen_.*${osFamily}.*amd64.*/", $asset['name']) > 0; +$hostArch = php_uname('m'); +$goArch = $goArchMap[php_uname('m')] ?? $hostArch; +$releaseAssets = array_filter($latestStableRelease['assets'], function ($asset) use ($osFamily, $goArch) { + return preg_match("/^mutagen_.*${osFamily}.*${goArch}.*/", $asset['name']) > 0; }); $releaseAsset = reset($releaseAssets); if (!$releaseAsset) {