Skip to content

Commit 937f915

Browse files
authored
Rollup merge of #133461 - ferrocene:add-copyright-files-to-dist, r=Kobzol,traviscross
Add COPYRIGHT-*.html files to distribution and update `COPYRIGHT` * Updates the `COPYRIGHT` file to describe how we actually do things now, and removes the licence text from it as they are stored elsewhere. * dist tarballs get all of the files in `LICENSES/*`. * This folder is managed by `reuse` and each file exists because we refer to the licence somewhere in our tree. We should be supplying these licence texts to anyone who obtains a copy of the source code and now we do. * The binary rust tarball gets `COPYRIGHT.html` and `COPYRIGHT-library.html`, which are auto-generated files that describe the licence information for both the in-tree source files used to build the Rust toolchain, and the out-of-tree dependencies we used to build the toolchain. * The other binary tarballs are unchanged, for now. In future you need to make a call whether to ship multiple version of COPYRIGHT.html, or whether to try and make, for example, a cargo-specific COPYRIGHT.html file. * The `LICENSE-MIT` file now includes a blanket copyright statement, as the text indicates that it should and because users will expect to know who owns the copyright of the material they have been given (even if the answer is 'lots of people').
2 parents 7f75bfa + f9c1699 commit 937f915

File tree

6 files changed

+77
-395
lines changed

6 files changed

+77
-395
lines changed

COPYRIGHT

Lines changed: 21 additions & 371 deletions
Large diffs are not rendered by default.

LICENSE-MIT

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Copyright (c) The Rust Project Contributors
2+
13
Permission is hereby granted, free of charge, to any
24
person obtaining a copy of this software and associated
35
documentation files (the "Software"), to deal in the

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -503,14 +503,22 @@ impl Step for Rustc {
503503
// Debugger scripts
504504
builder.ensure(DebuggerScripts { sysroot: image.to_owned(), host });
505505

506-
// Misc license info
507-
let cp = |file: &str| {
508-
builder.install(&builder.src.join(file), &image.join("share/doc/rust"), 0o644);
506+
// HTML copyright files
507+
let file_list = builder.ensure(super::run::GenerateCopyright);
508+
for file in file_list {
509+
builder.install(&file, &image.join("share/doc/rust"), 0o644);
510+
}
511+
512+
// README
513+
builder.install(&builder.src.join("README.md"), &image.join("share/doc/rust"), 0o644);
514+
515+
// The REUSE-managed license files
516+
let license = |path: &Path| {
517+
builder.install(path, &image.join("share/doc/rust/licences"), 0o644);
509518
};
510-
cp("COPYRIGHT");
511-
cp("LICENSE-APACHE");
512-
cp("LICENSE-MIT");
513-
cp("README.md");
519+
for entry in t!(std::fs::read_dir(builder.src.join("LICENSES"))).flatten() {
520+
license(&entry.path());
521+
}
514522
}
515523
}
516524
}
@@ -986,14 +994,15 @@ impl Step for PlainSourceTarball {
986994
"CONTRIBUTING.md",
987995
"README.md",
988996
"RELEASES.md",
997+
"REUSE.toml",
989998
"configure",
990999
"x.py",
9911000
"config.example.toml",
9921001
"Cargo.toml",
9931002
"Cargo.lock",
9941003
".gitmodules",
9951004
];
996-
let src_dirs = ["src", "compiler", "library", "tests"];
1005+
let src_dirs = ["src", "compiler", "library", "tests", "LICENSES"];
9971006

9981007
copy_src_dirs(builder, &builder.src, &src_dirs, &[], plain_dst_src);
9991008

