-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
The --bin flag on the install subcommand doesn't work #4830
Comments
All the packages are installed using install function in In the command,
@RazrFalcon, |
@ishanjain28 thanks, that worked. |
I've ran into the same problem: cargo install --bin cargo-deb --git https://github.com/mmstick/cargo-deb --force
Updating git repository `https://github.com/mmstick/cargo-deb`
error: multiple packages with binaries found: cargo-deb, example I see from this issue that skipping
Things that could help:
|
This comment was marked as resolved.
This comment was marked as resolved.
Just copying those suggestions here:
|
Here's another possible solution:
This second behaviour was a bit surprising, but I think it's actually a good thing. |
I’m new to rust but my understanding is a package (cargo.toml) can have multiple crates in the form of 1 library and/or multiple binaries. (ref: The Book section 7.1 2nd paragraph). But crate is also used to refer to a published package on crates.io. And since a package can contain multiple binaries i would assume a published crate on crates.io can as well. So there is a conflict of what this term crate means. The cargo install command help is incorrect in that it states the default arg is a crate. If you are installing a crate from crates.io this is true. But if you calling install with either —path or —git option the default arg is actually a package. I’m referring to this being a package since it is referring to the name property inside a cargo.toml file, not a published crate. Additionally the error messages such as the “multiple package error” in the original post refer to it as a package not a crate. cargo install —help: When using the path option, the path must point to the folder with the package. So a package is not required, as there can only be one cargo.toml per folder. But if provided, the package most match the name of the one in the path provided. When using the git option, the package is required only when there are multiple packages in the repo. It will not default to the root package. And a path can not be provided with a git option to point to a subfolder containing a package. I would like to do the following if its agreed as valid solution: |
I'm also good with any of the suggestions made in #8958. |
I think we've used --path with a workspace containing multiple library and binary packages. But I'd have to double-check how we made it work. |
`cargo install --git` multiple packages with binaries found hint ### What does this PR try to resolve? The issues discussed in: #4830 namely this one: > 4. a multiple packages with binaries found error should give users a hint about how to specify a single crate I think improving the error message to provide a suggestion is a simple change that would help a lot of people when this happens, sorry if I'm out of line for just opening a PR here :) ### Before cargo 1.68.0 (115f345 2023-02-26) ![image](https://user-images.githubusercontent.com/14891742/224546157-d9b48bfd-f896-4fd1-9f0a-e04a3ad60ae2.png) ### After ![image](https://user-images.githubusercontent.com/14891742/224546182-d4b451ae-1b28-41b6-9d74-db860532512b.png) ### Additional information I added in a related test documenting existing behaviours * multiple_examples_error: "multiple packages with examples found" (i.e. not "binaries") I added these tests which aren't necessarily related to this PR, but could be considered if the behaviour were to change * `multiple_binaries_deep_select_uses_package_name`: it uses the name, not the path. Is this a problem for crates with the same name? * `multiple_binaries_in_selected_package_installs_all`: so `--bins` is implied when a package is specified? * `multiple_binaries_in_selected_package_with_bin_option_installs_only_one`: demonstrates a use case where `--bin` and `[crate]` are both used
`cargo install --git` multiple packages with binaries found hint ### What does this PR try to resolve? The issues discussed in: #4830 namely this one: > 4. a multiple packages with binaries found error should give users a hint about how to specify a single crate I think improving the error message to provide a suggestion is a simple change that would help a lot of people when this happens, sorry if I'm out of line for just opening a PR here :) ### Before cargo 1.68.0 (115f345 2023-02-26) ![image](https://user-images.githubusercontent.com/14891742/224546157-d9b48bfd-f896-4fd1-9f0a-e04a3ad60ae2.png) ### After ![image](https://user-images.githubusercontent.com/14891742/224546182-d4b451ae-1b28-41b6-9d74-db860532512b.png) ### Additional information I added in a related test documenting existing behaviours * multiple_examples_error: "multiple packages with examples found" (i.e. not "binaries") I added these tests which aren't necessarily related to this PR, but could be considered if the behaviour were to change * `multiple_binaries_deep_select_uses_package_name`: it uses the name, not the path. Is this a problem for crates with the same name? * `multiple_binaries_in_selected_package_installs_all`: so `--bins` is implied when a package is specified? * `multiple_binaries_in_selected_package_with_bin_option_installs_only_one`: demonstrates a use case where `--bin` and `[crate]` are both used
- That a version is accepted - That you are selecting from the source a package which led to part of the confusion in rust-lang#4830 I wonder if we should rename our `CRATE` value names to `PKG`/`PACKAGE`
- That a version is accepted - That you are selecting from the source a package which led to part of the confusion in rust-lang#4830 I wonder if we should rename our `CRATE` value names to `PKG`/`PACKAGE`
- That a version is accepted - That you are selecting from the source a package which led to part of the confusion in rust-lang#4830 I wonder if we should rename our `CRATE` value names to `PKG`/`PACKAGE`
- That a version is accepted - That you are selecting from the source a package which led to part of the confusion in rust-lang#4830 I wonder if we should rename our `CRATE` value names to `PKG`/`PACKAGE`
- That a version is accepted - That you are selecting from the source a package which led to part of the confusion in rust-lang#4830 I wonder if we should rename our `CRATE` value names to `PKG`/`PACKAGE`
fix(help):Clarify install's positional ### What does this PR try to resolve? - That a version is accepted - That you are selecting from the source a package which led to part of the confusion in #4830 I wonder if we should rename our `CRATE` value names to `PKG`/`PACKAGE` While doing this, I decided to fix the inconsistency in how we handle value names in help. ### How should we test and review this PR? ### Additional information
% cargo install --force --bin svgcleaner --git https://github.com/RazrFalcon/svgcleaner Updating git repository `https://github.com/RazrFalcon/svgcleaner` error: multiple packages with binaries found: docgen, files-testing, stats, svgcleaner, use_as_lib
The text was updated successfully, but these errors were encountered: