14569 Commits

Author SHA1 Message Date
bors
2d205eecdb Auto merge of #12319 - ehuss:more-source-docs, r=epage
Add some more documentation for Source download functions.

This adds a little more of a description to the download functions of the `Source` trait, since the behavior wasn't clear to me (and I often forget how these work).
2023-06-29 23:19:22 +00:00
bors
974ed1d59d Auto merge of #12321 - ehuss:gnome-secret-unsupported, r=weihanglo
Don't try to compile cargo-credential-gnome-secret on non-Linux platforms.

This is a followup on #11993 to put the same treatment for `cargo-credential-gnome-secret` so that it builds on non-Linux platforms, substituting the "unsupported" implementation in that case.

This will still fail on Linux platforms that don't have libsecret-1-dev installed. I'm not sure how to best treat that, since we do want an error to be generated if the user tries to run `cargo install cargo-credential-gnome-secret`, and they don't have libsecret installed.
2023-06-29 22:36:10 +00:00
bors
b26b5336be Auto merge of #12317 - weihanglo:inheritable-macro, r=Muscraft
refactor: use macro to remove duplication of workspace inheritable fields getters
2023-06-29 20:24:08 +00:00
Eric Huss
afbca6baf8 Add READMEs for the credential helpers. 2023-06-29 11:54:41 -07:00
Eric Huss
21ccfb8fa6 Don't try to compile cargo-credential-gnome-secret on non-Linux platforms. 2023-06-29 11:19:58 -07:00
Eric Huss
03d9c5b4e4 Add some more documentation for Source download functions. 2023-06-29 11:08:16 -07:00
bors
be42872358 Auto merge of #12318 - weihanglo:cargo-ok, r=epage
doc: should be `.cargo-ok`

It was a mistake. Should be `.cargo-ok`. `.cargo-lock` is a file lock holding for `target/debug` when compiling stuff.
2023-06-28 17:00:07 +00:00
Weihang Lo
0dcf506341
doc: should be .cargo-ok 2023-06-28 17:55:01 +01:00
Weihang Lo
e313b61621
refactor: move getters method together 2023-06-28 17:20:09 +01:00
Weihang Lo
d99fed2de2
refactor(toml): remove unnecessary clone on inheritable fields 2023-06-28 17:20:09 +01:00
Weihang Lo
d6455a2998
refactor(toml): use macro to reduce boilerplates 2023-06-28 17:20:09 +01:00
bors
5febbe5587 Auto merge of #12290 - weihanglo:refactor-registry-api, r=epage
refactor(registry): extract and rearrange items to their own modules
2023-06-24 21:59:20 +00:00
bors
03bc66b55c Auto merge of #12305 - epage:quiet, r=weihanglo
fix(script): Be quiet on programmatic output

### What does this PR try to resolve?

This is a part of #12207

The goal is that we shouldn't interfere with end-user output when
"cargo script"s are used programmatically.  The only way to detect this
is when piping.  CI will also look like this.

My thought is that if someone does want to do `#!/usr/bin/env -S cargo -v`, it
should have a consistent meaning between local development
(`cargo run --manifest-path`) and "script mode" (`cargo`), so I
effectively added a new verbosity level in these cases.  To get normal
output in all cases, add a `-v` like the tests do.  Do `-vv` if you want
the normal `-v` mode.  If you want it always quiet, do `--quiet`.

