diff --git a/.reuse/dep5 b/.reuse/dep5 index 61fe0f3a429..55f46e3bc21 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -1,8 +1,6 @@ # WARNING: this metadata is currently incomplete, do not rely on it yet. Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Files-Excluded: - src/llvm-project # Note that we're explicitly listing the individual files at the root of the # repository rather than just having `Files: *`. This is explicitly done to @@ -39,13 +37,8 @@ Files: compiler/* Copyright: The Rust Project Developers (see https://thanks.rust-lang.org) License: MIT or Apache-2.0 -Files: compiler/rustc_codegen_cranelift/src/cranelift_native.rs -Copyright: The Cranelift Project Developers - The Rust Project Developers (see https://thanks.rust-lang.org) -License: Apache-2.0 WITH LLVM-exception AND (Apache-2.0 OR MIT) - Files: compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp -Copyright: LLVM authors +Copyright: 2003-2019 University of Illinois at Urbana-Champaign. The Rust Project Developers (see https://thanks.rust-lang.org) License: Apache-2.0 WITH LLVM-exception AND (Apache-2.0 OR MIT) @@ -85,19 +78,38 @@ Files: src/librustdoc/html/static/css/normalize.css Copyright: Nicolas Gallagher and Jonathan Neal License: MIT -Files: src/librustdoc/html/static/css/themes/ayu.css -Copyright: Ike Ku, Jessica Stokes, Leon Guan +Files: src/librustdoc/html/static/css/rustdoc.css +Copyright: 2016 Ike Ku The Rust Project Developers (see https://thanks.rust-lang.org) License: MIT OR Apache-2.0 Files: src/doc/rustc-dev-guide/mermaid.min.js -Copyright: Knut Sveidqvist +Copyright: 2014-2021 Knut Sveidqvist License: MIT -# Note that the LLVM submodule here only specifies the NCSA as the license for -# LLVM, even though LLVM is in the process of a relicensing to Apache 2.0 with -# the LLVM Exception. That's because relicensed files have a SPDX header with -# the correct license, so it will automatically be included here. +Files: library/backtrace/* +Copyright: 2014 Alex Crichton + The Rust Project Developers (see https://thanks.rust-lang.org) +License: MIT OR Apache-2.0 + +Files: src/doc/embedded-book/* +Copyright: Rust on Embedded Devices Working Group + The Rust Project Developers (see https://thanks.rust-lang.org) +License: MIT OR Apache-2.0 OR CC-BY-SA-4.0 + +Files: src/doc/rust-by-example/* +Copyright: 2014 Jorge Aparicio + The Rust Project Developers (see https://thanks.rust-lang.org) +License: MIT OR Apache-2.0 + +# Reuse cannot process the LLVM source tree, and so the copyrights for the LLVM +# submodule are written out here manually. The collect-licence-metadata tool +# has a specific exception coded within it to ignore ./src/llvm-project so +# any time LLVM is updated, please revisit this section. The copyrights are +# taken from the relevant LLVM sub-folders: llvm, lld, lldb, compiler-rt and libunwind. + Files: src/llvm-project/* -Copyright: The LLVM Authors -License: NCSA +Copyright: 2003-2019 by the contributors listed in [CREDITS.TXT](https://github.com/rust-lang/llvm-project/blob/7738295178045041669876bf32b0543ec8319a5c/llvm/CREDITS.TXT) + 2010 Apple Inc + 2003-2019 University of Illinois at Urbana-Champaign. +License: NCSA OR Apache-2.0 WITH LLVM-exception diff --git a/src/tools/collect-license-metadata/src/main.rs b/src/tools/collect-license-metadata/src/main.rs index ca2a6f4b8c8..cbe94af3510 100644 --- a/src/tools/collect-license-metadata/src/main.rs +++ b/src/tools/collect-license-metadata/src/main.rs @@ -6,6 +6,16 @@ use crate::licenses::LicensesInterner; use anyhow::Error; use std::path::PathBuf; +// Some directories have too many slight license differences that'd result in a +// huge report, and could be considered a standalone project anyway. Those +// directories are "condensed" into a single licensing block for ease of +// reading, merging the licensing information. +// +// For every `(dir, file)``, every file in `dir` is considered to have the +// license info of `file`. +const CONDENSED_DIRECTORIES: &[(&str, &str)] = + &[("./src/llvm-project/", "./src/llvm-project/README.md")]; + fn main() -> Result<(), Error> { let reuse_exe: PathBuf = std::env::var_os("REUSE_EXE").expect("Missing REUSE_EXE").into(); let dest: PathBuf = std::env::var_os("DEST").expect("Missing DEST").into(); diff --git a/src/tools/collect-license-metadata/src/path_tree.rs b/src/tools/collect-license-metadata/src/path_tree.rs index 376dd8e3e66..fc8756d9a2e 100644 --- a/src/tools/collect-license-metadata/src/path_tree.rs +++ b/src/tools/collect-license-metadata/src/path_tree.rs @@ -7,11 +7,6 @@ use crate::licenses::{License, LicenseId, LicensesInterner}; use std::collections::{BTreeMap, BTreeSet}; use std::path::{Path, PathBuf}; -// Some directories have too many slight license differences that'd result in a huge report, and -// could be considered a standalone project anyway. Those directories are "condensed" into a single -// licensing block for ease of reading, merging the licensing information. -const CONDENSED_DIRECTORIED: &[&str] = &["./src/llvm-project/"]; - #[derive(serde::Serialize)] #[serde(rename_all = "kebab-case", tag = "type")] pub(crate) enum Node { @@ -310,12 +305,17 @@ pub(crate) fn build(mut input: Vec<(PathBuf, LicenseId)>) -> Node { let mut condensed_directories = BTreeMap::new(); 'outer: for (path, license) in input { // Files in condensed directories are handled separately. - for directory in CONDENSED_DIRECTORIED { - if path.starts_with(directory) { - condensed_directories - .entry(*directory) - .or_insert_with(BTreeSet::new) - .insert(license); + for (condensed_directory, allowed_file) in super::CONDENSED_DIRECTORIES { + if path.starts_with(condensed_directory) { + if path.as_path() == Path::new(allowed_file) { + // The licence on our allowed file is used to represent the entire directory + condensed_directories + .entry(*condensed_directory) + .or_insert_with(BTreeSet::new) + .insert(license); + } else { + // don't add the file + } continue 'outer; } } @@ -338,9 +338,9 @@ pub(crate) fn build(mut input: Vec<(PathBuf, LicenseId)>) -> Node { name: path.file_name().unwrap().into(), licenses: licenses.iter().copied().collect(), }; - for name in path.parent().unwrap_or_else(|| Path::new(".")).components().rev() { + for component in path.parent().unwrap_or_else(|| Path::new(".")).components().rev() { node = Node::Directory { - name: name.as_os_str().into(), + name: component.as_os_str().into(), children: vec![node], license: None, }; diff --git a/src/tools/generate-copyright/src/main.rs b/src/tools/generate-copyright/src/main.rs index 38f5ac91033..558e87290b0 100644 --- a/src/tools/generate-copyright/src/main.rs +++ b/src/tools/generate-copyright/src/main.rs @@ -27,7 +27,7 @@ fn render_recursive(node: &Node, buffer: &mut Vec, depth: usize) -> Result<( } } Node::Directory { name, children, license } => { - render_license(&prefix, std::iter::once(name), std::iter::once(license), buffer)?; + render_license(&prefix, std::iter::once(name), license.iter(), buffer)?; if !children.is_empty() { writeln!(buffer, "{prefix}")?; writeln!(buffer, "{prefix}*Exceptions:*")?; @@ -94,7 +94,7 @@ struct Metadata { #[serde(rename_all = "kebab-case", tag = "type")] pub(crate) enum Node { Root { children: Vec }, - Directory { name: String, children: Vec, license: License }, + Directory { name: String, children: Vec, license: Option }, CondensedDirectory { name: String, licenses: Vec }, File { name: String, license: License }, Group { files: Vec, directories: Vec, license: License },