aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2024-09-19 08:45:32 -0400
committerBruce Momjian <bruce@momjian.us>2024-09-19 08:45:32 -0400
commit681bbd07cccbbc5b3e3d94b908bb1d5431af16cc (patch)
treea57096c49a7672f88d4a4a3700d98d0eda6176dd
parentb0ae6db2088bbd1d16733b359c9c300735e9c21e (diff)
downloadpostgresql-681bbd07cccbbc5b3e3d94b908bb1d5431af16cc.tar.gz
postgresql-681bbd07cccbbc5b3e3d94b908bb1d5431af16cc.zip
Improve Perl script which adds commit links to release notes
Reported-by: Andrew Dunstan Discussion: https://postgr.es/m/b2465837-56df-4794-a0b5-5e6ed44ed870@dunslane.net Author: Andrew Dunstan Backpatch-through: 12
-rwxr-xr-xsrc/tools/add_commit_links.pl21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/tools/add_commit_links.pl b/src/tools/add_commit_links.pl
index ebfc97ea328..64a57832972 100755
--- a/src/tools/add_commit_links.pl
+++ b/src/tools/add_commit_links.pl
@@ -51,9 +51,8 @@ sub process_file
$file =~ m/-(\d+)\./;
my $major_version = $1;
- open(my $fh, '<', $file) || die "could not open file %s: $!\n", $file;
- open(my $tfh, '>', $tmpfile) || die "could not open file %s: $!\n",
- $tmpfile;
+ open(my $fh, '<', $file) || die "could not open file $file: $!\n";
+ open(my $tfh, '>', $tmpfile) || die "could not open file $tmpfile: $!\n";
while (<$fh>)
{
@@ -64,9 +63,9 @@ sub process_file
# skip over commit links because we will add them below
next
if (!$in_comment &&
- m{^\s*<ulink url="&commit_baseurl;[\da-f]+">&sect;</ulink>\s*$});
+ m{^\s*<ulink url="&commit_baseurl;[[:xdigit:]]+">&sect;</ulink>\s*$});
- if ($in_comment && m/\[([\da-f]+)\]/)
+ if ($in_comment && m/\[([[:xdigit:]]+)\]/)
{
my $hash = $1;
@@ -88,23 +87,21 @@ sub process_file
{
for my $hash (@hashes)
{
- print({$tfh}
- "$prev_leading_space<ulink url=\"&commit_baseurl;$hash\">&sect;</ulink>\n"
- );
+ print $tfh
+ "$prev_leading_space<ulink url=\"&commit_baseurl;$hash\">&sect;</ulink>\n";
}
@hashes = ();
}
else
{
- printf(
- "hashes found but no matching text found for placement on line %s\n",
- $lineno);
+ print
+ "hashes found but no matching text found for placement on line $lineno\n";
exit(1);
}
}
}
- print({$tfh} $_);
+ print $tfh $_;
$prev_line_ended_with_paren = m/\)\s*$/;