Skip to content

Commit 3778703

Browse files
committed
tidy: add license exceptions for rustc-perf
`ring` is included because it is an optional dependency of `hyper`, which is a training data in rustc-pref for optimized build. The license of it is generally `ISC AND MIT AND OpenSSL`, though the `package.license` field is not set. See briansmith/ring#902 `git+https://github.com/rust-lang/team` git source is from `rust_team_data`, which is used by `site` in src/tools/rustc-perf. This doesn't really a part of the compiler, so doesn't really affect the bootstrapping process. See rust-lang/rustc-perf#1914.
1 parent e24be07 commit 3778703

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

src/tools/tidy/src/deps.rs

+36
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pub(crate) const WORKSPACES: &[(&str, ExceptionList, Option<(&[&str], &[&str])>)
6767
//("src/tools/miri/test-cargo-miri", &[], None), // FIXME uncomment once all deps are vendored
6868
//("src/tools/miri/test_dependencies", &[], None), // FIXME uncomment once all deps are vendored
6969
("src/tools/rust-analyzer", EXCEPTIONS_RUST_ANALYZER, None),
70+
("src/tools/rustc-perf", EXCEPTIONS_RUSTC_PERF, None),
7071
("src/tools/x", &[], None),
7172
// tidy-alphabetical-end
7273
];
@@ -142,6 +143,22 @@ const EXCEPTIONS_RUST_ANALYZER: ExceptionList = &[
142143
// tidy-alphabetical-end
143144
];
144145

146+
const EXCEPTIONS_RUSTC_PERF: ExceptionList = &[
147+
// tidy-alphabetical-start
148+
("alloc-no-stdlib", "BSD-3-Clause"),
149+
("alloc-stdlib", "BSD-3-Clause"),
150+
("brotli", "BSD-3-Clause/MIT"),
151+
("brotli-decompressor", "BSD-3-Clause/MIT"),
152+
("encoding_rs", "(Apache-2.0 OR MIT) AND BSD-3-Clause"),
153+
("inferno", "CDDL-1.0"),
154+
("instant", "BSD-3-Clause"),
155+
("ring", NON_STANDARD_LICENSE), // see EXCEPTIONS_NON_STANDARD_LICENSE_DEPS for more.
156+
("ryu", "Apache-2.0 OR BSL-1.0"),
157+
("snap", "BSD-3-Clause"),
158+
("subtle", "BSD-3-Clause"),
159+
// tidy-alphabetical-end
160+
];
161+
145162
const EXCEPTIONS_CRANELIFT: ExceptionList = &[
146163
// tidy-alphabetical-start
147164
("cranelift-bforest", "Apache-2.0 WITH LLVM-exception"),
@@ -178,6 +195,20 @@ const EXCEPTIONS_UEFI_QEMU_TEST: ExceptionList = &[
178195
("r-efi", "MIT OR Apache-2.0 OR LGPL-2.1-or-later"), // LGPL is not acceptible, but we use it under MIT OR Apache-2.0
179196
];
180197

198+
/// Placeholder for non-standard license file.
199+
const NON_STANDARD_LICENSE: &str = "NON_STANDARD_LICENSE";
200+
201+
/// These dependencies have non-standard licenses but are genenrally permitted.
202+
const EXCEPTIONS_NON_STANDARD_LICENSE_DEPS: &[&str] = &[
203+
// `ring` is included because it is an optional dependency of `hyper`,
204+
// which is a training data in rustc-perf for optimized build.
205+
// The license of it is generally `ISC AND MIT AND OpenSSL`,
206+
// though the `package.license` field is not set.
207+
//
208+
// See https://github.com/briansmith/ring/issues/902
209+
"ring",
210+
];
211+
181212
/// These are the root crates that are part of the runtime. The licenses for
182213
/// these and all their dependencies *must not* be in the exception list.
183214
const RUNTIME_CRATES: &[&str] = &["std", "core", "alloc", "test", "panic_abort", "panic_unwind"];
@@ -610,6 +641,11 @@ fn check_license_exceptions(metadata: &Metadata, exceptions: &[(&str, &str)], ba
610641
for pkg in metadata.packages.iter().filter(|p| p.name == *name) {
611642
match &pkg.license {
612643
None => {
644+
if *license == NON_STANDARD_LICENSE
645+
&& EXCEPTIONS_NON_STANDARD_LICENSE_DEPS.contains(&pkg.name.as_str())
646+
{
647+
continue;
648+
}
613649
tidy_error!(
614650
bad,
615651
"dependency exception `{}` does not declare a license expression",

src/tools/tidy/src/extdeps.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ use std::fs;
44
use std::path::Path;
55

66
/// List of allowed sources for packages.
7-
const ALLOWED_SOURCES: &[&str] = &["\"registry+https://github.com/rust-lang/crates.io-index\""];
7+
const ALLOWED_SOURCES: &[&str] = &[
8+
r#""registry+https://github.com/rust-lang/crates.io-index""#,
9+
// This is `rust_team_data` used by `site` in src/tools/rustc-perf,
10+
r#""git+https://github.com/rust-lang/team#a5260e76d3aa894c64c56e6ddc8545b9a98043ec""#,
11+
];
812

913
/// Checks for external package sources. `root` is the path to the directory that contains the
1014
/// workspace `Cargo.toml`.

0 commit comments

Comments
 (0)