version_stamp.diff
text/plain
Filename: version_stamp.diff
Type: text/plain
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/tools/version_stamp.pl | 26 | 22 |
diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl
index 3243e16..e06f5f2 100755
--- a/src/tools/version_stamp.pl
+++ b/src/tools/version_stamp.pl
@@ -1,5 +1,7 @@
-#! /usr/bin/perl -w
+#!/usr/bin/env perl
+use strict;
+use warnings;
#################################################################
# version_stamp.pl -- update version stamps throughout the source tree
#
@@ -22,26 +24,26 @@
# Major version is hard-wired into the script. We update it when we branch
# a new development version.
-$major1 = 9;
-$major2 = 0;
+my $major1 = 9;
+my $major2 = 0;
# Validate argument and compute derived variables
-$minor = shift;
+my $minor = shift;
defined($minor) || die "$0: missing required argument: minor-version\n";
+my ($dotneeded, $numericminor);
if ($minor =~ m/^\d+$/) {
$dotneeded = 1;
$numericminor = $minor;
-} elsif ($minor eq "devel") {
- $dotneeded = 0;
- $numericminor = 0;
-} elsif ($minor =~ m/^alpha\d+$/) {
- $dotneeded = 0;
- $numericminor = 0;
-} elsif ($minor =~ m/^beta\d+$/) {
- $dotneeded = 0;
- $numericminor = 0;
-} elsif ($minor =~ m/^rc\d+$/) {
+} elsif ($minor =~ m/
+ ^
+ (
+ devel |
+ alpha\d+ |
+ beta\d+ |
+ rc\d+
+ )
+ $/x) {
$dotneeded = 0;
$numericminor = 0;
} else {
@@ -49,32 +51,33 @@ if ($minor =~ m/^\d+$/) {
}
# Create various required forms of the version number
-$majorversion = $major1 . "." . $major2;
+my $majorversion = $major1 . "." . $major2;
+my $fullversion;
if ($dotneeded) {
$fullversion = $majorversion . "." . $minor;
} else {
$fullversion = $majorversion . $minor;
}
-$numericversion = $majorversion . "." . $numericminor;
-$padnumericversion = sprintf("%d%02d%02d", $major1, $major2, $numericminor);
+my $numericversion = $majorversion . "." . $numericminor;
+my $padnumericversion = sprintf("%d%02d%02d", $major1, $major2, $numericminor);
# Get the autoconf version number for eventual nag message
# (this also ensures we're in the right directory)
-$aconfver = "";
-open(FILE, "configure.in") || die "could not read configure.in: $!\n";
-while (<FILE>) {
+my $aconfver = "";
+open(my $file, '<', "configure.in") || die "could not read configure.in: $!\n";
+while (<$file>) {
if (m/^m4_if\(m4_defn\(\[m4_PACKAGE_VERSION\]\), \[(.*)\], \[\], \[m4_fatal/) {
$aconfver = $1;
last;
}
}
-close(FILE);
+close($file);
$aconfver ne "" || die "could not find autoconf version number in configure.in\n";
# Update configure.in and other files that contain version numbers
-$fixedfiles = "";
+my $fixedfiles = "";
sed_file("configure.in",
"-e 's/AC_INIT(\\[PostgreSQL\\], \\[[0-9a-z.]*\\]/AC_INIT([PostgreSQL], [$fullversion]/'");
@@ -113,4 +116,5 @@ sub sed_file {
or die "mv failed: $?";
$fixedfiles .= "\t$filename\n";
+ return;
}