@@ -167,7 +167,7 @@ const EXCEPTIONS_RUSTC_PERF: ExceptionList = &[
167167 ( "brotli-decompressor" , "BSD-3-Clause/MIT" ) ,
168168 ( "encoding_rs" , "(Apache-2.0 OR MIT) AND BSD-3-Clause" ) ,
169169 ( "inferno" , "CDDL-1.0" ) ,
170- ( "ring " , NON_STANDARD_LICENSE ) , // see EXCEPTIONS_NON_STANDARD_LICENSE_DEPS for more.
170+ ( "option-ext " , "MPL-2.0" ) ,
171171 ( "ryu" , "Apache-2.0 OR BSL-1.0" ) ,
172172 ( "snap" , "BSD-3-Clause" ) ,
173173 ( "subtle" , "BSD-3-Clause" ) ,
@@ -226,20 +226,6 @@ const EXCEPTIONS_UEFI_QEMU_TEST: ExceptionList = &[
226226 ( "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
227227] ;
228228
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-
243229const PERMITTED_DEPS_LOCATION : & str = concat ! ( file!( ) , ":" , line!( ) ) ;
244230
245231/// 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) {
599585 . other_options ( vec ! [ "--locked" . to_owned( ) ] ) ;
600586 let metadata = t ! ( cmd. exec( ) ) ;
601587
602- check_license_exceptions ( & metadata, exceptions, bad) ;
588+ check_license_exceptions ( & metadata, workspace , exceptions, bad) ;
603589 if let Some ( ( crates, permitted_deps) ) = permitted_deps {
604590 check_permitted_dependencies ( & metadata, workspace, permitted_deps, crates, bad) ;
605591 }
@@ -730,14 +716,19 @@ fn check_runtime_license_exceptions(metadata: &Metadata, bad: &mut bool) {
730716/// Check that all licenses of tool dependencies are in the valid list in `LICENSES`.
731717///
732718/// 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+ ) {
734725 // Validate the EXCEPTIONS list hasn't changed.
735726 for ( name, license) in exceptions {
736727 // Check that the package actually exists.
737728 if !metadata. packages . iter ( ) . any ( |p| * p. name == * name) {
738729 tidy_error ! (
739730 bad,
740- "could not find exception package `{}`\n \
731+ "could not find exception package `{}` in workspace `{workspace}` \n \
741732 Remove from EXCEPTIONS list if it is no longer used.",
742733 name
743734 ) ;
@@ -746,20 +737,17 @@ fn check_license_exceptions(metadata: &Metadata, exceptions: &[(&str, &str)], ba
746737 for pkg in metadata. packages . iter ( ) . filter ( |p| * p. name == * name) {
747738 match & pkg. license {
748739 None => {
749- if * license == NON_STANDARD_LICENSE
750- && EXCEPTIONS_NON_STANDARD_LICENSE_DEPS . contains ( & pkg. name . as_str ( ) )
751- {
752- continue ;
753- }
754740 tidy_error ! (
755741 bad,
756- "dependency exception `{}` does not declare a license expression" ,
742+ "dependency exception `{}` in workspace `{workspace}` does not declare a license expression" ,
757743 pkg. id
758744 ) ;
759745 }
760746 Some ( pkg_license) => {
761747 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+ ) ;
763751 println ! ( " previously `{license}` now `{pkg_license}`" ) ;
764752 println ! ( " update EXCEPTIONS for the new license" ) ;
765753 * bad = true ;
@@ -783,12 +771,21 @@ fn check_license_exceptions(metadata: &Metadata, exceptions: &[(&str, &str)], ba
783771 let license = match & pkg. license {
784772 Some ( license) => license,
785773 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+ ) ;
787779 continue ;
788780 }
789781 } ;
790782 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+ ) ;
792789 }
793790 }
794791}
0 commit comments