diff options
author | Daniel Stenberg <daniel@haxx.se> | 2023-01-28 11:22:35 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-01-29 10:27:28 +0100 |
commit | 0e293bacb19831362cadc68d3ed5cb6192b38209 (patch) | |
tree | f754a5e60f62d6092df6188fd90f0230970feb7a /scripts | |
parent | ffe3e3c4e1555e906f2e0e595587de328751d38b (diff) | |
download | curl-0e293bacb19831362cadc68d3ed5cb6192b38209.tar.gz |
copyright.pl: cease doing year verifications
As we have (mostly) removed the copyright year ranges.
Reported-by: Ryan Schmidt
Fixes #10345
Closes #10352
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/copyright.pl | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/scripts/copyright.pl b/scripts/copyright.pl index 7c4ce659d..f295107ad 100755 --- a/scripts/copyright.pl +++ b/scripts/copyright.pl @@ -59,7 +59,8 @@ sub scanfile { chomp; my $l = $_; # check for a copyright statement and save the years - if($l =~ /.* ?copyright .* *\d\d\d\d/i) { + if($l =~ /.* ?copyright .* (\d\d\d\d|)/i) { + my $count = 0; while($l =~ /([\d]{4})/g) { push @copyright, { year => $1, @@ -67,8 +68,19 @@ sub scanfile { col => index($l, $1), code => $l }; - $found++; + $count++; } + if(!$count) { + # year-less + push @copyright, { + year => -1, + line => $line, + col => index($l, $1), + code => $l + }; + $count++; + } + $found = $count; } if($l =~ /SPDX-License-Identifier:/) { $spdx = 1; @@ -84,8 +96,6 @@ sub scanfile { sub checkfile { my ($file, $skipped, $pattern) = @_; - my $fine = 0; - @copyright=(); $spdx = 0; my $found = scanfile($file); @@ -113,38 +123,12 @@ sub checkfile { return 2; } - my $commityear = undef; - @copyright = sort {$$b{year} cmp $$a{year}} @copyright; - - # if the file is modified, assume commit year this year - if(`git status -s -- $file` =~ /^ [MARCU]/) { - $commityear = (localtime(time))[5] + 1900; - } - else { - # min-parents=1 to ignore wrong initial commit in truncated repos - my $grl = `git rev-list --max-count=1 --min-parents=1 --timestamp HEAD -- $file`; - if($grl) { - chomp $grl; - $commityear = (localtime((split(/ /, $grl))[0]))[5] + 1900; - } - } - - if(defined($commityear) && scalar(@copyright) && - $copyright[0]{year} != $commityear) { - printf "$file:%d: copyright year out of date, should be $commityear, " . - "is $copyright[0]{year}\n", - $copyright[0]{line} if(!$skipped || $verbose); - $skips{$pattern}++ if($skipped); - } - else { - $fine = 1; - } - if($skipped && $fine) { + if($skipped) { print "$file:1: ignored superfluously by $pattern\n" if($verbose); $superf{$pattern}++; } - return $fine; + return 1; } sub dep5 { |