houseabsolute / ubi

The Universal Binary Installer
Apache License 2.0
190 stars 6 forks source link

Cannot find release for sharkdp/bat on ARM Macs #44

Closed oalders closed 1 year ago

oalders commented 1 year ago

I was wondering if you had any thoughts on this one. For sharkdp/bat ubi will DTRT on my Linux machines and on my older Mac. On my new Mac, it comes up empty. I guess this is because bat ships with only one Mac binary, which appears to run fine on both of my macs.

My solution is to install via URL using https://github.com/sharkdp/bat/releases/download/v0.23.0/bat-v0.23.0-x86_64-apple-darwin.tar.gz

I was initially hoping that --matching x86_64-apple-darwin would have done the trick, but since there are 0 matches on the architecture, this doesn't work. Maybe a --matching-fallback or something would help in this case?

autarch commented 1 year ago

I think it might need to do some special casing for macOS to fall back to downloading the x86 release if there's no arm release.

oalders commented 1 year ago

That sounds good.

autarch commented 1 year ago

There's a macos-arm branch that implements this. Can you try this binary built from that branch and let me know if it works as expected for you? https://github.com/houseabsolute/ubi/suites/15266122330/artifacts/872071280

oalders commented 1 year ago

Looks great. Thanks!

$ ubi  --debug --project sharkdp/bat --in ~/local/bin/ 2>&1 | pbcopy
[ubi::ubi][DEBUG] Parsed --project sharkdp/bat = sharkdp / bat
[ubi::ubi][DEBUG] exe name = bat
[ubi::ubi][DEBUG] matching = 
[ubi::ubi][DEBUG] install path = /Users/olaf/local/bin/bat
[reqwest::connect][DEBUG] starting new connection: https://api.github.com/
[ubi::ubi][DEBUG] current OS = macos
[ubi::ubi][DEBUG] matching assets against OS using (?i:(?:\b|_)(?:darwin|macos|osx)(?:\b|_))
[ubi::ubi][DEBUG] current CPU architecture = aarch64
[ubi::ubi][DEBUG] matching assets against CPU architecture using (?ix)
        (?:
            \b
            |
            _
        )
        (?:
            aarch_?64
            |
            arm_?64
            |
            x86[_-]64
            |
            x64
            |
            amd64
        )
        (?:
            \b
            |
            _
        )

