Skip to content

Commit

Permalink
If the platform's arch is "aarch64", this should also match "arm64"
Browse files Browse the repository at this point in the history
This fixes an issue with installing omegasort on an M1 Mac.
  • Loading branch information
autarch committed Oct 4, 2022
1 parent 7d39ea5 commit 3bea572
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.0.16 - 2022-10-04

- Fixed matching the "aarch64" architecture for macOS. At least with Go, these
binaries end up labeled as "arm64" instead of "aarch64", and `ubi` should
treat that as a match. Reported by Ajay Vijayakumar.

## 0.0.15 - 2022-09-05

- Added a `--self-upgrade` flag, which will use `ubi` to upgrade `ubi`. Note
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ fn arch_matcher() -> Result<Regex> {
debug!("current CPU architecture = {}", TARGET_ARCH.as_str());

#[cfg(target_arch = "aarch64")]
return Regex::new(r"(?i:(?:\b|_)aarch64(?:\b|_))").map_err(anyhow::Error::new);
return Regex::new(r"(?i:(?:\b|_)aarch64|arm64(?:\b|_))").map_err(anyhow::Error::new);

#[cfg(target_arch = "arm")]
return Regex::new(r"(?i:(?:\b|_)arm(?:v[0-9]+|64)?(?:\b|_))").map_err(anyhow::Error::new);
Expand Down
9 changes: 9 additions & 0 deletions tests/ubi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,15 @@ fn tests() -> Result<()> {
}
}

// The omegasort release for macOS on an M1 is named
// "omegasort_0.0.5_Darwin_arm64.tar.gz", but macOS reports its
// architecture as "aarch64". This was fixed in ubi 0.0.16.
run_test(
ubi.as_ref(),
&["--project", "https://github.com/houseabsolute/omegasort"],
make_exe_pathbuf(&["bin", "omegasort"]),
)?;

Ok(())
}

Expand Down

0 comments on commit 3bea572

Please sign in to comment.