mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Remove use of 'tie' in perl for copyright.pl; instead use normal file
open/close.
This commit is contained in:
@ -22,12 +22,14 @@ print "Using current year: $year\n";
|
|||||||
find({wanted => \&wanted, no_chdir => 1}, '.');
|
find({wanted => \&wanted, no_chdir => 1}, '.');
|
||||||
|
|
||||||
sub wanted {
|
sub wanted {
|
||||||
return unless -f $File::Find::name;
|
my $filename = $File::Find::name;
|
||||||
|
|
||||||
my @lines;
|
# only regular files
|
||||||
tie @lines, Tie::File, $File::Find::name;
|
return if ! -f $filename;
|
||||||
|
|
||||||
foreach my $line (@lines) {
|
open(my $FILE, '<', $filename) or die "Cannot open $filename";
|
||||||
|
|
||||||
|
foreach my $line (<$FILE>) {
|
||||||
# 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/;
|
||||||
# We stop when we've done one substitution. This is both for
|
# We stop when we've done one substitution. This is both for
|
||||||
@ -37,7 +39,7 @@ sub wanted {
|
|||||||
last if $line =~ s/($cc\d{4})(, $pgdg)/$1-$year$2/;
|
last if $line =~ s/($cc\d{4})(, $pgdg)/$1-$year$2/;
|
||||||
last if $line =~ s/($cc\d{4})-\d{4}(, $pgdg)/$1-$year$2/;
|
last if $line =~ s/($cc\d{4})-\d{4}(, $pgdg)/$1-$year$2/;
|
||||||
}
|
}
|
||||||
untie @lines;
|
close($FILE) or die "Cannot close $filename";
|
||||||
}
|
}
|
||||||
|
|
||||||
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";
|
||||||
|
Reference in New Issue
Block a user