Skip to content
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

taplo install failing because --locked isnt default for bin crates #970

Open
jayvdb opened this issue Oct 23, 2023 · 6 comments
Open

taplo install failing because --locked isnt default for bin crates #970

jayvdb opened this issue Oct 23, 2023 · 6 comments
Assignees

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Oct 23, 2023

Describe The Bug

The format-toml task uses taplo, which is broken atm. A new release is pending with tamasfe/taplo#473 , but that is taking a while to be finished.

However the real solution is to install bin crates using --locked.
Also it is weird that the default task is using --force - if the appropriate version is already installed, why force a re-install??

The workaround atm is to add CARGO_MAKE_CRATE_INSTALLATION_LOCKED = "true" to the env section, but that should be the default for bin crates. c.f. https://stackoverflow.com/questions/76989793/why-cargo-install-needs-locked-to-work, https://doc.rust-lang.org/cargo/commands/cargo-install.html#dealing-with-the-lockfile

To Reproduce

Use "format-toml" task.

Error Stack

[cargo-make] INFO - Execute Command: "rustup" "run" "nightly" "cargo" "install" "--force" "taplo-cli"
    Updating crates.io index
  Installing taplo-cli v0.8.1
    Updating crates.io index
error: failed to compile `taplo-cli v0.8.1`, intermediate artifacts can be found at `/tmp/cargo-installf1VxJL`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Caused by:
  failed to select a version for the requirement `ahash = "^0.7.6"`
  candidate versions found which didn't match: 0.8.5, 0.8.4, 0.4.1, ...
  location searched: crates.io index
  required by package `taplo v0.12.1`
      ... which satisfies dependency `taplo = "^0.12.1"` of package `taplo-cli v0.8.1`
  perhaps a crate was updated and forgotten to be re-vendored?
[cargo-make] ERROR - Error while executing command, exit code: 101
[cargo-make] WARN - Build Failed.

Code Sample

@sagiegurari
Copy link
Owner

cargo-make defaults do not force the installation. it adds force only if it needs to install (due to crate not already installed or wrong version installed). so it doesn't install it again and again.

The current definition is at: https://github.com/sagiegurari/cargo-make/blob/36c93a6134ca4c795941576fdf8b7b4a2c19f9ae/src/lib/descriptor/makefiles/toml.toml#L5C1-L18C1

basically:

install_crate = { crate_name = "taplo-cli", binary = "taplo", test_arg = [
  "--help",
] }

so you can modify that definition in your makefile to define the specific version you want and that should solve it for you.

@jayvdb
Copy link
Contributor Author

jayvdb commented Nov 4, 2023

My apology if I incorrectly concluded that --forced is being used unnecessarily.

However, this issue is about not using --locked

@sagiegurari
Copy link
Owner

if you add a specific version to the above definition, it will add the locked automatically and no need to define the env var. sorry if the docs that mentioned it aren't clear enough

@jayvdb
Copy link
Contributor Author

jayvdb commented Nov 4, 2023

I would like cargo make to install the latest version, using --locked.

@sagiegurari
Copy link
Owner

thats something i think I can add, or you can PR that. wdyt?

@jayvdb
Copy link
Contributor Author

jayvdb commented Nov 8, 2023

great. I can PR it.

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

No branches or pull requests

2 participants