mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
Make copyright.pl cope with nonstandard case choices in copyright notices.
The need for this is shown by the files it missed in Bruce's recent run. I fixed it so that it will actually adjust the case when needed. In passing, also make it skip .po files, since those will just get overwritten anyway from the translation repository.
This commit is contained in:
parent
48c9f2889a
commit
de7c8dbea1
@ -17,7 +17,8 @@ use File::Basename;
|
|||||||
use Tie::File;
|
use Tie::File;
|
||||||
|
|
||||||
my $pgdg = 'PostgreSQL Global Development Group';
|
my $pgdg = 'PostgreSQL Global Development Group';
|
||||||
my $cc = 'Copyright \(c\) ';
|
my $cc = 'Copyright \(c\)';
|
||||||
|
my $ccliteral = 'Copyright (c)';
|
||||||
|
|
||||||
# year-1900 is what localtime(time) puts in element 5
|
# year-1900 is what localtime(time) puts in element 5
|
||||||
my $year = 1900 + ${ [ localtime(time) ] }[5];
|
my $year = 1900 + ${ [ localtime(time) ] }[5];
|
||||||
@ -40,7 +41,7 @@ sub wanted
|
|||||||
|
|
||||||
# skip file names with binary extensions
|
# skip file names with binary extensions
|
||||||
# How are these updated? bjm 2012-01-02
|
# How are these updated? bjm 2012-01-02
|
||||||
return if ($_ =~ m/\.(ico|bin)$/);
|
return if ($_ =~ m/\.(ico|bin|po)$/);
|
||||||
|
|
||||||
my @lines;
|
my @lines;
|
||||||
tie @lines, "Tie::File", $File::Find::name;
|
tie @lines, "Tie::File", $File::Find::name;
|
||||||
@ -49,16 +50,16 @@ sub wanted
|
|||||||
{
|
{
|
||||||
|
|
||||||
# We only care about lines with a copyright notice.
|
# We only care about lines with a copyright notice.
|
||||||
next unless $line =~ m/$cc.*$pgdg/;
|
next unless $line =~ m/$cc.*$pgdg/i;
|
||||||
|
|
||||||
# Skip line if already matches the current year; if not
|
# Skip line if already matches the current year; if not
|
||||||
# we get $year-$year, e.g. 2012-2012
|
# we get $year-$year, e.g. 2012-2012
|
||||||
next if $line =~ m/$cc$year, $pgdg/;
|
next if $line =~ m/$cc $year, $pgdg/i;
|
||||||
|
|
||||||
# We process all lines because some files have copyright
|
# We process all lines because some files have copyright
|
||||||
# strings embedded in them, e.g. src/bin/psql/help.c
|
# strings embedded in them, e.g. src/bin/psql/help.c
|
||||||
$line =~ s/($cc\d{4})(, $pgdg)/$1-$year$2/;
|
$line =~ s/$cc (\d{4})-\d{4}, $pgdg/$ccliteral $1-$year, $pgdg/i;
|
||||||
$line =~ s/($cc\d{4})-\d{4}(, $pgdg)/$1-$year$2/;
|
$line =~ s/$cc (\d{4}), $pgdg/$ccliteral $1-$year, $pgdg/i;
|
||||||
}
|
}
|
||||||
untie @lines;
|
untie @lines;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user