From ebc55e9b42720d1c33b829c1ed4eac627faebb03 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Sat, 30 Dec 2023 16:55:21 -0800 Subject: [PATCH] Use new support for SPDX check exclusions Update the SPDX check and test configuration machinery from rra-c-util and use the new support for excluding paths from SPDX checks. --- tests/data/perl.conf | 7 ++++--- tests/docs/spdx-license-t | 3 ++- tests/tap/perl/Test/RRA/Config.pm | 13 ++++++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/data/perl.conf b/tests/data/perl.conf index 43db7b4..fd26d5a 100644 --- a/tests/data/perl.conf +++ b/tests/data/perl.conf @@ -3,8 +3,12 @@ # Ignore the script in cracklib for Perl style checking. This is verbatim # from CrackLib and isn't useful to rewrite. @CRITIC_IGNORE = qw(cracklib); +@SPDX_IGNORE = (qr{ \A cracklib/ }xms); @STRICT_IGNORE = qw(cracklib); +# Default minimum version requirement for included Perl scripts. +$MINIMUM_VERSION = '5.010'; + # The Heimdal history implementation uses a bunch of modules, but may not be # of interest to all users. Skip strict testing if its prerequisites aren't # installed. @@ -13,8 +17,5 @@ Readonly ); -# Default minimum version requirement for included Perl scripts. -$MINIMUM_VERSION = '5.010'; - # File must end with this line. 1; diff --git a/tests/docs/spdx-license-t b/tests/docs/spdx-license-t index cf407ad..ea43c7c 100755 --- a/tests/docs/spdx-license-t +++ b/tests/docs/spdx-license-t @@ -39,6 +39,7 @@ use lib "$ENV{C_TAP_SOURCE}/tap/perl"; use Test::RRA qw(skip_unless_automated); use Test::RRA::Automake qw(all_files automake_setup); +use Test::RRA::Config qw(@SPDX_IGNORE); use File::Basename qw(basename); use Test::More; @@ -58,7 +59,7 @@ my @IGNORE = ( qr{ [.] output \z }xms, # Test data ); my @IGNORE_PATHS = ( - qr{ \A cracklib/ }xms, # Special case for krb5-strength + @SPDX_IGNORE, qr{ \A debian/ }xms, # Found in debian/* branches qr{ \A docs/metadata/ }xms, # Package license should be fine qr{ \A docs/protocol[.](html|txt) \z }xms, # Generated by xml2rfc diff --git a/tests/tap/perl/Test/RRA/Config.pm b/tests/tap/perl/Test/RRA/Config.pm index 0c6973c..99ae545 100644 --- a/tests/tap/perl/Test/RRA/Config.pm +++ b/tests/tap/perl/Test/RRA/Config.pm @@ -26,7 +26,7 @@ BEGIN { @EXPORT_OK = qw( $COVERAGE_LEVEL @COVERAGE_SKIP_TESTS @CRITIC_IGNORE $LIBRARY_PATH $MINIMUM_VERSION %MINIMUM_VERSION @MODULE_VERSION_IGNORE - @POD_COVERAGE_EXCLUDE @STRICT_IGNORE @STRICT_PREREQ + @POD_COVERAGE_EXCLUDE @SPDX_IGNORE @STRICT_IGNORE @STRICT_PREREQ ); # This version should match the corresponding rra-c-util release, but with @@ -62,6 +62,7 @@ our $MINIMUM_VERSION = '5.010'; our %MINIMUM_VERSION; our @MODULE_VERSION_IGNORE; our @POD_COVERAGE_EXCLUDE; +our @SPDX_IGNORE; our @STRICT_IGNORE; our @STRICT_PREREQ; @@ -76,7 +77,7 @@ __END__ =for stopwords Allbery rra-c-util Automake perlcritic .libs namespace subdirectory sublicense -MERCHANTABILITY NONINFRINGEMENT regexes +MERCHANTABILITY NONINFRINGEMENT regexes SPDX =head1 NAME @@ -159,6 +160,12 @@ testing. Normally, all methods have to be documented in the POD for a Perl module, but methods matching any of these regexes will be considered private and won't require documentation. +=item @SPDX_IGNORE + +Regexes that match files that should be excluded from SPDX license header +checks, in addition to the standard exclusions. The regular expression is +matched against the file path relative to the top of the source tree. + =item @STRICT_IGNORE Additional directories to ignore when doing recursive Test::Strict testing for @@ -183,7 +190,7 @@ Russ Allbery =head1 COPYRIGHT AND LICENSE -Copyright 2015-2016, 2019, 2021 Russ Allbery +Copyright 2015-2016, 2019, 2021, 2023 Russ Allbery Copyright 2013-2014 The Board of Trustees of the Leland Stanford Junior University -- 2.39.2