Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add COPYRIGHT-*.html files to distribution and update COPYRIGHT #133461

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
392 changes: 21 additions & 371 deletions COPYRIGHT

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Copyright (c) The Rust Project Contributors

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Expand Down
25 changes: 17 additions & 8 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,14 +503,22 @@ impl Step for Rustc {
// Debugger scripts
builder.ensure(DebuggerScripts { sysroot: image.to_owned(), host });

// Misc license info
let cp = |file: &str| {
builder.install(&builder.src.join(file), &image.join("share/doc/rust"), 0o644);
// HTML copyright files
let file_list = builder.ensure(super::run::GenerateCopyright);
for file in file_list {
builder.install(&file, &image.join("share/doc/rust"), 0o644);
}

// README
builder.install(&builder.src.join("README.md"), &image.join("share/doc/rust"), 0o644);

// The REUSE-managed license files
let license = |path: &Path| {
builder.install(path, &image.join("share/doc/rust/licences"), 0o644);
};
cp("COPYRIGHT");
Kobzol marked this conversation as resolved.
Show resolved Hide resolved
cp("LICENSE-APACHE");
cp("LICENSE-MIT");
cp("README.md");
for entry in t!(std::fs::read_dir(builder.src.join("LICENSES"))).flatten() {
license(&entry.path());
}
}
}
}
Expand Down Expand Up @@ -986,14 +994,15 @@ impl Step for PlainSourceTarball {
"CONTRIBUTING.md",
"README.md",
"RELEASES.md",
"REUSE.toml",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license-metadata.json should probably also be included in the source tarball. Otherwise, the build fails when trying to build from https://static.rust-lang.org/dist/2025-01-16/rustc-nightly-src.tar.xz.

Details
running: cd "/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src" && CARGO="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" DEST="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/COPYRIGHT.html" DEST_LIBSTD="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/COPYRIGHT-library.html" LD_LIBRARY_PATH="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/x86_64-unknown-linux-gnu/stage0/lib" LICENSE_METADATA="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/license-metadata.json" OUT_DIR="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build" RUSTC="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/x86_64-unknown-linux-gnu/stage0/bin/rustc" "/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/x86_64-unknown-linux-gnu/stage0-tools-bin/generate-copyright" (failure_mode=Exit) (created at src/bootstrap/src/core/build_steps/tool.rs:1195:23, executed at src/bootstrap/src/core/build_steps/run.rs:224:13)
Vendoring deps into /var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/vendor...
Vendoring deps into /var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/library-vendor...
Error: No such file or directory (os error 2)

Command cd "/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src" && CARGO="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" DEST="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/COPYRIGHT.html" DEST_LIBSTD="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/COPYRIGHT-library.html" LD_LIBRARY_PATH="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/x86_64-unknown-linux-gnu/stage0/lib" LICENSE_METADATA="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/license-metadata.json" OUT_DIR="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build" RUSTC="/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/x86_64-unknown-linux-gnu/stage0/bin/rustc" "/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/x86_64-unknown-linux-gnu/stage0-tools-bin/generate-copyright" (failure_mode=Exit) did not execute successfully.
Expected success, got exit status: 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1195:23
Executed at: src/bootstrap/src/core/build_steps/run.rs:224:13

Traceback (most recent call last):
  File "/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/x.py", line 53, in <module>
    bootstrap.main()
  File "/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/bootstrap.py", line 1337, in main
    bootstrap(args)
  File "/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/bootstrap.py", line 1312, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "/var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src/src/bootstrap/bootstrap.py", line 236, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /var/tmp/tmp-rust-x86_64-pc-linux-gnu/rustc-nightly-src.build_/build/bootstrap/debug/bootstrap install --stage 1 -j 4 -v
make[1]: *** [Makefile:913: build-only-rust_x86_64-pc-linux-gnu] Error 1
make[1]: Leaving directory '/data/mxe'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense - I can do that PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #135588

"configure",
"x.py",
"config.example.toml",
"Cargo.toml",
"Cargo.lock",
".gitmodules",
];
let src_dirs = ["src", "compiler", "library", "tests"];
let src_dirs = ["src", "compiler", "library", "tests", "LICENSES"];

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

Expand Down
7 changes: 5 additions & 2 deletions src/bootstrap/src/core/build_steps/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl Step for CollectLicenseMetadata {
pub struct GenerateCopyright;

impl Step for GenerateCopyright {
type Output = PathBuf;
type Output = Vec<PathBuf>;
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
Expand All @@ -218,9 +218,12 @@ impl Step for GenerateCopyright {
cmd.env("DEST_LIBSTD", &dest_libstd);
cmd.env("OUT_DIR", &builder.out);
cmd.env("CARGO", &builder.initial_cargo);
// it is important that generate-copyright runs from the root of the
// source tree, because it uses relative paths
cmd.current_dir(&builder.src);
cmd.run(builder);

dest
vec![dest, dest_libstd]
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/tools/generate-copyright/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ mod cargo_metadata;

/// The entry point to the binary.
///
/// You should probably let `bootstrap` execute this program instead of running it directly.
/// You should probably let `bootstrap` execute this program instead of running
/// it directly. It assumes that the current working directory is the root of a
/// Rust git repository checkout, and constructs a bunch of relative paths based
/// on that assumption.
///
/// Run `x.py run generate-copyright`
fn main() -> Result<(), Error> {
Expand Down
23 changes: 17 additions & 6 deletions src/tools/generate-copyright/templates/COPYRIGHT-library.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,31 @@

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

<p>This file describes the copyright and licensing information for the Rust
Standard Library source code within The Rust Project git tree, and the
third-party dependencies used when building the Rust Standard Library.</p>

<h2>Table of Contents</h2>
<ul>
<li><a href="#short-version">Short version for non-lawyers</a></li>
<li><a href="#longer-version">Longer version</a></li>
<li><a href="#in-tree-files">In-tree files</a></li>
<li><a href="#out-of-tree-dependencies">Out-of-tree dependencies</a></li>
</ul>

<h2 id="short-version">Short version for non-lawyers</h2>

The Rust Standard Library is dual-licensed under Apache 2.0 and MIT terms.

<h2 id="longer-version">Longer version</h2>

<p>Copyrights in the Rust Standard Library are retained by their contributors. No copyright assignment is required to contribute to the Rust project.</p>

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

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

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

<h2 id="in-tree-files">In-tree files</h2>

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

{{ in_tree|safe }}

Expand Down
26 changes: 18 additions & 8 deletions src/tools/generate-copyright/templates/COPYRIGHT.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,37 @@

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

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

<h2>Table of Contents</h2>
<ul>
<li><a href="#short-version">Short version for non-lawyers</a></li>
<li><a href="#longer-version">Longer version</a></li>
<li><a href="#in-tree-files">In-tree files</a></li>
<li><a href="#out-of-tree-dependencies">Out-of-tree dependencies</a></li>
</ul>

<h2 id="short-version">Short version for non-lawyers</h2>

The Rust Project is dual-licensed under Apache 2.0 and MIT terms.

<h2 id="longer-version">Longer version</h2>

<p>Copyrights in the Rust project are retained by their contributors. No copyright assignment is required to contribute to the Rust project.</p>

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

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

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

<h2 id="in-tree-files">In-tree files</h2>

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

{{ in_tree|safe }}

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

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

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