-
Notifications
You must be signed in to change notification settings - Fork 13.8k
collect-license-metadata: Print a diff of the expected output #147422
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
Conversation
Previously, `x test collect-license-metadata` gave the following message on errors: ``` gathering license information from REUSE (this might take a minute...) finished gathering the license information from REUSE in 78.69s loading existing license information The existing /home/runner/work/ferrocene/ferrocene/license-metadata.json file is out of date. Run ./x run collect-license-metadata to update it. Error: The existing /home/runner/work/ferrocene/ferrocene/license-metadata.json file doesn't match what REUSE reports. Bootstrap failed while executing `test collect-license-metadata` ``` Notable, this doesn't actually say what went wrong. Print a diff in addition so it's more clear what broke: ``` ... "license": { "copyright": [ + "2010 The Rust Project Developers", "2016, 2017, 2018, 2019, 2020, 2021 AXE Consultants. All Rights", + "License. Subject to the terms and conditions of this", "Notice", - "The Ferrocene Developers" + "The Ferrocene Developers", + "[yyyy] [name of copyright owner]" ], ... ``` Currently, this prints the entire text of the JSON file as context. That's not ideal, but it's rare for this to fail, so I think it's ok for now. I considered using `assert_json_diff` instead of `similar`, but its errors are a lot harder to read IMO, even though they are better at omitting unnecessary context: ``` Diff: json atoms at path ".files.children[0].children[10].license.copyright[0]" are not equal: lhs: "2016 The Fuchsia Authors" rhs: "2019 The Crossbeam Project Developers" json atoms at path ".files.children[0].children[10].license.spdx" are not equal: lhs: "BSD-2-Clause AND (Apache-2.0 OR MIT)" rhs: "Apache-2.0 OR MIT" json atom at path ".files.children[0].children[10].children" is missing from lhs json atoms at path ".files.children[0].children[10].name" are not equal: lhs: "library/std/src/sys/sync/mutex/fuchsia.rs" rhs: "library/std/src/sync/mpmc" ... ```
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
rustbot has assigned @Mark-Simulacrum. Use |
r? kobzol I don't think it's so important to print a diff here when the only way to update the file is to bless it anyway (no one is gonna edit it manually). But it also shouldn't hurt, so: @bors r+ rollup |
collect-license-metadata: Print a diff of the expected output Previously, `x test collect-license-metadata` gave the following message on errors: ``` gathering license information from REUSE (this might take a minute...) finished gathering the license information from REUSE in 78.69s loading existing license information The existing /home/runner/work/ferrocene/ferrocene/license-metadata.json file is out of date. Run ./x run collect-license-metadata to update it. Error: The existing /home/runner/work/ferrocene/ferrocene/license-metadata.json file doesn't match what REUSE reports. Bootstrap failed while executing `test collect-license-metadata` ``` Notable, this doesn't actually say what went wrong. Print a diff in addition so it's more clear what broke: ``` ... "license": { "copyright": [ + "2010 The Rust Project Developers", "2016, 2017, 2018, 2019, 2020, 2021 AXE Consultants. All Rights", + "License. Subject to the terms and conditions of this", "Notice", - "The Ferrocene Developers" + "The Ferrocene Developers", + "[yyyy] [name of copyright owner]" ], ... ``` Currently, this prints the entire text of the JSON file as context. That's not ideal, but it's rare for this to fail, so I think it's ok for now. I considered using `assert_json_diff` instead of `similar`, but its errors are a lot harder to read IMO, even though they are better at omitting unnecessary context: ``` Diff: json atoms at path ".files.children[0].children[10].license.copyright[0]" are not equal: lhs: "2016 The Fuchsia Authors" rhs: "2019 The Crossbeam Project Developers" json atoms at path ".files.children[0].children[10].license.spdx" are not equal: lhs: "BSD-2-Clause AND (Apache-2.0 OR MIT)" rhs: "Apache-2.0 OR MIT" json atom at path ".files.children[0].children[10].children" is missing from lhs json atoms at path ".files.children[0].children[10].name" are not equal: lhs: "library/std/src/sys/sync/mutex/fuchsia.rs" rhs: "library/std/src/sync/mpmc" ... ```
Rollup of 8 pull requests Successful merges: - #145608 (Prevent downstream `impl DerefMut for Pin<LocalType>`) - #146865 (kcfi: only reify trait methods when dyn-compatible) - #147205 (Add a new `wasm32-wasip3` target to Rust) - #147390 (Use globals instead of metadata for std::autodiff) - #147398 (Fix; correct placement of type inference error for method calls) - #147422 (collect-license-metadata: Print a diff of the expected output) - #147431 (compiletest: Read the whole test file before parsing directives) - #147433 (Fix doc comment) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - #145608 (Prevent downstream `impl DerefMut for Pin<LocalType>`) - #146865 (kcfi: only reify trait methods when dyn-compatible) - #147205 (Add a new `wasm32-wasip3` target to Rust) - #147390 (Use globals instead of metadata for std::autodiff) - #147398 (Fix; correct placement of type inference error for method calls) - #147422 (collect-license-metadata: Print a diff of the expected output) - #147431 (compiletest: Read the whole test file before parsing directives) - #147433 (Fix doc comment) r? `@ghost` `@rustbot` modify labels: rollup
Replicating the environment for reuse is non-trivial (the original failure here was that CI used reuse 6 and I was using 5.1). And it also depends on submodules and untracked files and ... Seems nicer to say what went wrong. |
Fair enough :) |
Rollup of 8 pull requests Successful merges: - #146865 (kcfi: only reify trait methods when dyn-compatible) - #147205 (Add a new `wasm32-wasip3` target to Rust) - #147322 (cg_llvm: Consistently import `llvm::Type` and `llvm::Value`) - #147398 (Fix; correct placement of type inference error for method calls) - #147410 (Update `S-waiting-on-team` refs to new `S-waiting-on-{team}` labels) - #147422 (collect-license-metadata: Print a diff of the expected output) - #147431 (compiletest: Read the whole test file before parsing directives) - #147433 (Fix doc comment) Failed merges: - #147390 (Use globals instead of metadata for std::autodiff) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #147422 - jyn514:license-diff, r=Kobzol collect-license-metadata: Print a diff of the expected output Previously, `x test collect-license-metadata` gave the following message on errors: ``` gathering license information from REUSE (this might take a minute...) finished gathering the license information from REUSE in 78.69s loading existing license information The existing /home/runner/work/ferrocene/ferrocene/license-metadata.json file is out of date. Run ./x run collect-license-metadata to update it. Error: The existing /home/runner/work/ferrocene/ferrocene/license-metadata.json file doesn't match what REUSE reports. Bootstrap failed while executing `test collect-license-metadata` ``` Notable, this doesn't actually say what went wrong. Print a diff in addition so it's more clear what broke: ``` ... "license": { "copyright": [ + "2010 The Rust Project Developers", "2016, 2017, 2018, 2019, 2020, 2021 AXE Consultants. All Rights", + "License. Subject to the terms and conditions of this", "Notice", - "The Ferrocene Developers" + "The Ferrocene Developers", + "[yyyy] [name of copyright owner]" ], ... ``` Currently, this prints the entire text of the JSON file as context. That's not ideal, but it's rare for this to fail, so I think it's ok for now. I considered using `assert_json_diff` instead of `similar`, but its errors are a lot harder to read IMO, even though they are better at omitting unnecessary context: ``` Diff: json atoms at path ".files.children[0].children[10].license.copyright[0]" are not equal: lhs: "2016 The Fuchsia Authors" rhs: "2019 The Crossbeam Project Developers" json atoms at path ".files.children[0].children[10].license.spdx" are not equal: lhs: "BSD-2-Clause AND (Apache-2.0 OR MIT)" rhs: "Apache-2.0 OR MIT" json atom at path ".files.children[0].children[10].children" is missing from lhs json atoms at path ".files.children[0].children[10].name" are not equal: lhs: "library/std/src/sys/sync/mutex/fuchsia.rs" rhs: "library/std/src/sync/mpmc" ... ```
collect-license-metadata: update submodules before running Previously, this could cause incorrect failures like the following: ``` diff --git a/license-metadata.json b/license-metadata.json index 4fb5921..b1291c00b94 100644 --- a/license-metadata.json +++ b/license-metadata.json `@@` -244,19 +172,6 `@@` }, "name": "src/doc/rustc-dev-guide/mermaid.min.js", "type": "file" - }, - { - "children": [], - "license": { - "copyright": [ - "2003-2019 University of Illinois at Urbana-Champaign", - "2003-2019 by the contributors listed in CREDITS.TXT (https://github.com/rust-lang/llvm-project/blob/7738295178045041669876bf32b0543ec8319a5c/llvm/CREDITS.TXT)", - "2010 Apple Inc" - ], - "spdx": "Apache-2.0 WITH LLVM-exception AND NCSA" - }, - "name": "src/llvm-project", - "type": "directory" ``` Additionally, this prints a warning if there were untracked files, which could cause a failure like the following: ``` diff --git a/license-metadata.json b/license-metadata.json index 4fb5921..ebf1c478282 100644 --- a/license-metadata.json +++ b/license-metadata.json `@@` -155,6 +155,22 `@@` "name": "src/librustdoc/html/static/fonts", "type": "directory" }, + { + "directories": [], + "files": [ + "2015-edition.txt", + "diagnostics.json", + "license.diff", + "test.fixed.rs" + ], + "license": { + "copyright": [ + "NONE" + ], + "spdx": "NONE" + }, + "type": "group" + }, { "license": { "copyright": [ ``` r? `@Kobzol` cc rust-lang#147422
Rollup merge of #147448 - jyn514:reuse-submodules, r=kobzol collect-license-metadata: update submodules before running Previously, this could cause incorrect failures like the following: ``` diff --git a/license-metadata.json b/license-metadata.json index 4fb5921..b1291c00b94 100644 --- a/license-metadata.json +++ b/license-metadata.json `@@` -244,19 +172,6 `@@` }, "name": "src/doc/rustc-dev-guide/mermaid.min.js", "type": "file" - }, - { - "children": [], - "license": { - "copyright": [ - "2003-2019 University of Illinois at Urbana-Champaign", - "2003-2019 by the contributors listed in CREDITS.TXT 9BB4 (https://github.com/rust-lang/llvm-project/blob/7738295178045041669876bf32b0543ec8319a5c/llvm/CREDITS.TXT)", - "2010 Apple Inc" - ], - "spdx": "Apache-2.0 WITH LLVM-exception AND NCSA" - }, - "name": "src/llvm-project", - "type": "directory" ``` Additionally, this prints a warning if there were untracked files, which could cause a failure like the following: ``` diff --git a/license-metadata.json b/license-metadata.json index 4fb5921..ebf1c478282 100644 --- a/license-metadata.json +++ b/license-metadata.json `@@` -155,6 +155,22 `@@` "name": "src/librustdoc/html/static/fonts", "type": "directory" }, + { + "directories": [], + "files": [ + "2015-edition.txt", + "diagnostics.json", + "license.diff", + "test.fixed.rs" + ], + "license": { + "copyright": [ + "NONE" + ], + "spdx": "NONE" + }, + "type": "group" + }, { "license": { "copyright": [ ``` r? `@Kobzol` cc #147422
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#146865 (kcfi: only reify trait methods when dyn-compatible) - rust-lang#147205 (Add a new `wasm32-wasip3` target to Rust) - rust-lang#147322 (cg_llvm: Consistently import `llvm::Type` and `llvm::Value`) - rust-lang#147398 (Fix; correct placement of type inference error for method calls) - rust-lang#147410 (Update `S-waiting-on-team` refs to new `S-waiting-on-{team}` labels) - rust-lang#147422 (collect-license-metadata: Print a diff of the expected output) - rust-lang#147431 (compiletest: Read the whole test file before parsing directives) - rust-lang#147433 (Fix doc comment) Failed merges: - rust-lang#147390 (Use globals instead of metadata for std::autodiff) r? `@ghost` `@rustbot` modify labels: rollup
Previously,
x test collect-license-metadata
gave the following message on errors:Notable, this doesn't actually say what went wrong. Print a diff in addition so it's more clear what broke:
Currently, this prints the entire text of the JSON file as context. That's not ideal, but it's rare for this to fail, so I think it's ok for now.
I considered using
assert_json_diff
instead ofsimilar
, but its errors are a lot harder to read IMO, even though they are better at omitting unnecessary context: