From f8a7123b276ed18e6cdd488818a8f4e5e3e1cf94 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 24 Nov 2022 17:25:35 +0100 Subject: [PATCH] address review feedback --- config.toml.example | 11 +++++++---- src/tools/collect-license-metadata/src/main.rs | 2 +- src/tools/collect-license-metadata/src/path_tree.rs | 4 +++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/config.toml.example b/config.toml.example index ffc6a330b9f..ca54cbd2d68 100644 --- a/config.toml.example +++ b/config.toml.example @@ -255,11 +255,14 @@ changelog-seen = 2 # Defaults to the Python interpreter used to execute x.py #python = "python" -# The path to the REUSE executable to use. REUSE will be used to gather -# the licensing information of the codebase. +# The path to the REUSE executable to use. Note that REUSE is not required in +# most cases, as our tooling relies on a cached (and shrinked) copy of the +# REUSE output present in the git repository and in our source tarballs. # -# If this is omitted, the cached licensing information present in the source -# tarball will have to be present. +# REUSE is only needed if your changes caused the overral licensing of the +# repository to change, and the cached copy has to be regenerated. +# +# Defaults to the "reuse" command in the system path. #reuse = "reuse" # Force Cargo to check that Cargo.lock describes the precise dependency diff --git a/src/tools/collect-license-metadata/src/main.rs b/src/tools/collect-license-metadata/src/main.rs index 0864408fd53..ca2a6f4b8c8 100644 --- a/src/tools/collect-license-metadata/src/main.rs +++ b/src/tools/collect-license-metadata/src/main.rs @@ -22,7 +22,7 @@ fn main() -> Result<(), Error> { std::fs::write( &dest, &serde_json::to_vec_pretty(&serde_json::json!({ - "files": crate::path_tree::strip_interning(tree, &interner), + "files": crate::path_tree::expand_interned_licenses(tree, &interner), }))?, )?; diff --git a/src/tools/collect-license-metadata/src/path_tree.rs b/src/tools/collect-license-metadata/src/path_tree.rs index fa4ae87bdad..133ff683737 100644 --- a/src/tools/collect-license-metadata/src/path_tree.rs +++ b/src/tools/collect-license-metadata/src/path_tree.rs @@ -270,7 +270,9 @@ pub(crate) fn build(mut input: Vec<(PathBuf, LicenseId)>) -> Node { Node::Root { childs } } -pub(crate) fn strip_interning( +/// Convert a `Node` into a `Node<&License>`, expanding all interned license IDs with a +/// reference to the actual license metadata. +pub(crate) fn expand_interned_licenses( node: Node, interner: &LicensesInterner, ) -> Node<&License> {