[ubi::ubi][DEBUG] matching against asset name = bat-musl_0.23.0_amd64.deb
[ubi::ubi][DEBUG] it appears to have an invalid extension
[ubi::ubi][DEBUG] matching against asset name = bat-musl_0.23.0_i686.deb
[ubi::ubi][DEBUG] it appears to have an invalid extension
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-aarch64-unknown-linux-gnu.tar.gz
[ubi::ubi][DEBUG] does not match our OS
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-arm-unknown-linux-gnueabihf.tar.gz
[ubi::ubi][DEBUG] does not match our OS
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-arm-unknown-linux-musleabihf.tar.gz
[ubi::ubi][DEBUG] does not match our OS
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-i686-pc-windows-msvc.zip
[ubi::ubi][DEBUG] does not match our OS
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-i686-unknown-linux-gnu.tar.gz
[ubi::ubi][DEBUG] does not match our OS
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-i686-unknown-linux-musl.tar.gz
[ubi::ubi][DEBUG] does not match our OS
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-x86_64-apple-darwin.tar.gz
[ubi::ubi][DEBUG] matches our OS
[ubi::ubi][DEBUG] matches our CPU architecture
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-x86_64-pc-windows-gnu.zip
[ubi::ubi][DEBUG] does not match our OS
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-x86_64-pc-windows-msvc.zip
[ubi::ubi][DEBUG] does not match our OS
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-x86_64-unknown-linux-gnu.tar.gz
[ubi::ubi][DEBUG] does not match our OS
[ubi::ubi][DEBUG] matching against asset name = bat-v0.23.0-x86_64-unknown-linux-musl.tar.gz
[ubi::ubi][DEBUG] does not match our OS
[ubi::ubi][DEBUG] matching against asset name = bat_0.23.0_amd64.deb
[ubi::ubi][DEBUG] it appears to have an invalid extension
[ubi::ubi][DEBUG] matching against asset name = bat_0.23.0_arm64.deb
[ubi::ubi][DEBUG] it appears to have an invalid extension
[ubi::ubi][DEBUG] matching against asset name = bat_0.23.0_armhf.deb
[ubi::ubi][DEBUG] it appears to have an invalid extension
[ubi::ubi][DEBUG] matching against asset name = bat_0.23.0_i686.deb
[ubi::ubi][DEBUG] it appears to have an invalid extension
[ubi::ubi][DEBUG] only found one candidate asset
[ubi::ubi][DEBUG] picked asset from matches named bat-v0.23.0-x86_64-apple-darwin.tar.gz
[ubi::ubi][DEBUG] picked asset named bat-v0.23.0-x86_64-apple-darwin.tar.gz
[ubi::ubi][DEBUG] downloading asset from https://api.github.com/repos/sharkdp/bat/releases/assets/100891186
[reqwest::connect][DEBUG] starting new connection: https://api.github.com/
[reqwest::async_impl::client][DEBUG] redirecting 'https://api.github.com/repos/sharkdp/bat/releases/assets/100891186' to 'https://objects.githubusercontent.com/github-production-release-asset-2e65be/130464961/52a50b71-fe88-4e31-880c-b6459d440071?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230819%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230819T230859Z&X-Amz-Expires=300&X-Amz-Signature=df7ba7134ae9ef890765e0e599ee556d10d676c73ad162ce9a29a6659b0e1195&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=130464961&response-content-disposition=attachment%3B%20filename%3Dbat-v0.23.0-x86_64-apple-darwin.tar.gz&response-content-type=application%2Foctet-stream'
[reqwest::connect][DEBUG] starting new connection: https://objects.githubusercontent.com/
[ubi::ubi][DEBUG] archive path is /var/folders/p6/h8_m7lg10fb8vz2rm_x_sgzm0000gn/T/.tmp3yRYXc/bat-v0.23.0-x86_64-apple-darwin.tar.gz
[ubi::ubi][DEBUG] extracting binary from tarball at /var/folders/p6/h8_m7lg10fb8vz2rm_x_sgzm0000gn/T/.tmp3yRYXc/bat-v0.23.0-x86_64-apple-darwin.tar.gz
[ubi::ubi][DEBUG] found tarball entry with path bat-v0.23.0-x86_64-apple-darwin/CHANGELOG.md
[ubi::ubi][DEBUG] found tarball entry with path bat-v0.23.0-x86_64-apple-darwin/LICENSE-APACHE
[ubi::ubi][DEBUG] found tarball entry with path bat-v0.23.0-x86_64-apple-darwin/LICENSE-MIT
[ubi::ubi][DEBUG] found tarball entry with path bat-v0.23.0-x86_64-apple-darwin/README.md
[ubi::ubi][DEBUG] found tarball entry with path bat-v0.23.0-x86_64-apple-darwin/autocomplete/bat.bash
[ubi::ubi][DEBUG] found tarball entry with path bat-v0.23.0-x86_64-apple-darwin/autocomplete/bat.zsh
[ubi::ubi][DEBUG] found tarball entry with path bat-v0.23.0-x86_64-apple-darwin/autocomplete/_bat.ps1
[ubi::ubi][DEBUG] found tarball entry with path bat-v0.23.0-x86_64-apple-darwin/autocomplete/bat.fish
[ubi::ubi][DEBUG] found tarball entry with path bat-v0.23.0-x86_64-apple-darwin/bat
[ubi::ubi][DEBUG] extracting tarball entry to /Users/olaf/local/bin/bat
[ubi::ubi][INFO] Installed binary into /Users/olaf/local/bin/bat
autarch commented 1 year ago

Done in v0.0.27.