@@ -167,7 +167,7 @@ const EXCEPTIONS_RUSTC_PERF: ExceptionList = &[
167
167
( "brotli-decompressor" , "BSD-3-Clause/MIT" ) ,
168
168
( "encoding_rs" , "(Apache-2.0 OR MIT) AND BSD-3-Clause" ) ,
169
169
( "inferno" , "CDDL-1.0" ) ,
170
- ( "ring " , NON_STANDARD_LICENSE ) , // see EXCEPTIONS_NON_STANDARD_LICENSE_DEPS for more.
170
+ ( "option-ext " , "MPL-2.0" ) ,
171
171
( "ryu" , "Apache-2.0 OR BSL-1.0" ) ,
172
172
( "snap" , "BSD-3-Clause" ) ,
173
173
( "subtle" , "BSD-3-Clause" ) ,
@@ -226,20 +226,6 @@ const EXCEPTIONS_UEFI_QEMU_TEST: ExceptionList = &[
226
226
( "r-efi" , "MIT OR Apache-2.0 OR LGPL-2.1-or-later" ) , // LGPL is not acceptable, but we use it under MIT OR Apache-2.0
227
227
] ;
228
228
229
- /// Placeholder for non-standard license file.
230
- const NON_STANDARD_LICENSE : & str = "NON_STANDARD_LICENSE" ;
231
-
232
- /// These dependencies have non-standard licenses but are genenrally permitted.
233
- const EXCEPTIONS_NON_STANDARD_LICENSE_DEPS : & [ & str ] = & [
234
- // `ring` is included because it is an optional dependency of `hyper`,
235
- // which is a training data in rustc-perf for optimized build.
236
- // The license of it is generally `ISC AND MIT AND OpenSSL`,
237
- // though the `package.license` field is not set.
238
- //
239
- // See https://github.com/briansmith/ring/issues/902
240
- "ring" ,
241
- ] ;
242
-
243
229
const PERMITTED_DEPS_LOCATION : & str = concat ! ( file!( ) , ":" , line!( ) ) ;
244
230
245
231
/// Crates rustc is allowed to depend on. Avoid adding to the list if possible.
@@ -599,7 +585,7 @@ pub fn check(root: &Path, cargo: &Path, bless: bool, bad: &mut bool) {
599
585
. other_options ( vec ! [ "--locked" . to_owned( ) ] ) ;
600
586
let metadata = t ! ( cmd. exec( ) ) ;
601
587
602
- check_license_exceptions ( & metadata, exceptions, bad) ;
588
+ check_license_exceptions ( & metadata, workspace , exceptions, bad) ;
603
589
if let Some ( ( crates, permitted_deps) ) = permitted_deps {
604
590
check_permitted_dependencies ( & metadata, workspace, permitted_deps, crates, bad) ;
605
591
}
@@ -730,14 +716,19 @@ fn check_runtime_license_exceptions(metadata: &Metadata, bad: &mut bool) {
730
716
/// Check that all licenses of tool dependencies are in the valid list in `LICENSES`.
731
717
///
732
718
/// Packages listed in `exceptions` are allowed for tools.
733
- fn check_license_exceptions ( metadata : & Metadata , exceptions : & [ ( & str , & str ) ] , bad : & mut bool ) {
719
+ fn check_license_exceptions (
720
+ metadata : & Metadata ,
721
+ workspace : & str ,
722
+ exceptions : & [ ( & str , & str ) ] ,
723
+ bad : & mut bool ,
724
+ ) {
734
725
// Validate the EXCEPTIONS list hasn't changed.
735
726
for ( name, license) in exceptions {
736
727
// Check that the package actually exists.
737
728
if !metadata. packages . iter ( ) . any ( |p| * p. name == * name) {
738
729
tidy_error ! (
739
730
bad,
740
- "could not find exception package `{}`\n \
731
+ "could not find exception package `{}` in workspace `{workspace}` \n \
741
732
Remove from EXCEPTIONS list if it is no longer used.",
742
733
name
743
734
) ;
@@ -746,20 +737,17 @@ fn check_license_exceptions(metadata: &Metadata, exceptions: &[(&str, &str)], ba
746
737
for pkg in metadata. packages . iter ( ) . filter ( |p| * p. name == * name) {
747
738
match & pkg. license {
748
739
None => {
749
- if * license == NON_STANDARD_LICENSE
750
- && EXCEPTIONS_NON_STANDARD_LICENSE_DEPS . contains ( & pkg. name . as_str ( ) )
751
- {
752
- continue ;
753
- }
754
740
tidy_error ! (
755
741
bad,
756
- "dependency exception `{}` does not declare a license expression" ,
742
+ "dependency exception `{}` in workspace `{workspace}` does not declare a license expression" ,
757
743
pkg. id
758
744
) ;
759
745
}
760
746
Some ( pkg_license) => {
761
747
if pkg_license. as_str ( ) != * license {
762
- println ! ( "dependency exception `{name}` license has changed" ) ;
748
+ println ! (
749
+ "dependency exception `{name}` license in workspace `{workspace}` has changed"
750
+ ) ;
763
751
println ! ( " previously `{license}` now `{pkg_license}`" ) ;
764
752
println ! ( " update EXCEPTIONS for the new license" ) ;
765
753
* bad = true ;
@@ -783,12 +771,21 @@ fn check_license_exceptions(metadata: &Metadata, exceptions: &[(&str, &str)], ba
783
771
let license = match & pkg. license {
784
772
Some ( license) => license,
785
773
None => {
786
- tidy_error ! ( bad, "dependency `{}` does not define a license expression" , pkg. id) ;
774
+ tidy_error ! (
775
+ bad,
776
+ "dependency `{}` in workspace `{workspace}` does not define a license expression" ,
777
+ pkg. id
778
+ ) ;
787
779
continue ;
788
780
}
789
781
} ;
790
782
if !LICENSES . contains ( & license. as_str ( ) ) {
791
- tidy_error ! ( bad, "invalid license `{}` in `{}`" , license, pkg. id) ;
783
+ tidy_error ! (
784
+ bad,
785
+ "invalid license `{}` for package `{}` in workspace `{workspace}`" ,
786
+ license,
787
+ pkg. id
788
+ ) ;
792
789
}
793
790
}
794
791
}
0 commit comments