I want to see the default verbosity for interactive "script mode" a bit
quieter to the point that all normal output cargo makes is cleared before
running the built binary.  I am holding off on that now as that could
tie into bigger conversations / refactors
(see https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Re-thinking.20cargo's.20output).

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

Initial writing of tests and refactors are split split out.  The tests in the final commit will let you see what impact this had on behavior.
2023-06-23 23:27:46 +00:00
bors
e95e2a97b9 Auto merge of #12308 - epage:script-docs, r=weihanglo
docs(unstable): Update script documentation

See #12207 for what all is merged that this is trying to cover.
2023-06-23 21:25:00 +00:00
Ed Page
004e6a172e docs(unstable): Update script documentation
See #12207 for what all is merged thatt his is trying to cover.
2023-06-23 14:20:00 -05:00
Ed Page
0e648c3ee4 fix(script): Be quiet on programmatic output
The goal is that we shouldn't interefere with end-user output when
"cargo script"s are used programmatically.  The only way to detect this
is when piping.  CI will also look like this.

My thought is that if someone does want to do `#!/usr/bin/env -S cargo -v`, it
should have a consistent meaning between local development
(`cargo run --manifest-path`) and "script mode" (`cargo`), so I
effectively added a new verbosity level in these cases.  To get normal
output in all cases, add a `-v` like the tests do.  Do `-vv` if you want
the normal `-v` mode.  If you want it always quiet, do `--quiet`.

I want to see the default verbosity for interactive "script mode" a bit
quieter to the point that all normal output cargo makes is cleared before
running the built binary.  I am holding off on that now as that could
tie into bigger conversations / refactors
(see https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Re-thinking.20cargo's.20output).
2023-06-22 19:27:00 -05:00
Ed Page
279077987b test(script): Verify verbosity 2023-06-22 19:27:00 -05:00
Ed Page
ec3c818192 refactor(cli): Infer the command before configuring
This will let the command have some sway in how we configure
2023-06-22 19:11:10 -05:00
Ed Page
215e4dad6f refactor(cli): Decouple exec lookup from doing it 2023-06-22 19:10:44 -05:00
bors
ac78f60231 Auto merge of #12287 - yerke:yerke/fix-cargo-script-example, r=epage
cargo script example needs nightly -Zscript feature

### What does this PR try to resolve?
Update cargo script example. Cargo script currently needs nightly `-Zscript` feature.
Without this change users will see:
```
error: running `./cargo_script.rs` requires `-Zscript`
```

cc https://github.com/rust-lang/cargo/issues/12207

### How should we test and review this PR?
I don't think any additional tests are needed. All existing tests for cargo script already use `-Zscript`.

### Additional information
Thanks for designing and implementing cargo script `@epage!`
2023-06-23 00:08:33 +00:00
Yerkebulan Tulibergenov
4fb22dd748 cargo script example needs nightly -Zscript feature 2023-06-22 15:15:41 -07:00
bors
2035d0d1b9 Auto merge of #12303 - epage:config, r=joshtriplett
fix(script): Process config relative to script, not CWD

### What does this PR try to resolve?

This is part of the work for #12207.

When you put in your path `foo.rs`:
```rust
#!/usr/bin/env cargo

fn main() {}
```

You expect it to build once and then repeatedly run the same version.  However, `.cargo/config.toml` doesn't work like that (normally).  It is an environment file, like `.env`, and is based on your current working directory.  So if you run `foo.rs` from within a random project, it might rebuild due to RUSTFLAGS in `.cargo/config.toml`.

I had some concern about whether this current behavior is right or not and [noted this in the Pre-RFC](https://github.com/epage/cargo-script-mvs/blob/main/0000-cargo-script.md#unresolved-questions).  This came up again while we were [discussing editions on zulip](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/cargo.20script.20and.20edition).  In looking further into this, it turns out we already have precedence for this with `cargo install --path <path>`.

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

The second commit has the fix, the docs, and a change to a test (from the first commit) to show that the fix actually changed behavior.
2023-06-22 21:47:34 +00:00
bors
5e842cc5cc Auto merge of #12302 - ehuss:next-lockfile-error, r=weihanglo
-Znext-lockfile-bump: Don't suggest using -Z on stable

This changes the lockfile version 4 error to not suggest using `-Znext-lockfile-bump` on the stable channel. I fear this could be confusing to users when the real version 4 is stabilized, and the user is using a too old version of cargo. Instead this produces the same error message as any unknown version would produce, with a suggestion to update.
2023-06-22 19:46:13 +00:00
Ed Page
78334e868e fix(script): Process config relative to script, not CWD 2023-06-22 14:15:20 -05:00
Ed Page
9d85c891e8 test(script): Verify existing config behavior 2023-06-22 14:05:44 -05:00
Eric Huss
604c8f8122 -Znext-lockfile-bump: Don't suggest using -Z on stable 2023-06-22 11:55:42 -07:00
bors
bda23fc114 Auto merge of #12300 - rust-lang:dependabot/cargo/openssl-0.10.55, r=weihanglo
build(deps): bump openssl from 0.10.54 to 0.10.55

Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.54 to 0.10.55.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/sfackler/rust-openssl/releases">openssl's releases</a>.</em></p>
<blockquote>
<h2>openssl-v0.10.55</h2>
<h2>What's Changed</h2>
<ul>
<li>Fix warnings from BoringSSL on Rust 1.70 by <a href="https://github.com/alex"><code>`@​alex</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1948">sfackler/rust-openssl#1948</a></li>
<li>Honor OPENSSL_NO_OCB if OpenSSL was built this way by <a href="https://github.com/davidben"><code>`@​davidben</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1952">sfackler/rust-openssl#1952</a></li>
<li>Fix some deprecated patterns when using BoringSSL by <a href="https://github.com/davidben"><code>`@​davidben</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1945">sfackler/rust-openssl#1945</a></li>
<li>add get_asn1_flag to EcGroupRef by <a href="https://github.com/reaperhulk"><code>`@​reaperhulk</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1947">sfackler/rust-openssl#1947</a></li>
<li>Fixed type mutability on asn1_flag by <a href="https://github.com/alex"><code>`@​alex</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1954">sfackler/rust-openssl#1954</a></li>
<li>allow affine_coordinates on boring and libre by <a href="https://github.com/reaperhulk"><code>`@​reaperhulk</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1955">sfackler/rust-openssl#1955</a></li>
<li>add support for EVP_PKEY_derive_set_peer_ex in OpenSSL 3 by <a href="https://github.com/reaperhulk"><code>`@​reaperhulk</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1956">sfackler/rust-openssl#1956</a></li>
<li>Use type-safe wrappers instead of EVP_PKEY_assign by <a href="https://github.com/davidben"><code>`@​davidben</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1959">sfackler/rust-openssl#1959</a></li>
<li>add Nid::SM2 and pkey Id::SM2 by <a href="https://github.com/zh-jq"><code>`@​zh-jq</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1962">sfackler/rust-openssl#1962</a></li>
<li>Fix handling of empty host strings by <a href="https://github.com/sfackler"><code>`@​sfackler</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1968">sfackler/rust-openssl#1968</a></li>
<li>Remove old codes that belows supported Rust version. by <a href="https://github.com/tesuji"><code>`@​tesuji</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1966">sfackler/rust-openssl#1966</a></li>
<li>Release openssl v0.10.55 and openssl-sys v0.9.89 by <a href="https://github.com/alex"><code>`@​alex</code></a>` in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1970">sfackler/rust-openssl#1970</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/davidben"><code>`@​davidben</code></a>` made their first contribution in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1952">sfackler/rust-openssl#1952</a></li>
<li><a href="https://github.com/tesuji"><code>`@​tesuji</code></a>` made their first contribution in <a href="https://redirect.github.com/sfackler/rust-openssl/pull/1966">sfackler/rust-openssl#1966</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.54...openssl-v0.10.55">https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.54...openssl-v0.10.55</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="d7dae6fb45"><code>d7dae6f</code></a> Merge pull request <a href="https://redirect.github.com/sfackler/rust-openssl/issues/1970">#1970</a> from alex/bump-for-release</li>
<li><a href="983b9e210a"><code>983b9e2</code></a> Release openssl v0.10.55 and openssl-sys v0.9.89</li>
<li><a href="28b3925a32"><code>28b3925</code></a> Merge pull request <a href="https://redirect.github.com/sfackler/rust-openssl/issues/1966">#1966</a> from tesuji/tidy-old-msrv</li>
<li><a href="f03a2dc807"><code>f03a2dc</code></a> Merge pull request <a href="https://redirect.github.com/sfackler/rust-openssl/issues/1968">#1968</a> from sfackler/empty-domain-segfault</li>
<li><a href="155b3dc717"><code>155b3dc</code></a> Fix handling of empty host strings</li>
<li><a href="978435639b"><code>9784356</code></a> chore: simplify cfg attributes</li>
<li><a href="8ab3c3f3a8"><code>8ab3c3f</code></a> update min-version passed to bindgen</li>
<li><a href="8587ff8843"><code>8587ff8</code></a> chore: use pre-existing clean APIs instead</li>
<li><a href="b1e16e9276"><code>b1e16e9</code></a> clippy: use strip_prefix instead of manually strip</li>
<li><a href="fb5ae60cbb"><code>fb5ae60</code></a> clippy: remove unused allow attributes</li>
<li>Additional commits viewable in <a href="https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.54...openssl-v0.10.55">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=openssl&package-manager=cargo&previous-version=0.10.54&new-version=0.10.55)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/rust-lang/cargo/network/alerts).

</details>
2023-06-22 11:05:46 +00:00
dependabot[bot]
ff26beca25
build(deps): bump openssl from 0.10.54 to 0.10.55
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.54 to 0.10.55.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.54...openssl-v0.10.55)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-21 22:59:06 +00:00
bors
05cd14ecf9 Auto merge of #12298 - weihanglo:config-include-toml, r=epage
Add `.toml` file extension restriction for `-Zconfig-include`
2023-06-21 21:48:29 +00:00
bors
52b1ffb915 Auto merge of #12299 - epage:redirect, r=weihanglo
docs(unstable): Point stable-unstable docs to nightly docs

I ran into this in trying to find the "cargo script" docs.  Unless its the rare case of `RUSTC_BOOTRAP=1 cargo +stable ...`, someone reading about features on `+nightly` likely would want to see the latest version of this document, so we should help people find it.
2023-06-21 20:03:31 +00:00
Ed Page
8a9bfc05a1 docs(unstable): Point stable-unstable docs to nightly docs 2023-06-21 14:59:02 -05:00
Weihang Lo
26b7725978
doc(unstable): merge precedence of -Zconfig-include 2023-06-21 20:18:13 +01:00
Weihang Lo
33b0a24082
test(config-include): assert config merged in DFS 2023-06-21 20:18:09 +01:00
Weihang Lo
3f82ec7093
feat: check if config-include file ends with .toml
This is to avoid possible name collisions. For example, a user
creates a file called `.cargo/cache`, and then in the future
cargo wants to create a directory called `.cargo/cache/`, that
would collide with what the user specified. Restricting to `.toml`
extensions would avoid that since we won’t make a directory named
with a `.toml` extension.
2023-06-21 20:18:08 +01:00
bors
4cebd130eb Auto merge of #12289 - epage:basic, r=weihanglo
fix: Allow embedded manifests in all commands

### What does this PR try to resolve?

This is a part of #12207.

One of the goals is for embedded manifests to be a first class citizen.  If you have a script, you should be able to run tests on it, for example.

This expands the error check from just `Cargo.toml` to also single-file packages so you can use it in `--manifest-path`.

This, however, does mean that these *can* be used in places that likely won't work yet, like `cargo publish`.

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

By commit.  We introduce tests for basic commands and then implement and refine the support for this.

### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.
2023-06-21 18:59:29 +00:00
bors
3de1cc462b Auto merge of #12281 - epage:toml, r=weihanglo
feat(cli): Support `cargo Cargo.toml`

### What does this PR try to resolve?

This is making the assumption that we want full unity between places accepting both single-file packages and `Cargo.toml` for #12207.   This has not been brought up before in any of the discussions (Internals, eRFC), so I can understand if there are concerns about this and we decide to hold off.

We might want to resolve symlinks before this so people can have a prettier name for these.

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

The test for this was added in a commit before the actual change, letting people see how the behavior changed.
2023-06-21 18:07:32 +00:00
Ed Page
d8583f4a5e fix(cli): Improve error on manifest dir 2023-06-21 12:26:15 -05:00
Ed Page
85023c46e4 test(cli): Verify missing-manifest behavior 2023-06-21 11:46:36 -05:00
Ed Page
af69746ba6 test(cli): Verify directory-manifest behaivor 2023-06-21 11:30:55 -05:00
bors
dead4b8740 Auto merge of #12291 - ehuss:feature-name-error, r=weihanglo
Convert valid feature name warning to an error.

This converts the feature name validation check from a warning to an error. This was added in #8814 in Rust 1.49 released in 2020-12-31 (about 2.5 years ago) with a warning that it will become a hard error in the future.

These extended characters aren't allowed on crates.io, so this should only impact users of other registries, or people who don't publish to a registry. The warning message requested anyone impacted by it to let us know. We got one report, and added support for . as result. Since there weren't any other reports, I think it should be pretty safe to move forward.

The diff here is a little large because it removes the pass-through of `config` since it isn't needed anymore.
Additionally, the tests were restructured since testing every edge case in an integration test has a lot of overhead. Instead, there is now a unit test which runs much faster, with the integration test just verifying that it fires and checks the two forms of error messages.

Closes #8813
2023-06-20 20:07:17 +00:00
Eric Huss
9835622853 Convert valid feature name warning to an error. 2023-06-20 12:39:27 -07:00
Weihang Lo
aaf02211c6
chore: update auto-label trigger files 2023-06-20 19:23:21 +01:00
Weihang Lo
b465ed9f4b
refactor: move http handle constructor to its own module 2023-06-20 19:23:21 +01:00
Weihang Lo
677cd5ece2
refactor: extract owner to its own module 2023-06-20 19:23:20 +01:00
Weihang Lo
d263ca6e61
refactor: extract yank to its own module 2023-06-20 19:23:20 +01:00
Weihang Lo
7c0add0ec0
refactor: extract logout to its own module 2023-06-20 19:23:20 +01:00
Weihang Lo
048267934b
refactor: extract login to its own module 2023-06-20 15:52:52 +01:00
Weihang Lo
d39c6504fa
refactor: extract search to its own module 2023-06-20 15:52:51 +01:00
Weihang Lo
e5382fcbf7
refactor: extract publish to its own module 2023-06-20 15:52:51 +01:00
Weihang Lo
81948a6e43
refactor: rename registry module to registry/mod.rs 2023-06-20 13:48:43 +01:00