Commit graph

3265 commits

Author SHA1 Message Date
Ted Kaminski 79bb2d7143 Update pkg-spec comment, and add 2 more test cases 2023-05-01 17:23:17 -05:00
Ted Kaminski 31d679e81a Build by PackageIdSpec, not name, to avoid ambiguity 2023-05-01 17:23:17 -05:00
bors a285008c8e Auto merge of #12044 - jrose-signal:cargo-tree-no-proc-macro, r=epage
cargo-tree: Handle -e no-proc-macro when building the graph

### What does this PR try to resolve?

Makes `-e no-proc-macro` more useful when combined with `-i` or `-d`. Fixes #12030.

### How should we test and review this PR?

The new and existing tests should cover this, I hope!

### Additional information

Pruning proc-macro crates during graph construction is closer to how the edge-based filters work (`[no-]build` etc.), so even though `no-proc-macro` isn't technically filtering on edges, it's following a well-established code path.
2023-04-27 21:04:25 +00:00
Jordan Rose a0576d1767 cargo-tree: Handle -e no-proc-macro when building the graph
This is closer to how the edge-based filters work ([no-]build etc.),
and results in a more useful behavior when combined with -i or -d.
2023-04-27 10:54:51 -07:00
Jordan Rose 747a5924a0 test: Add a test for cargo tree --duplicates with a proc-macro 2023-04-27 10:49:22 -07:00
cassaundra 5554889f88
Include rust-version in publish request
crates.io reads rust-version from the tarball directly, but we can include it in
the publish request for the sake of consistency for third-party registries.
2023-04-26 11:59:29 -07:00
Kyle Matsuda 90c7d3b9b8 update the publish_with_missing_readme test with new warning 2023-04-25 12:27:39 -06:00
Kyle Matsuda 27e95997ce failing tests on empty readme and license-path fields 2023-04-25 12:27:39 -06:00
Weihang Lo 00484fe00a
fix: apply [env] to target info discovery rustc 2023-04-24 20:30:44 +01:00
Weihang Lo e1c7ce8903
test: [env] isn't applied to target info discovery rustc 2023-04-24 20:28:20 +01:00
bors b5177c6d46 Auto merge of #12001 - hi-rustin:rustin-patch-dep-empty, r=weihanglo
Improve error message for empty dep
2023-04-24 09:20:41 +00:00
bors 77069b43f0 Auto merge of #11958 - jyn514:named-debuginfo, r=Muscraft
Allow named debuginfo options in Cargo.toml
2023-04-22 15:08:08 +00:00
bors 738c699342 Auto merge of #11997 - hi-rustin:rustin-patch-dep-message, r=weihanglo
Better error message when getting an empty dep table
2023-04-20 09:16:30 +00:00
hi-rustin af0cd9fc5a Improve error message for empty dep
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-20 09:32:24 +08:00
hi-rustin e0276cae19 Update error message to not start with capital letters
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-20 09:16:45 +08:00
jyn a982bccfe8 add more debuginfo tests 2023-04-19 20:01:04 -05:00
hi-rustin 4d401bd0b9 Add test for empty dep table error
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-20 08:49:30 +08:00
Eric Huss 6fa758e83c Fix flaky not_found_permutations test. 2023-04-14 08:01:34 -07:00
bors b0742b2145 Auto merge of #11882 - hi-rustin:rustin-patch-clippy-fix, r=weihanglo
Correct the bug report for `cargo clippy --fix`
2023-04-14 07:05:37 +00:00
hi-rustin 08169fd015 Add rustc_shim_for_cargo_fix and wrapped_clippy_driver to reuse code
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-14 11:23:41 +08:00
hi-rustin 47f6e2ddc9 Add broken_clippy_fixes_backed_out
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-14 10:46:53 +08:00
bors 84b7041fd2 Auto merge of #11950 - ehuss:stabilize-logout, r=epage
Stabilize `cargo logout`

This stabilizes the `cargo logout` command.

