mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Fix generate-copyright tool.
LLVM copyrights are now condensed to those reported in the .reuse/dep5 file.
This commit is contained in:
parent
daf6121001
commit
2d1cd45875
46
.reuse/dep5
46
.reuse/dep5
@ -1,8 +1,6 @@
|
|||||||
# WARNING: this metadata is currently incomplete, do not rely on it yet.
|
# WARNING: this metadata is currently incomplete, do not rely on it yet.
|
||||||
|
|
||||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
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
|
# 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
|
# 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)
|
Copyright: The Rust Project Developers (see https://thanks.rust-lang.org)
|
||||||
License: MIT or Apache-2.0
|
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
|
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)
|
The Rust Project Developers (see https://thanks.rust-lang.org)
|
||||||
License: Apache-2.0 WITH LLVM-exception AND (Apache-2.0 OR MIT)
|
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
|
Copyright: Nicolas Gallagher and Jonathan Neal
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
Files: src/librustdoc/html/static/css/themes/ayu.css
|
Files: src/librustdoc/html/static/css/rustdoc.css
|
||||||
Copyright: Ike Ku, Jessica Stokes, Leon Guan
|
Copyright: 2016 Ike Ku
|
||||||
The Rust Project Developers (see https://thanks.rust-lang.org)
|
The Rust Project Developers (see https://thanks.rust-lang.org)
|
||||||
License: MIT OR Apache-2.0
|
License: MIT OR Apache-2.0
|
||||||
|
|
||||||
Files: src/doc/rustc-dev-guide/mermaid.min.js
|
Files: src/doc/rustc-dev-guide/mermaid.min.js
|
||||||
Copyright: Knut Sveidqvist
|
Copyright: 2014-2021 Knut Sveidqvist
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
# Note that the LLVM submodule here only specifies the NCSA as the license for
|
Files: library/backtrace/*
|
||||||
# LLVM, even though LLVM is in the process of a relicensing to Apache 2.0 with
|
Copyright: 2014 Alex Crichton
|
||||||
# the LLVM Exception. That's because relicensed files have a SPDX header with
|
The Rust Project Developers (see https://thanks.rust-lang.org)
|
||||||
# the correct license, so it will automatically be included here.
|
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/*
|
Files: src/llvm-project/*
|
||||||
Copyright: The LLVM Authors
|
Copyright: 2003-2019 by the contributors listed in [CREDITS.TXT](https://github.com/rust-lang/llvm-project/blob/7738295178045041669876bf32b0543ec8319a5c/llvm/CREDITS.TXT)
|
||||||
License: NCSA
|
2010 Apple Inc
|
||||||
|
2003-2019 University of Illinois at Urbana-Champaign.
|
||||||
|
License: NCSA OR Apache-2.0 WITH LLVM-exception
|
||||||
|
@ -6,6 +6,16 @@ use crate::licenses::LicensesInterner;
|
|||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use std::path::PathBuf;
|
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> {
|
fn main() -> Result<(), Error> {
|
||||||
let reuse_exe: PathBuf = std::env::var_os("REUSE_EXE").expect("Missing REUSE_EXE").into();
|
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();
|
let dest: PathBuf = std::env::var_os("DEST").expect("Missing DEST").into();
|
||||||
|
@ -7,11 +7,6 @@ use crate::licenses::{License, LicenseId, LicensesInterner};
|
|||||||
use std::collections::{BTreeMap, BTreeSet};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
use std::path::{Path, PathBuf};
|
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)]
|
#[derive(serde::Serialize)]
|
||||||
#[serde(rename_all = "kebab-case", tag = "type")]
|
#[serde(rename_all = "kebab-case", tag = "type")]
|
||||||
pub(crate) enum Node<L> {
|
pub(crate) enum Node<L> {
|
||||||
@ -310,12 +305,17 @@ pub(crate) fn build(mut input: Vec<(PathBuf, LicenseId)>) -> Node<LicenseId> {
|
|||||||
let mut condensed_directories = BTreeMap::new();
|
let mut condensed_directories = BTreeMap::new();
|
||||||
'outer: for (path, license) in input {
|
'outer: for (path, license) in input {
|
||||||
// Files in condensed directories are handled separately.
|
// Files in condensed directories are handled separately.
|
||||||
for directory in CONDENSED_DIRECTORIED {
|
for (condensed_directory, allowed_file) in super::CONDENSED_DIRECTORIES {
|
||||||
if path.starts_with(directory) {
|
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
|
condensed_directories
|
||||||
.entry(*directory)
|
.entry(*condensed_directory)
|
||||||
.or_insert_with(BTreeSet::new)
|
.or_insert_with(BTreeSet::new)
|
||||||
.insert(license);
|
.insert(license);
|
||||||
|
} else {
|
||||||
|
// don't add the file
|
||||||
|
}
|
||||||
continue 'outer;
|
continue 'outer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,9 +338,9 @@ pub(crate) fn build(mut input: Vec<(PathBuf, LicenseId)>) -> Node<LicenseId> {
|
|||||||
name: path.file_name().unwrap().into(),
|
name: path.file_name().unwrap().into(),
|
||||||
licenses: licenses.iter().copied().collect(),
|
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 {
|
node = Node::Directory {
|
||||||
name: name.as_os_str().into(),
|
name: component.as_os_str().into(),
|
||||||
children: vec![node],
|
children: vec![node],
|
||||||
license: None,
|
license: None,
|
||||||
};
|
};
|
||||||
|
@ -27,7 +27,7 @@ fn render_recursive(node: &Node, buffer: &mut Vec<u8>, depth: usize) -> Result<(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Node::Directory { name, children, license } => {
|
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() {
|
if !children.is_empty() {
|
||||||
writeln!(buffer, "{prefix}")?;
|
writeln!(buffer, "{prefix}")?;
|
||||||
writeln!(buffer, "{prefix}*Exceptions:*")?;
|
writeln!(buffer, "{prefix}*Exceptions:*")?;
|
||||||
@ -94,7 +94,7 @@ struct Metadata {
|
|||||||
#[serde(rename_all = "kebab-case", tag = "type")]
|
#[serde(rename_all = "kebab-case", tag = "type")]
|
||||||
pub(crate) enum Node {
|
pub(crate) enum Node {
|
||||||
Root { children: Vec<Node> },
|
Root { children: Vec<Node> },
|
||||||
Directory { name: String, children: Vec<Node>, license: License },
|
Directory { name: String, children: Vec<Node>, license: Option<License> },
|
||||||
CondensedDirectory { name: String, licenses: Vec<License> },
|
CondensedDirectory { name: String, licenses: Vec<License> },
|
||||||
File { name: String, license: License },
|
File { name: String, license: License },
|
||||||
Group { files: Vec<String>, directories: Vec<String>, license: License },
|
Group { files: Vec<String>, directories: Vec<String>, license: License },
|
||||||
|
Loading…
Reference in New Issue
Block a user