On Fri, 2009-05-08 at 14:16 -0700, Joshua D. Drake wrote:
> Hello,
>
> Here is a diff of version_stamp.pl. It is not quite done as I can't
> actually get it to run. No matter what I do it doesn't appear to be able
> to open configure.in.
>
> If someone could help me figure out where I am being stupid I would
> appreciate it.
Well you can all start by pointing out that I included a patch to
configure (which was wholly unintended). Sorry about that. Here is the
straight perl patch.
Sincerely,
Joshua D. Drake
--
PostgreSQL - XMPP: [email protected]
Consulting, Development, Support, Training
503-667-4564 - http://www.commandprompt.com/
The PostgreSQL Company, serving since 1997
diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl
index e99d2c3..686748e 100755
--- a/src/tools/version_stamp.pl
+++ b/src/tools/version_stamp.pl
@@ -5,7 +5,7 @@
#
# Copyright (c) 2008-2009, PostgreSQL Global Development Group
#
-# $PostgreSQL$
+# my $PostgreSQL my $
#################################################################
#
@@ -20,49 +20,55 @@
# "devel", "betaN", "rcN".
#
+# We do strict now
+use strict;
+
# Major version is hard-wired into the script. We update it when we branch
# a new development version.
-$major1 = 8;
-$major2 = 4;
+my $major1 = 8;
+my $major2 = 4;
# Validate argument and compute derived variables
-$minor = shift;
+my $minor = shift;
defined($minor) || die "$0: missing required argument: minor-version\n";
if ($minor =~ m/^\d+$/) {
- $dotneeded = 1;
- $numericminor = $minor;
+ my $dotneeded = 1;
+ my $numericminor = $minor;
} elsif ($minor eq "devel") {
- $dotneeded = 0;
- $numericminor = 0;
+ my $dotneeded = 0;
+ my $numericminor = 0;
} elsif ($minor =~ m/^beta\d+$/) {
- $dotneeded = 0;
- $numericminor = 0;
+ my $dotneeded = 0;
+ my $numericminor = 0;
} elsif ($minor =~ m/^rc\d+$/) {
- $dotneeded = 0;
- $numericminor = 0;
+ my $dotneeded = 0;
+ my $numericminor = 0;
} else {
die "$0: minor-version must be N, devel, betaN, or rcN\n";
}
# Create various required forms of the version number
-$majorversion = $major1 . "." . $major2;
-if ($dotneeded) {
- $fullversion = $majorversion . "." . $minor;
+my $majorversion = $major1 . "." . $major2;
+if (my $dotneeded) {
+ my $fullversion = $majorversion . "." . $minor;
} else {
- $fullversion = $majorversion . $minor;
+ my $fullversion = $majorversion . $minor;
}
-$numericversion = $majorversion . "." . $numericminor;
-$padnumericversion = sprintf("%d%02d%02d", $major1, $major2, $numericminor);
+
+my $numericminor = undef;
+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";
+my $aconfver = "";
+my $configinfile = $2;
+open(FILE, "$configinfile") || die "could not read configure.in: $!\n";
while (<FILE>) {
if (m/^m4_if\(m4_defn\(\[m4_PACKAGE_VERSION\]\), \[(.*)\], \[\], \[m4_fatal/) {
- $aconfver = $1;
+ $aconfver = $1;
last;
}
}
@@ -71,43 +77,32 @@ $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 = "";
+my $fullversion = "";
-sed_file("configure.in",
- "-e 's/AC_INIT(\\[PostgreSQL\\], \\[[0-9a-z.]*\\]/AC_INIT([PostgreSQL], [$fullversion]/'");
+sed_file("$configinfile", "-e 's/AC_INIT(\\[PostgreSQL\\], \\[[0-9a-z.]*\\]/AC_INIT([PostgreSQL], [$fullversion]/'");
-sed_file("doc/bug.template",
- "-e 's/PostgreSQL version (example: PostgreSQL .*) *: PostgreSQL .*/PostgreSQL version (example: PostgreSQL $fullversion): PostgreSQL $fullversion/'");
+sed_file("doc/bug.template", "-e 's/PostgreSQL version (example: PostgreSQL .*) *: PostgreSQL .*/PostgreSQL version (example: PostgreSQL $fullversion): PostgreSQL $fullversion/'");
-sed_file("src/include/pg_config.h.win32",
- "-e 's/#define PACKAGE_STRING \"PostgreSQL .*\"/#define PACKAGE_STRING \"PostgreSQL $fullversion\"/' " .
- "-e 's/#define PACKAGE_VERSION \".*\"/#define PACKAGE_VERSION \"$fullversion\"/' " .
- "-e 's/#define PG_VERSION \".*\"/#define PG_VERSION \"$fullversion\"/' " .
- "-e 's/#define PG_VERSION_NUM .*/#define PG_VERSION_NUM $padnumericversion/'");
+sed_file("src/include/pg_config.h.win32", "-e 's/#define PACKAGE_STRING \"PostgreSQL .*\"/#define PACKAGE_STRING \"PostgreSQL $fullversion\"/' " . "-e 's/#define PACKAGE_VERSION \".*\"/#define PACKAGE_VERSION \" $fullversion\"/' " . "-e 's/#define PG_VERSION \".*\"/#define PG_VERSION \" $fullversion\"/' " . "-e 's/#define PG_VERSION_NUM .*/#define PG_VERSION_NUM $padnumericversion/'");
-sed_file("src/interfaces/libpq/libpq.rc.in",
- "-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $major1,$major2,$numericminor,0/' " .
- "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $major1,$major2,$numericminor,0/' " .
- "-e 's/VALUE \"FileVersion\", \"[0-9.]*/VALUE \"FileVersion\", \"$numericversion/' " .
- "-e 's/VALUE \"ProductVersion\", \"[0-9.]*/VALUE \"ProductVersion\", \"$numericversion/'");
+sed_file("src/interfaces/libpq/libpq.rc.in", "-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION my $major1, my $major2, my $numericminor,0/' " . "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION my $major1, my $major2, my $numericminor,0/' " . "-e 's/VALUE \"FileVersion\", \"[0-9.]*/VALUE \"FileVersion\", \" my $numericversion/' " . "-e 's/VALUE \"ProductVersion\", \"[0-9.]*/VALUE \"ProductVersion\", \" my $numericversion/'");
-sed_file("src/port/win32ver.rc",
- "-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $major1,$major2,$numericminor,0/' " .
- "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $major1,$major2,$numericminor,0/'");
+sed_file("src/port/win32ver.rc", "-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION my $major1, my $major2, my $numericminor,0/' " . "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION my $major1, my $major2, my $numericminor,0/'");
-print "Stamped these files with version number $fullversion:\n$fixedfiles";
-print "Don't forget to run autoconf $aconfver before committing.\n";
+print "Stamped these files with version number my $fullversion:\n my $fixedfiles";
+print "Don't forget to run autoconf my $aconfver before committing.\n";
exit 0;
sub sed_file {
- my($filename, $sedargs) = @_;
- my($tmpfilename) = $filename . ".tmp";
+ my($filename, $sedargs) = @_;
+ my($tmpfilename) = $filename . ".tmp";
- system("sed $sedargs $filename >$tmpfilename") == 0
- or die "sed failed: $?";
- system("mv $tmpfilename $filename") == 0
- or die "mv failed: $?";
+ system("sed my $sedargs my $filename > my $tmpfilename") == 0
+ or die "sed failed: my $?";
+ system("mv my $tmpfilename my $filename") == 0
+ or die "mv failed: my $?";
- $fixedfiles .= "\t$filename\n";
+ my $fixedfiles .= "\t my $filename\n";
}
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers