diff options
Diffstat (limited to 'src/tools/copyright.pl')
-rwxr-xr-x | src/tools/copyright.pl | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/src/tools/copyright.pl b/src/tools/copyright.pl index d78a8d8ce88..e91672ec55f 100755 --- a/src/tools/copyright.pl +++ b/src/tools/copyright.pl @@ -14,42 +14,50 @@ use File::Find; use Tie::File; my $pgdg = 'PostgreSQL Global Development Group'; -my $cc = 'Copyright \(c\) '; +my $cc = 'Copyright \(c\) '; + # year-1900 is what localtime(time) puts in element 5 -my $year = 1900 + ${[localtime(time)]}[5]; +my $year = 1900 + ${ [ localtime(time) ] }[5]; print "Using current year: $year\n"; -find({wanted => \&wanted, no_chdir => 1}, '.'); +find({ wanted => \&wanted, no_chdir => 1 }, '.'); + +sub wanted +{ + + # prevent corruption of git indexes by ignoring any .git/ + if ($_ eq '.git') + { + $File::Find::prune = 1; + return; + } -sub wanted { - # prevent corruption of git indexes by ignoring any .git/ - if ($_ eq '.git') - { - $File::Find::prune = 1; - return; - } + return if !-f $File::Find::name || -l $File::Find::name; - return if ! -f $File::Find::name || -l $File::Find::name; - # skip file names with binary extensions - # How are these updated? bjm 2012-01-02 - return if ($_ =~ m/\.(ico|bin)$); + # skip file names with binary extensions + # How are these updated? bjm 2012-01-02 + return + if ( + $_ =~ m/\.(ico|bin)$); my @lines; tie @lines, "Tie::File", $File::Find::name; foreach my $line (@lines) { # We only care about lines with a copyright notice. - next unless $line =~ m/$cc.*$pgdg/; - # We stop when we've done one substitution. This is both for - # efficiency and, at least in the case of this program, for - # correctness. - last if $line =~ m/$cc.*$year.*$pgdg/; - last if $line =~ s/($cc\d{4})(, $pgdg)/$1-$year$2/; - last if $line =~ s/($cc\d{4})-\d{4}(, $pgdg)/$1-$year$2/; - } - untie @lines; + next unless $line =~ m/$cc . *$pgdg /; + + # We stop when we've done one substitution. This is both for + # efficiency and, at least in the case of this program, for + # correctness. + last if $line =~ m/$cc.*$year.*$pgdg/; + last if $line =~ s/($cc\d{4})(, $pgdg)/$1-$year$2/; + last if $line =~ s/($cc\d{4})-\d{4}(, $pgdg)/$1-$year$2/; + } + untie @lines; } -print "Manually update doc/src/sgml/legal.sgml and src/interfaces/libpq/libpq.rc.in too\n"; +print +"Manually update doc/src/sgml/legal.sgml and src/interfaces/libpq/libpq.rc.in too\n"; |