Groups | Search | Server Info | Login | Register
Groups > perl.dbd.pg.changes > #25
| Newsgroups | perl.dbd.pg.changes |
|---|---|
| Path | csiph.com!xmission!news.glorb.com!usenet.stanford.edu!nntp.perl.org |
| Xref | csiph.com perl.dbd.pg.changes:25 |
| Return-Path | <greg@vm212.endpoint.com> |
| Mailing-List | contact dbd-pg-changes-help@perl.org; run by ezmlm |
| Delivered-To | mailing list dbd-pg-changes@perl.org |
| Received | (qmail 30917 invoked from network); 14 Jan 2017 19:32:53 -0000 |
| Received | from xx1.develooper.com (207.171.7.115) by x6.develooper.com with SMTP; 14 Jan 2017 19:32:53 -0000 |
| Received | from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id A8BA711D415 for <perlmail-dbd-pg-changes@onion.perl.org>; Sat, 14 Jan 2017 11:32:53 -0800 (PST) |
| X-Spam-Checker-Version | SpamAssassin 3.3.1 (2010-03-16) on mx3.develooper.com |
| X-Spam-Status | No, score=-1.9 required=8.0 tests=BAYES_00,LOTS_OF_MONEY autolearn=ham version=3.3.1 |
| Received | from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 5058611FB3A for <perlmail-dbd-pg-changes@onion.perl.org>; Sat, 14 Jan 2017 11:32:49 -0800 (PST) |
| Received | from vm212.endpoint.com (vm212.endpoint.com [5.9.255.107]) by xx1.develooper.com (Postfix) with ESMTP id 8D43F11D870 for <dbd-pg-changes@perl.org>; Sat, 14 Jan 2017 11:32:48 -0800 (PST) |
| Received | by vm212.endpoint.com (Postfix, from userid 500) id 6A8FB22405; Sat, 14 Jan 2017 19:32:47 +0000 (UTC) |
| To | dbd-pg-changes@perl.org |
| Subject | [DBD::Pg] Start cleanup of version parsing for new Postgres versioning scheme |
| Date | Sat, 14 Jan 2017 19:32:47 +0000 |
| Message-ID | <1484422367-1585-1-git-send-email-dbdpg-commits@bucardo.org> (permalink) |
| X-Mailer | git-send-email 1.8.4 |
| X-Git-Newrev | 6dbcf5386ef0a41275f181b3c345092ff31592c1 |
| X-Git-Committed-By | Erik Rijkers <er@xs4all.nl> |
| X-PMX-Version | 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2017.1.14.192416 |
| X-PMX-Spam | Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_REAL_NAME 0, NO_URI_HTTPS 0, SPF_NONE 0, __ANY_URI 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __NO_HTML_TAG_RAW 0, __OEM_PRICE 0, __SANE_MSGID 0, __STOCK_PHRASE_7 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __zen.spamhaus.org_ERROR ' |
| Approved | news@nntp.perl.org |
| From | dbdpg-commits@bucardo.org |
Show key headers only | View raw
Committed by Erik Rijkers <er@xs4all.nl>
Start cleanup of version parsing for new Postgres
versioning scheme
---
t/lib/App/Info/RDBMS/PostgreSQL.pm | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/t/lib/App/Info/RDBMS/PostgreSQL.pm b/t/lib/App/Info/RDBMS/PostgreSQL.pm
index af30501..4218605 100644
--- a/t/lib/App/Info/RDBMS/PostgreSQL.pm
+++ b/t/lib/App/Info/RDBMS/PostgreSQL.pm
@@ -268,15 +268,25 @@ my $get_version = sub {
# Beta/devel/release candidates are treated as patch level "0"
@{$self}{qw(version major minor patch)} =
($version, $x, $y, $z);
- } elsif ($version =~ /(\d+)\.(\d+)/) {
+ }
+ elsif ($version =~ /^(\d)\.(\d+)/) { # < v10
# New versions, such as "7.4", are treated as patch level "0"
@{$self}{qw(version major minor patch)} =
- ($version, $1, $2, 0);
- } else {
- $self->error("Failed to parse PostgreSQL version parts from " .
- "string '$version'");
+ ($version, $1, $2, 0);
}
- } else {
+ elsif ($version =~ /^(\d{2,})\.(\d+)/) { # >= v10
+ @{$self}{qw(version major minor patch)} =
+ ($version, $1, 0, $2); # from v10 onwards, $2 will be patch level
+ }
+ elsif ($version =~ /^(\d{2,})devel/) {
+ @{$self}{qw(version major minor patch)} =
+ ($version, $1, 0, 0);
+ }
+ else {
+ $self->error("Failed to parse PostgreSQL version parts from string '$version'");
+ }
+ }
+ else {
$self->error("Unable to parse version from string '$data'");
}
};
@@ -342,7 +352,13 @@ sub version {
# Create a validation code reference.
my $chk_version = sub {
# Try to get the version number parts.
- my ($x, $y, $z) = /^(\d+)\.(\d+).(\d+)$/;
+ my ($x, $y, $z);
+ if ( /^(\d{2,})/) {
+ ($x, $y, $z ) = ($1, 0, 0); # >= v10
+ }
+ else {
+ ($x, $y, $z) = /^(\d)\.(\d+).(\d+)$/; # < v10
+ }
# Return false if we didn't get all three.
return unless $x and defined $y and defined $z;
# Save all three parts.
--
1.8.4
Back to perl.dbd.pg.changes | Previous | Next | Find similar
[DBD::Pg] Start cleanup of version parsing for new Postgres versioning scheme dbdpg-commits@bucardo.org - 2017-01-14 19:32 +0000
csiph-web