src/bootstrap/src/core/build_steps/run.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl Step for CollectLicenseMetadata {
196196
pub struct GenerateCopyright;
197197

198198
impl Step for GenerateCopyright {
199-
type Output = PathBuf;
199+
type Output = Vec<PathBuf>;
200200
const ONLY_HOSTS: bool = true;
201201

202202
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -220,7 +220,7 @@ impl Step for GenerateCopyright {
220220
cmd.env("CARGO", &builder.initial_cargo);
221221
cmd.run(builder);
222222

223-
dest
223+
vec![dest, dest_libstd]
224224
}
225225
}
226226

src/tools/generate-copyright/templates/COPYRIGHT-library.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,31 @@
88

99
<h1>Copyright notices for The Rust Standard Library</h1>
1010

11-
<p>This file describes the copyright and licensing information for the Rust
12-
Standard Library source code within The Rust Project git tree, and the
13-
third-party dependencies used when building the Rust Standard Library.</p>
14-
1511
<h2>Table of Contents</h2>
1612
<ul>
13+
<li><a href="#short-version">Short version for non-lawyers</a></li>
14+
<li><a href="#longer-version">Longer version</a></li>
1715
<li><a href="#in-tree-files">In-tree files</a></li>
1816
<li><a href="#out-of-tree-dependencies">Out-of-tree dependencies</a></li>
1917
</ul>
2018

19+
<h2 id="short-version">Short version for non-lawyers</h2>
20+
21+
The Rust Standard Library is dual-licensed under Apache 2.0 and MIT terms.
22+
23+
<h2 id="longer-version">Longer version</h2>
24+
25+
<p>Copyrights in the Rust Standard Library are retained by their contributors. No copyright assignment is required to contribute to the Rust project.</p>
26+
27+
<p>Some files include explicit copyright notices and/or license notices. For full authorship information, see the version control history or <a href="https://thanks.rust-lang.org">https://thanks.rust-lang.org</a>.</p>
28+
29+
<p>Except as otherwise noted (below and/or in individual files), the Rust Standard Library is licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> or the <a href="http://opensource.org/licenses/MIT">MIT</a> license, at your option.</p>
30+
31+
<p>This file describes the copyright and licensing information for the source code within The Rust Project git tree related to the Rust Standard Library, and the third-party dependencies used when building the Rust Standard Library.</p>
32+
2133
<h2 id="in-tree-files">In-tree files</h2>
2234

23-
<p>The following licenses cover the in-tree source files that were used in this
24-
release:</p>
35+
<p>The following licenses cover the in-tree source files that were used in this release:</p>
2536

2637
{{ in_tree|safe }}
2738

src/tools/generate-copyright/templates/COPYRIGHT.html

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,37 @@
88

99
<h1>Copyright notices for The Rust Toolchain</h1>
1010

11-
<p>This file describes the copyright and licensing information for the source
12-
code within The Rust Project git tree, and the third-party dependencies used
13-
when building the Rust toolchain (including the Rust Standard Library).</p>
14-
1511
<h2>Table of Contents</h2>
1612
<ul>
13+
<li><a href="#short-version">Short version for non-lawyers</a></li>
14+
<li><a href="#longer-version">Longer version</a></li>
1715
<li><a href="#in-tree-files">In-tree files</a></li>
1816
<li><a href="#out-of-tree-dependencies">Out-of-tree dependencies</a></li>
1917
</ul>
2018

19+
<h2 id="short-version">Short version for non-lawyers</h2>
20+
21+
The Rust Project is dual-licensed under Apache 2.0 and MIT terms.
22+
23+
<h2 id="longer-version">Longer version</h2>
24+
25+
<p>Copyrights in the Rust project are retained by their contributors. No copyright assignment is required to contribute to the Rust project.</p>
26+
27+
<p>Some files include explicit copyright notices and/or license notices. For full authorship information, see the version control history or <a href="https://thanks.rust-lang.org">https://thanks.rust-lang.org</a>.</p>
28+
29+
<p>Except as otherwise noted (below and/or in individual files), Rust is licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a> or the <a href="http://opensource.org/licenses/MIT">MIT</a> license, at your option.</p>
30+
31+
<p>This file describes the copyright and licensing information for the source code within The Rust Project git tree, and the third-party dependencies used when building the Rust toolchain (including the Rust Standard Library).</p>
32+
2133
<h2 id="in-tree-files">In-tree files</h2>
2234

23-
<p>The following licenses cover the in-tree source files that were used in this
24-
release:</p>
35+
<p>The following licenses cover the in-tree source files that were used in this release:</p>
2536

2637
{{ in_tree|safe }}
2738

2839
<h2 id="out-of-tree-dependencies">Out-of-tree dependencies</h2>
2940

30-
<p>The following licenses cover the out-of-tree crates that were used in this
31-
release:</p>
41+
<p>The following licenses cover the out-of-tree crates that were used in this release:</p>
3242

3343
{% for (key, value) in dependencies %}
3444
<h3>📦 {{key.name}}-{{key.version}}</h3>

0 commit comments

Comments
 (0)