pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Bruce Momjian <bruce@momjian.us>
To: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: scripts: add Perl script to add links to release notes
Date: Tue, 17 Sep 2024 09:47:57 -0400
Message-ID: <b2465837-56df-4794-a0b5-5e6ed44ed870@dunslane.net> (raw)
In-Reply-To: <E1sqFV9-001ODn-9M@gemulon.postgresql.org>
References: <E1sqFV9-001ODn-9M@gemulon.postgresql.org>


On 2024-09-16 Mo 1:27 PM, Bruce Momjian wrote:
> scripts:  add Perl script to add links to release notes
>
> Reported-by: jian he
>
> Discussion:https://postgr.es/m/ZuYsS5XdA7hVcV9l@momjian.us


I realize I'm late to the party on this, but here's a review patch for 
this script. It's mostly stylistic changes (simpler use of print, use of 
POSIX xdigit class for hex digits), but it does correct one actual 
error: AFAIK "die" doesn't do printf style substitutions.


cheers


andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

Attachments:

add_commit_links.patch (text/x-patch, 1.6K) download diff --git a/src/tools/add_commit_links.pl b/src/tools/add_commit_links.pl index ebfc97ea32..64a5783297 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*$/;

view thread (9+ messages)  latest in thread

Message-ID: <b2465837-56df-4794-a0b5-5e6ed44ed870@dunslane.net>
Permalink:  ../b2465837-56df-4794-a0b5-5e6ed44ed870@dunslane.net/
Also on:    postgresql.org/message-id/b2465837-56df-4794-a0b5-5e6ed44ed870@dunslane.net

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andrew@dunslane.net, bruce@momjian.us
  Subject: Re: pgsql: scripts: add Perl script to add links to release notes
  In-Reply-To: <b2465837-56df-4794-a0b5-5e6ed44ed870@dunslane.net>
  References: <E1sqFV9-001ODn-9M@gemulon.postgresql.org> <b2465837-56df-4794-a0b5-5e6ed44ed870@dunslane.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox