> On Apr 22, 2021, at 8:09 AM, Alvaro Herrera <alvhe...@alvh.no-ip.org> wrote: > >> >> + # Accept standard formats, in case caller has handed us the output of a >> + # postgres command line tool >> + $arg = $1 >> + if ($arg =~ m/\(?PostgreSQL\)? (\d+(?:\.\d+)*(?:devel)?)/); >> + >> + # Split into an array >> + my @result = split(/\./, $arg); >> + >> + # Treat development versions as having a minor/micro version one less >> than >> + # the first released version of that branch. >> + if ($result[$#result] =~ m/^(\d+)devel$/) >> + { >> + pop(@result); >> + push(@result, $1, -1); >> + } > > It's a bit weird to parse the "devel" bit twice. Would it work to leave > (?:devel)? out of the capturing parens that becomes $1 in the first > regex and make it capturing itself, so you get "devel" in $2, and decide > based on its presence/absence? Then you don't have to pop and push a -1. The first regex should match things like "12", "12.1", "14devel", or those same things prefixed with "(PostgreSQL) ", and strip off the "(PostgreSQL)" part if it exists. But the code should also BAIL_OUT if the regex completely fails to match. — Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
- Re: multi-install PostgresNode fails with olde... Mark Dilger
- Re: multi-install PostgresNode fails with olde... Jehan-Guillaume de Rorthais
- Re: multi-install PostgresNode fails with olde... Mark Dilger
- Re: multi-install PostgresNode fails with olde... Andrew Dunstan
- Re: multi-install PostgresNode fails with olde... Michael Paquier
- Re: multi-install PostgresNode fails with olde... Andrew Dunstan
- Re: multi-install PostgresNode fails with olde... Michael Paquier
- Re: multi-install PostgresNode fails with olde... Andrew Dunstan
- Re: multi-install PostgresNode fails with olde... Andrew Dunstan
- Re: multi-install PostgresNode fails with olde... Alvaro Herrera
- Re: multi-install PostgresNode fails with olde... Mark Dilger
- Re: multi-install PostgresNode fails with olde... Andrew Dunstan
- Re: multi-install PostgresNode fails with olde... Andrew Dunstan
- Re: multi-install PostgresNode fails with olde... Alvaro Herrera
- Re: multi-install PostgresNode fails with olde... Michael Paquier
- Re: multi-install PostgresNode fails with olde... Andrew Dunstan
- Re: multi-install PostgresNode fails with olde... Michael Paquier
- Re: multi-install PostgresNode fails with olde... Andrew Dunstan
- Re: multi-install PostgresNode fails with olde... Michael Paquier
- Re: multi-install PostgresNode fails with olde... Andrew Dunstan
- Re: multi-install PostgresNode fails with olde... Jehan-Guillaume de Rorthais