Closes #11910
Closes #11884
2023-04-13 20:08:40 +00:00
jyn 8a9db7a020 Address review comments
- Update the documentation and doc-comments
- Improve the error message for parsing Cargo.toml
2023-04-12 12:05:14 -05:00
Eric Huss a70c108961 Stabilize cargo logout 2023-04-12 09:56:43 -07:00
Eric Huss c00a633bd6 Don't display headers in spurious warning message.
The headers can significantly contribute to noise in the output,
drowning out the rest of the output. Most investigation will likely be
focused on the case where cargo completely fails to download, so this
only shows the full detail in the final error message.
2023-04-12 09:38:53 -07:00
Eric Huss 4702fa3ad3 Include the IP address in HTTP errors. 2023-04-12 09:38:53 -07:00
Eric Huss c7c9b8f32b Show some HTTP headers in error messages. 2023-04-12 09:38:52 -07:00
bors 96f8d6ced8 Auto merge of #11949 - ehuss:logout-default, r=epage
Use registry.default for login/logout

This changes `cargo login` and `cargo logout` to use the registry configured at `registry.default` as the registry instead of crates.io. For `cargo login`, this was an unintentional regression from #6466. The documentation has always stated that it will use the default registry.

This makes the command more in line with other registry-involving commands. There are still some inconsistencies.

These commands use the default if not specified:

* `cargo init`
* `cargo new`
* `cargo owner`
* `cargo search`
* `cargo yank`
* `cargo publish` uses the default, but will also look at the `publish` field `Cargo.toml` and use that if the registry is not specified.

These commands would always use crates.io if `--registry` is not specified:

* `cargo login`
* `cargo logout`
* `cargo install`

I'm a bit uncertain how to proceed, since this is technically a breaking change particularly if someone has scripted it. I suspect that the number of users that use `registry.default` is very small, and those that script `cargo login` are even smaller, and thus the intersection is probably small or nonexistent. However, there is some risk here.
2023-04-12 13:45:57 +00:00
Eric Huss 3da2b3c67b Mark -C as unstable 2023-04-11 19:46:05 -07:00
Joshua Nelson d861dcf792 Allow named debuginfo options in Cargo.toml
Rustc supports these since rust-lang/rust#109808. It's technically
possible to set a named debuginfo level through `RUSTFLAGS`, but in
practice cargo always passes its own opinion of what the debuginfo level
is, so allow it to be configured through cargo too.
2023-04-11 15:06:02 -05:00
Eric Huss a9e0b505d6 Update auth error message to specify args for cargo login. 2023-04-10 10:20:21 -07:00
bors c429784fd5 Auto merge of #11951 - ehuss:check-token-tab, r=hi-rustin
Fix credential token format validation.

The existing validation incorrectly excluded tab because of a missing backslash. This updates to add the backslash.

This also rewords the comments. I found the current comments to be a little confusing.

This also extends the test to verify more valid inputs.

cc #11600
2023-04-10 04:02:43 +00:00
Eric Huss 35f5862979 Validate token on publish. 2023-04-09 12:15:40 -07:00
Eric Huss 57264ed433 Fix credential token format validation. 2023-04-09 11:53:46 -07:00
Eric Huss 117eb4b33f Use registry.default for login/logout 2023-04-09 09:30:36 -07:00
Eric Huss 0e13f667c8 Add tests for registry.default for login/logout 2023-04-09 09:22:28 -07:00
Eric Huss 91d39bc742 Share the check_token function between login and logout tests. 2023-04-09 09:11:22 -07:00
Arlo Siemsen a888c94052 Stop using UncanonicalizedIter for QueryKind::Exact 2023-04-05 15:52:01 -05:00
Eric Huss 1ee340c0a7 Don't query permutations of the path prefix. 2023-04-04 18:49:42 -07:00
Arlo Siemsen a1cba8fe49 Fix Cargo warning about unused sparse configuration key
When doing a credential lookup, Cargo deserializes the registry configuration and detects the
registries.crates-io.protocol key as unused and issues a warning.

