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

Commit license-metadata.json to git and check it's correct in CI #133453

Merged
merged 4 commits into from
Nov 27, 2024

Conversation

jonathanpallant
Copy link
Contributor

This PR adds license-metadata.json to the root of the git repo, and changes mingw-check to check that the file is still up-to-date.

By committing this file, we remove the need for developers to a) have reuse installed or b) run an expensive ~90 second analysis of the files on disk when they want generate the COPYRIGHT.html files which depend on this license metadata.

The file will need updating whenever REUSE.toml changes, or when git submodules are added, or when git submodules change their license information (as detected by REUSE).

You can now run:

  • ./x run collect-license-metadata to update the ./license-metadata.json file
  • ./x test collect-license-metadata to test the ./license-metadata.json file for correctness

The comparison is done with two serde_json::Value objects, so the map objects they contain should ignore differences in ordering.

@rustbot
Copy link
Collaborator

rustbot commented Nov 25, 2024

r? @Kobzol

rustbot has assigned @Kobzol.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Nov 25, 2024
@jonathanpallant

This comment was marked as resolved.

@rustbot
Copy link
Collaborator

rustbot commented Nov 25, 2024

Could not assign reviewer from: Kobzol.
User(s) Kobzol are either the PR author, already assigned, or on vacation, and there are no other candidates.
Use r? to specify someone else to assign.

@jonathanpallant
Copy link
Contributor Author

2024-11-25T14:54:30.6117409Z gathering license information from REUSE (this might take a minute...)
2024-11-25T14:56:14.6781427Z finished gathering the license information from REUSE in 104.07s
2024-11-25T14:56:19.6861238Z loading existing license information
2024-11-25T14:56:19.6862080Z license information matches

:)

serde_json::from_str(&existing).with_context(|| {
format!("Failed to read existing license JSON at {}", dest.display())
})?;
if existing_json != output {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking out loud: if we printed a diff here, it could help with inspecting licensing changes performed by PRs. But we already have some tidy checks for that, IIRC, so it's probably overkill.

@Kobzol
Copy link
Contributor

Kobzol commented Nov 26, 2024

Thank you, this was a pleasure to review. It's almost as if you're not doing this for the first time 😆

@bors r+

@bors
Copy link
Contributor

bors commented Nov 26, 2024

📌 Commit db71194 has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 26, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 27, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#132979 (use `--exact` on `--skip` to avoid unintended substring matches)
 - rust-lang#133248 (CI: split x86_64-msvc-ext job)
 - rust-lang#133449 (std: expose `const_io_error!` as `const_error!`)
 - rust-lang#133453 (Commit license-metadata.json to git and check it's correct in CI)
 - rust-lang#133457 (miri: implement `TlsFree`)
 - rust-lang#133493 (do not constrain infer vars in `find_best_leaf_obligation`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 04d6333 into rust-lang:master Nov 27, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Nov 27, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 27, 2024
Rollup merge of rust-lang#133453 - ferrocene:check-license-metadata, r=Kobzol

Commit license-metadata.json to git and check it's correct in CI

This PR adds `license-metadata.json` to the root of the git repo, and changes `mingw-check` to check that the file is still up-to-date.

By committing this file, we remove the need for developers to a) have reuse installed or b) run an expensive ~90 second analysis of the files on disk when they want generate the COPYRIGHT.html files which depend on this license metadata.

The file will need updating whenever `REUSE.toml` changes, or when git submodules are added, or when git submodules change their license information (as detected by REUSE).

You can now run:

* `./x run collect-license-metadata` to update the `./license-metadata.json` file
* `./x test collect-license-metadata` to test the `./license-metadata.json` file for correctness

The comparison is done with two `serde_json::Value` objects, so the map objects they contain should ignore differences in ordering.
@tshepang tshepang deleted the check-license-metadata branch November 27, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants