forked from github/verilator
Tests: Check for new .pl file copyrights
This commit is contained in:
parent
91c44d7830
commit
c2a8810eb1
@ -57,14 +57,26 @@ my $Exempt_Files_List_Re = '^(' . join('|', (map { quotemeta $_ } @Exempt_Files_
|
|||||||
if (!-r "$root/.git") {
|
if (!-r "$root/.git") {
|
||||||
skip("Not in a git repository");
|
skip("Not in a git repository");
|
||||||
} else {
|
} else {
|
||||||
my $files = `cd $root && git ls-files --exclude-standard`;
|
my $out = `cd $root && git ls-files --exclude-standard`;
|
||||||
my $year = strftime("%Y", localtime);
|
my $year = strftime("%Y", localtime);
|
||||||
|
my %files;
|
||||||
$files =~ s/\s+/ /g;
|
$out =~ s/\s+/ /g;
|
||||||
foreach my $filename (split /\s+/, $files) {
|
foreach my $filename (split /\s+/, $out) {
|
||||||
next if $filename =~ /$Exempt_Files_Re/;
|
next if $filename =~ /$Exempt_Files_Re/;
|
||||||
next if $filename =~ /$Exempt_Files_List_Re/;
|
next if $filename =~ /$Exempt_Files_List_Re/;
|
||||||
|
$files{$filename} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
my %added;
|
||||||
|
$out = `cd $root && git diff --name-status HEAD^^^^^`;
|
||||||
|
foreach my $line (split /\n/, $out) {
|
||||||
|
next if $line !~ /^A\s+(.*)/;
|
||||||
|
$added{$1} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $filename (sort keys %files) {
|
||||||
my $fh = IO::File->new("<$root/$filename") or error("$! $filename");
|
my $fh = IO::File->new("<$root/$filename") or error("$! $filename");
|
||||||
|
next if !$fh;
|
||||||
my $spdx;
|
my $spdx;
|
||||||
my $copyright;
|
my $copyright;
|
||||||
my $release;
|
my $release;
|
||||||
@ -73,14 +85,14 @@ if (!-r "$root/.git") {
|
|||||||
$spdx = $line;
|
$spdx = $line;
|
||||||
} elsif ($line =~ /Copyright 20[0-9][0-9]/) {
|
} elsif ($line =~ /Copyright 20[0-9][0-9]/) {
|
||||||
$copyright = $line;
|
$copyright = $line;
|
||||||
if ($line !~ /Wilson Snyder|Geza Lore/
|
if ($line =~ /Wilson Snyder/) {
|
||||||
&& !($filename =~ /test_regress/ && $line =~ /Antmicro|Todd Strader/)) {
|
} elsif (!$added{$filename} && $line =~ /Antmicro|Geza Lore|Todd Strader/) {
|
||||||
|
} elsif ($filename =~ /$Exempt_Author_Re/) {
|
||||||
|
} else {
|
||||||
my $yeardash = ($filename =~ m!test_regress/t!) ? $year : $year."-".$year;
|
my $yeardash = ($filename =~ m!test_regress/t!) ? $year : $year."-".$year;
|
||||||
if ($filename !~ /$Exempt_Author_Re/) {
|
|
||||||
warn " ".$copyright;
|
warn " ".$copyright;
|
||||||
error("$filename: Please use standard 'Copyright $yeardash by Wilson Snyder'");
|
error("$filename: Please use standard 'Copyright $yeardash by Wilson Snyder'");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} elsif ($line =~ m!Creative Commons Public Domain!
|
} elsif ($line =~ m!Creative Commons Public Domain!
|
||||||
|| $line =~ m!freely copied and/or distributed!
|
|| $line =~ m!freely copied and/or distributed!
|
||||||
|| $line =~ m!placed into the Public Domain!) {
|
|| $line =~ m!placed into the Public Domain!) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
#
|
#
|
||||||
# Copyright 2023 by Antmicro Ltd. This program is free software; you
|
# Copyright 2023 by Wilson Snyder. This program is free software; you
|
||||||
# can redistribute it and/or modify it under the terms of either the GNU
|
# can redistribute it and/or modify it under the terms of either the GNU
|
||||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
# Version 2.0.
|
# Version 2.0.
|
||||||
|
Loading…
Reference in New Issue
Block a user