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.
>
>
Maybe you aren't running it in the right directory (i.e. the directory
where configure.in exists)?
Anyway, I think what you want to achieve (without all the git crap) is
the attached.
cheers
andrew
Index: version_stamp.pl
===================================================================
RCS file: /cvsroot/pgsql/src/tools/version_stamp.pl,v
retrieving revision 1.2
diff -c -u -r1.2 version_stamp.pl
--- version_stamp.pl 1 Jan 2009 17:24:04 -0000 1.2
+++ version_stamp.pl 9 May 2009 01:02:48 -0000
@@ -20,15 +20,18 @@
# "devel", "betaN", "rcN".
#
+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";
+my ($dotneeded,$numericminor);
if ($minor =~ m/^\d+$/) {
$dotneeded = 1;
$numericminor = $minor;
@@ -46,19 +49,20 @@
}
# 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 = "";
+my $aconfver = "";
open(FILE, "configure.in") || die "could not read configure.in: $!\n";
while (<FILE>) {
if (m/^m4_if\(m4_defn\(\[m4_PACKAGE_VERSION\]\), \[(.*)\], \[\], \[m4_fatal/) {
@@ -71,7 +75,7 @@
# 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]/'");