This fixes the issue by adding the field to the struct
2023-04-03 11:27:11 -05:00
Eric Huss 78970bd4a8 Update git2 2023-04-02 15:37:53 -07:00
bors 0e474cfd7b Auto merge of #11881 - ehuss:http-retry, r=epage
Add delays to network retries.

This adds a delay to network retries to help guard against short-lived transient errors.

The overview of how this works is: Requests that fail are placed into a queue with a timestamp of when they should be retried. The download code then checks for any requests that need to be retried, and re-injects them back into curl.

Care must be taken in the download loops to track which requests are currently in flight *plus* which requests are waiting to be retried.

This also adds jitter to the retry times so that multiple failed requests don't all flood the server when they are retried. This is a very primitive form of jitter which suffers from clumping, but I think it should be fine.

The max number of retries is raised to 3 in order to bring the total retry time to around 10 seconds. This is intended to address Cloudfront's default negative TTL of 10 seconds. The retry schedule looks like 0.5seconds ± 1 second, then 3.5 seconds then 6.5 seconds, for a total of 10.5 to 11.5 seconds.  If the user configures additional retries, each attempt afterwards has a max delay of 10 seconds.

The retry times are currently not user-configurable. This could potentially be added in the future, but I don't think is particularly necessary for now.

There is an unfortunate amount of duplication between the crate download and HTTP index code. I think in the near future we should work on consolidating that code. That might be challenging, since their use patterns are different, but I think it is feasible.
2023-03-31 23:15:58 +00:00
Eric Huss 6bd1209a55 Add delays to network retries. 2023-03-31 14:04:48 -07:00
Eric Huss f393f96d7f Add a note to cargo logout that it does not revoke the token. 2023-03-31 08:03:51 -07:00
Eric Huss 5860cd23a2 Disable test_profile test on windows-gnu 2023-03-30 19:18:10 -07:00
Ed Page 6feea34f8a chore: Upgrade to clap v4.2
Tests in `master` are currently failing because its building with clap
v4.2 but the tests have snapshots from v4.1
2023-03-28 05:00:49 -05:00
bors c9faf70061 Auto merge of #11824 - kylematsuda:windows-config-env-fix, r=ehuss
Handle case mismatches when looking up env vars in the Config snapshot

### What does this PR try to resolve?

Fixes #11814.

Windows environment variables are case-insensitive, which causes problems when looking them up in the `Config` env snapshot.

This PR adds another member (`case_insensitive_env`) in `Config` that maps upper-cased keys to their original values in the env (for example, `"PATH" => "Path"`). If lookup in `self.env` fails, this PR converts the key to upper case and looks it up in `self.case_insensitive_env` to obtain the correct key name if it exists (on Windows only).

### How should we test and review this PR?

Please see the new tests in `testsuite/config.rs` and `testsuite/cargo_command.rs`.

### Additional information

Currently, this uses `str::to_uppercase` to uppercase the keys. This requires key to be valid UTF-8, and may disagree with how the OS uppercases things (see the link in [this comment](https://github.com/rust-lang/cargo/issues/11814#issuecomment-1462870983) for details).
2023-03-17 01:06:49 +00:00
bors 94394ebf2a Auto merge of #11855 - robjtede:target-ignore, r=weihanglo
align semantics of generated vcs ignore files

### What does this PR try to resolve?

The currently generated `^target/` spec in a hg ignore will only ignore dirs of that name at the root.

This change matches the behavior of the gitignore spec next to it, by only ignoring both files/symlinks and dirs of name "target".

### How should we test and review this PR?

Run `cargo new`
2023-03-15 17:28:40 +00:00
Rob Ede 8183c31eec
chore: fix target in generated hg ignore file 2023-03-15 16:39:24 +00:00
Eric Huss 3c295cf5ec Update tests for publish text changes 2023-03-15 08:50:11 -07:00