feat: Install via cargo binstall #583

Merged
wetneb merged 2 commits from wetneb/mergiraf:binstall into main 2025-09-09 15:39:27 +02:00
Owner

It provides an easier way to install crates without compiling them
locally.

It provides an easier way to install crates without compiling them locally.
feat: Install via cargo binstall
All checks were successful
/ test (pull_request) Successful in 44s
c56a1e75f8
It provides an easier way to install crates without compiling them
locally.
@ -122,0 +123,4 @@
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }_{ target }{ archive-suffix }"
bin-dir = "{ bin }{ binary-ext }"
pkg-fmt = "tgz"
Owner

I think this won't work, because our links looks like this:

https://codeberg.org/mergiraf/mergiraf/releases/download/v0.14.0/mergiraf_x86_64-unknown-linux-gnu.tar.gz

Whereas, AFAICT from the docs, pkg-fmt = "tgz" sets archive-extension to .tgz.

But if I try to do that for the link above:

https://codeberg.org/mergiraf/mergiraf/releases/download/v0.14.0/mergiraf_x86_64-unknown-linux-gnu.tgz

I get a 404.

We should probably specify archive-suffix = ".tar.gz" explicitly

I think this won't work, because our links looks like this: > https://codeberg.org/mergiraf/mergiraf/releases/download/v0.14.0/mergiraf_x86_64-unknown-linux-gnu.tar.gz Whereas, AFAICT from [the docs](https://github.com/cargo-bins/cargo-binstall/blob/main/SUPPORT.md#support-for-cargo-binstall), `pkg-fmt = "tgz"` sets `archive-extension` to `.tgz`. But if I try to do that for the link above: > https://codeberg.org/mergiraf/mergiraf/releases/download/v0.14.0/mergiraf_x86_64-unknown-linux-gnu.tgz I get a 404. We should probably specify `archive-suffix = ".tar.gz"` explicitly
Author
Owner

I also wondered about it. I tried it with cargo binstall --manifest-path . mergiraf@0.14.0 and it seemed to work like this, but I'm not opposed to adding it explicitly. We'll probably need to override it for windows then.

I also wondered about it. I tried it with `cargo binstall --manifest-path . mergiraf@0.14.0` and it seemed to work like this, but I'm not opposed to adding it explicitly. We'll probably need to override it for windows then.
Owner

It looks like cargo-binstall does try to ping the .tar.gz version of the URL after .tgz fails, so it would eventually get to the correct link, but even during my short experimentation I started getting a bunch of "Too many requests" responses, so I think it's good to be more explicit, to both save time for the cargo-binstall users, and to avoid annoying Codeberg's servers too much.

It looks like `cargo-binstall` does try to ping the `.tar.gz` version of the URL after `.tgz` fails, so it would _eventually_ get to the correct link, but even during my short experimentation I started getting a bunch of "Too many requests" responses, so I think it's good to be more explicit, to both save time for the `cargo-binstall` users, and to avoid annoying Codeberg's servers too much.
ada4a marked this conversation as resolved
Cargo.toml Outdated
@ -122,0 +124,4 @@
pkg-url = "{ repo }/releases/download/v{ version }/{ name }_{ target }{ archive-suffix }"
bin-dir = "{ bin }{ binary-ext }"
pkg-fmt = "tgz"
disabled-strategies = ["quick-install", "compile"]
Owner

These are shown in the documentation example, but I don't think we really should specify them? WDYT?

These _are_ shown in the documentation example, but I don't think we really should specify them? WDYT?
Add archive-suffix, remove disabled-strategies
All checks were successful
/ test (pull_request) Successful in 45s
7c54259cb7
ada4a approved these changes 2025-09-09 14:05:28 +02:00
wetneb merged commit 89b0c31c9b into main 2025-09-09 15:39:27 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: mergiraf/mergiraf#583
No description provided.