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

crates-io mirror support #515

Closed
royb3 opened this issue May 22, 2023 · 1 comment · Fixed by #520
Closed

crates-io mirror support #515

royb3 opened this issue May 22, 2023 · 1 comment · Fixed by #520
Assignees
Labels
enhancement New feature or request

Comments

@royb3
Copy link

royb3 commented May 22, 2023

We have a mirror for crates-io, which we have configured in our .cargo/config like this:

[source.mirror]
registry = "http://crates-mirror"

[source.crates-io]
replace-with = "mirror"

The cargo.lock still references crates-io, for example:

[[package]]
name = "serde_json"
version = "1.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
dependencies = [
 "itoa",
 "ryu",
 "serde",
]

I would expect that cargo deny could figure out that crates-io was replaced with a mirror and use the mirror registry instead. But on an air gapped network, it still tries to fetch the crates from crates-io.

It does this to resolve if a yanked version of a crate is used, all other functions seem to work as expected.

Would it be possible to add support mirrors as configured in the local .cargo/config files?

@royb3 royb3 added the enhancement New feature or request label May 22, 2023
@dsully
Copy link
Contributor

dsully commented Jun 21, 2023

I'm in need of this as well.

@Jake-Shadle Jake-Shadle self-assigned this Jul 13, 2023
Jake-Shadle added a commit that referenced this issue Jul 25, 2023
This is a massive refactor that should be split up into multiple PRs,
but I am lazy, so that won't happen.

## `crates-index` -> `tame-index`

The `crates-index` crate had a problematic API that lead to duplicating
functionality present in the crate because it wasn't exposed publicly,
and was actually causing massive slowdowns when running cargo-deny in
eg. CI since `krates` was downloading the entire git index because of
how the default functionality in `crates-index` worked, thus I made
[`tame-index`](https://github.com/EmbarkStudios/tame-index) to better
suit the needs of this crate, as well as
[`cargo-fetcher`](https://github.com/EmbarkStudios/cargo-fetcher). Also,
it is now unfortunately
[unmaintained](frewsxcv/rust-crates-index#132).

This also means that scenarios such as #515 are _much_ easier to both
implement and support due to better testing since `tame-index` supports
[local
registry](https://doc.rust-lang.org/cargo/reference/source-replacement.html#local-registry-sources)
source replacement.

## `git2` -> `gix`

`tame-index` uses `gix` for its git implementation because
git2/openssl/openssh are...let's just say I'm not a fan. This PR now
replaces the usage of `git2`, for syncing advisory databases, with `gix`
removing (and adding) a lot of dependencies.

Resolves: #361
Resolves: #515
Resolves: #522
Resolves: #446 (I think this was already resolved in a previous version,
but the issue was still open)
Resolves: #435 (I have no idea if this is actually fixed, but I have no
repro, and we aren't using git2 any longer, so maybe?)
Resolves: #439 (I was never able to repro, but this is no longer
applicable as we never fetch a specific branch for a git remote for
either advisory databases nor git registry indices, but rather just use
the remote `FETCH_HEAD`)
Closes: #295 (This PR removes cargo support altogether, as it is
currently tied to openssl/curl/etc and not currently worth pursuing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants