nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

Get registry to use from config.toml #164

Closed qwerty01 closed 2 years ago

qwerty01 commented 3 years ago

cargo-update currently has the index url hard-coded, but sometimes users will have a separate index configured at ~/.cargo/config.toml

qwerty01 commented 3 years ago

Oh I misread part of the code, looks like it's not hard-coded, but I'm not sure why it's not getting the right url.

My config.toml looks like this:

[source.crates-io]
registry = '[local registry]'

and cargo correctly pulls from the local registry, but cargo-update still pulls from github.

Logarithmus commented 2 years ago

@qwerty01 the implementation is a bit messed up, looks like the author got custom registries & sources replacements mixed, which are different concepts. I've just started fixing it though, hope to finish it & file a PR on this weekend.

nabijaczleweli commented 2 years ago

v8.0.0 pulls configuration from .cargo/config and .cargo/config.toml now, so this may well be fixed?

Logarithmus commented 2 years ago

@nabijaczleweli Release v8.0.0 fixed config.toml, but not the registries. I have a custom private registry (not a mirror of crates.io, but containing some in-house developed crates) in my cargo/config.toml, like this:

[registries]
sample-text = { index = "https://dl.cloudsmith.io/basic/sample-text/private/cargo/index.git" }

And when I run cargo install-update --all (release v8.0.0), I still get this:

Couldn't get registry for some-crate: Non-crates.io registry specified and
https://dl.cloudsmith.io/basic/sample-text/private/cargo/index.git couldn't be found in the config file
at .../config.toml. Due to a Cargo limitation we will not be able to install from there until it's given a [source.NAME] in that file!.

There are 2 distinct concepts in cargo: registries & source replacement. Looking at the source code & an error message, seems you have them mixed up. I don't have source replacements, but I have a custom registry. https://doc.rust-lang.org/cargo/reference/registries.html https://doc.rust-lang.org/cargo/reference/source-replacement.html

P. S. Sorry for failing to hold my promise of working on the fix 12 days ago, I'm a busy person :(

nabijaczleweli commented 2 years ago

@qwerty01 can you try the current master branch (at least af660ba6387949efca93ad5d33a48ba850646857)?

nabijaczleweli commented 2 years ago

Absent a response, released in v8.1.0.