Skip to content

Commit 27f3361

Browse files
committed
Auto merge of #133461 - ferrocene:add-copyright-files-to-dist, r=Kobzol
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'). try-job: x86_64-fuchsia
2 parents 341f603 + f7f2fa5 commit 27f3361

File tree

7 files changed

+84
-396
lines changed

7 files changed

+84
-396
lines changed

COPYRIGHT

+21-371
Large diffs are not rendered by default.

LICENSE-MIT

+2
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

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

507-
// Misc license info
508-
let cp = |file: &str| {
509-
builder.install(&builder.src.join(file), &image.join("share/doc/rust"), 0o644);
507+
// HTML copyright files
508+
let file_list = builder.ensure(super::run::GenerateCopyright);
509+
for file in file_list {
510+
builder.install(&file, &image.join("share/doc/rust"), 0o644);
511+
}
512+
513+
// README
514+
builder.install(&builder.src.join("README.md"), &image.join("share/doc/rust"), 0o644);
515+
516+
// The REUSE-managed license files
517+
let license = |path: &Path| {
518+
builder.install(path, &image.join("share/doc/rust/licences"), 0o644);
510519
};
511-
cp("COPYRIGHT");
512-
cp("LICENSE-APACHE");
513-
cp("LICENSE-MIT");
514-
cp("README.md");
520+
for entry in t!(std::fs::read_dir(builder.src.join("LICENSES"))).flatten() {
521+
license(&entry.path());
522+
}
515523
}
516524
}
517525
}
@@ -992,14 +1000,15 @@ impl Step for PlainSourceTarball {
9921000
"CONTRIBUTING.md",
9931001
"README.md",
9941002
"RELEASES.md",
1003+
"REUSE.toml",
9951004
"configure",
9961005
"x.py",
9971006
"config.example.toml",
9981007
"Cargo.toml",
9991008
"Cargo.lock",
10001009
".gitmodules",
10011010
];
1002-
let src_dirs = ["src", "compiler", "library", "tests"];
1011+
let src_dirs = ["src", "compiler", "library", "tests", "LICENSES"];
10031012

10041013
copy_src_dirs(builder, &builder.src, &src_dirs, &[], plain_dst_src);
10051014

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

+5-2
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<'_> {
@@ -218,9 +218,12 @@ impl Step for GenerateCopyright {
218218
cmd.env("DEST_LIBSTD", &dest_libstd);
219219
cmd.env("OUT_DIR", &builder.out);
220220
cmd.env("CARGO", &builder.initial_cargo);
221+
// it is important that generate-copyright runs from the root of the
222+
// source tree, because it uses relative paths
223+
cmd.current_dir(&builder.src);
221224
cmd.run(builder);
222225

223-
dest
226+
vec![dest, dest_libstd]
224227
}
225228
}
226229

src/tools/generate-copyright/src/main.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ mod cargo_metadata;
88

99
/// The entry point to the binary.
1010
///
11-
/// You should probably let `bootstrap` execute this program instead of running it directly.
11+
/// You should probably let `bootstrap` execute this program instead of running
12+
/// it directly. It assumes that the current working directory is the root of a
13+
/// Rust git repository checkout, and constructs a bunch of relative paths based
14+
/// on that assumption.
1215
///
1316
/// Run `x.py run generate-copyright`
1417
fn main() -> Result<(), Error> {

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

+17-6
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

+18-8
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)