Skip to content

Can support install from github url #1971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ahaoboy opened this issue Nov 16, 2024 · 12 comments
Open

Can support install from github url #1971

ahaoboy opened this issue Nov 16, 2024 · 12 comments

Comments

@ahaoboy
Copy link

ahaoboy commented Nov 16, 2024

Perhaps another tool could be developed based on cargo-binstall that could install the latest version of a program from a github url and the corresponding release page, but the two are very similar. Perhaps this installation method could support some private gitlab repositories?

cargo binstall https://github.com/awslabs/llrt
cargo binstall https://github.com/awslabs/llrt/releases
@ahaoboy
Copy link
Author

ahaoboy commented Nov 16, 2024

This installation method can mainly install some non-rust programs, but they have similar release names rules as rust programs.

cargo binstall https://github.com/quickjs-ng/quickjs/releases

@NobodyXu
Copy link
Member

Well cargo-bins-tall supports --git to install crates not released on crates.io and supports private github repositories as well.

We also support private cargo registry.

We haven't got support for gitlab yet or for non-rust crate, but I'd welcome any contribution and is willing to review them.

@ethanuppal
Copy link

If the crate is not on crates.io, cargo binstall fails. To reproduce:

  • FAILS: cargo binstall --git https://github.com/oxalica/nil nil
  • PASSES cargo install --git https://github.com/oxalica/nil nil

@ahaoboy
Copy link
Author

ahaoboy commented Apr 3, 2025

There are some tools that can install binaries directly from the repo url

https://github.com/houseabsolute/ubi

https://github.com/zyedidia/eget

https://github.com/easy-install/easy-install

@NobodyXu
Copy link
Member

NobodyXu commented Apr 3, 2025

The main problem is we don't know which version is the latest, I think we could solve this and get it working

@ethanuppal
Copy link

ethanuppal commented Apr 3, 2025

Yeah I'd really like to be able to use cargo binstall as a drop-in for cargo install everywhere

@NobodyXu
Copy link
Member

NobodyXu commented Apr 3, 2025

Yeah I'd really like to be able to use cargo binstall as a drop-in for cargo install everywhere

There's a catch though, cargo install --git just build it from source, while binstall has to find pre-built

So to make it work,

  • binstall could query GitHub for latest release
  • binstall could use git sha to look for release which doesn't sound reasonable
  • binstall can look for artifacts from github action, which is a bit hard

So I think query gh for latest release is the simplest and most reasonable to do

@ethanuppal
Copy link

I feel like it should just call cargo install --git on fallback

@benfrankel
Copy link

benfrankel commented Apr 30, 2025

Yeah this seems like a bug. At the very least it's surprising behavior.

cargo binstall --git=https://github.com/foo/bar quux can't find an appropriate release, so as a fallback it runs cargo install quux. In my use case, the quux it finds on crates.io is actually a different crate than the one I'm trying to install from the github url, so cargo-binstall falls back to trying to install the wrong crate from source (and it fails because there's no matching version).

@ethanuppal
Copy link

This is a 100% a bug that makes it hard to use cargo binstall.

@NobodyXu
Copy link
Member

NobodyXu commented May 1, 2025

The problem I was thinking is how we find the release artifacts

binstall could query GitHub based on version in Cargo.toml
binstall could use git sha to look for release which doesn't sound reasonable
binstall can look for artifacts from github action, which is a bit hard

I recon then first approach is probably the most reasonable one, simply skipping the crates.io lookup, and probably the simplest

@NobodyXu
Copy link
Member

When checking the code, I've realized that I've already implemented this long ago.

Running cargo binstall --git https://github.com/oxalica/nil nil gives me @ethanuppal :

 INFO resolve: Resolving package: 'nil'
 INFO Cloning with worktree::receiving pack: Enumerating objects → 1.2K objects
 INFO ℹCloning with worktree::receiving pack::create index file::indexing → done 1.2K objects in 0.06s (20.0K objects/s)
 INFO ℹCloning with worktree::receiving pack::create index file::decompressing → done 2.7MB in 0.06s (44.9MB/s)
 INFO ℹCloning with worktree::receiving pack::create index file::Resolving → done 1.2K objects in 0.11s (10.7K objects/s)
 INFO ℹCloning with worktree::receiving pack::create index file::Decoding → done 7.5MB in 0.11s (67.9MB/s)
 INFO ✓Cloning with worktree::receiving pack::create index file::writing index file → done 34.2kB in 0.00s (100.1MB/s)
 INFO ✓Cloning with worktree::receiving pack::create index file → done 1.2K objects in 0.17s (7.0K objects/s)
 INFO ℹCloning with worktree::receiving pack::read pack → done 555.2kB in 0.19s (3.0MB/s)
 INFO ℹCloning with worktree::receiving pack::checkout → done 191.0 files in 0.03s (6.8K files/s)
 INFO ℹCloning with worktree::receiving pack::writing → done 1.5MB in 0.03s (54.3MB/s)
 WARN Package does not specify repository, cargo-binstall cannot provide default pkg_url for it.
Please ask the upstream to provide it for target aarch64-apple-darwin.
 WARN Package does not specify repository, cargo-binstall cannot provide default pkg_url for it.
Please ask the upstream to provide it for target universal-apple-darwin.
 WARN Package does not specify repository, cargo-binstall cannot provide default pkg_url for it.
Please ask the upstream to provide it for target universal2-apple-darwin.
 WARN Package does not specify repository, cargo-binstall cannot provide default pkg_url for it.
Please ask the upstream to provide it for target x86_64-apple-darwin.
 WARN The package nil v0.0.0 will be installed from source (with cargo)
Do you wish to continue? [yes]/no
? yes^C WARN Installation cancelled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants