summaryrefslogtreecommitdiffstats
path: root/bin/h5vers
diff options
context:
space:
mode:
Diffstat (limited to 'bin/h5vers')
-rwxr-xr-xbin/h5vers216
1 files changed, 165 insertions, 51 deletions
diff --git a/bin/h5vers b/bin/h5vers
index a216577..6716794 100755
--- a/bin/h5vers
+++ b/bin/h5vers
@@ -7,19 +7,16 @@ require 5.003;
use strict;
# Copyright by The HDF Group.
-# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
-# the files COPYING and Copyright.html. COPYING can be found at the root
-# of the source code distribution tree; Copyright.html can be found at the
-# root level of an installed copy of the electronic HDF5 document set and
-# is linked from the top-level documents page. It can also be found at
-# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
-# access to either file, you may request a copy from help@hdfgroup.org.
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://www.hdfgroup.org/licenses.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
#
-# Robb Matzke <matzke@llnl.gov>
+# Robb Matzke
# 17 July 1998
### Purpose
@@ -68,10 +65,10 @@ use strict;
# ./H5public.h or ./src/H5public.h.
#
# If the version number is changed (either `-s' or `-i' was used on
-# the command line) then the first line of the README.txt and RELEASE.txt files
+# the command line) then the version line of the README.md and RELEASE.txt files
# one directory above the H5public.h file is also modified so it looks
# something like: This is hdf5-1.2.3-pre1 currently under development.
-# The AC_INIT macro in configure.in will also change in this case to be
+# The AC_INIT macro in configure.ac will also change in this case to be
# something like: AC_INIT([HDF5], [hdf5-1.2.3-pre1], [help@hdfgroup.org])
# Version changes are also reflected in the Windows-maintained H5pubconf.h
# file.
@@ -127,7 +124,7 @@ EOF
exit 1;
}
-# Parse arguments
+
my ($verbose, $set, $inc, $file, $rc);
my (@files) = ("H5public.h", "src/H5public.h", "../src/H5public.h");
while ($_ = shift) {
@@ -158,11 +155,12 @@ while ($_ = shift) {
}
die "mutually exclusive options given\n" if $set && $inc;
-# Determine file to use as H5public.h, README.txt,
-# release_docs/RELEASE.txt, configure.in, windows/src/H5pubconf.h,
-# vms/src/h5pubcof.h and config/lt_vers.am.
-# The README.txt, release_docs/RELEASE.txt, configure.in,
-# windows/src/H5pubconf.h, vms/src/h5pubconf.h and config/lt_vers.am
+# Determine file to use as H5public.h, README.md,
+# release_docs/RELEASE.txt, configure.ac, windows/src/H5pubconf.h
+# config/lt_vers.am and config/cmake/scripts/HDF5config.cmake.
+# The README.md, release_docs/RELEASE.txt, configure.ac,
+# windows/src/H5pubconf.h, config/lt_vers.am and
+# config/cmake/scripts/HDF5config.cmake
# files are always in the directory above H5public.h
unless ($file) {
for (@files) {
@@ -175,26 +173,35 @@ die "unable to read file: $file\n" unless -r $file;
my $LT_VERS = $file;
$LT_VERS =~ s/[^\/]*$/..\/config\/lt_vers.am/;
die "unable to read file: $LT_VERS\n" unless -r $file;
-# README.txt
+# config/cmake/scripts/HDF5config.cmake
+my $HDF5CONFIGCMAKE = $file;
+$HDF5CONFIGCMAKE =~ s/[^\/]*$/..\/config\/cmake\/scripts\/HDF5config.cmake/;
+die "unable to read file: $HDF5CONFIGCMAKE\n" unless -r $file;
+# README.md
my $README = $file;
-$README =~ s/[^\/]*$/..\/README.txt/;
+$README =~ s/[^\/]*$/..\/README.md/;
die "unable to read file: $README\n" unless -r $file;
# release_docs/RELEASE.txt
my $RELEASE = $file;
$RELEASE =~ s/[^\/]*$/..\/release_docs\/RELEASE.txt/;
die "unable to read file: $RELEASE\n" unless -r $file;
-# configure.in
+# configure.ac
my $CONFIGURE = $file;
-$CONFIGURE =~ s/[^\/]*$/..\/configure.in/;
+$CONFIGURE =~ s/[^\/]*$/..\/configure.ac/;
die "unable to read file: $CONFIGURE\n" unless -r $file;
-# windows/src/H5pubconf.h
-my $H5PUBCONF = $file;
-$H5PUBCONF =~ s/[^\/]*$/..\/windows\/src\/H5pubconf.h/;
-die "unable to read file: $H5PUBCONF\n" unless -r $file;
-# vms/src/h5pubconf.h
-my $H5VMSPUBCONF = $file;
-$H5VMSPUBCONF =~ s/[^\/]*$/..\/vms\/src\/h5pubconf.h/;
-die "unable to read file: $H5VMSPUBCONF\n" unless -r $file;
+# cpp_doc_config
+my $CPP_DOC_CONFIG = $file;
+$CPP_DOC_CONFIG =~ s/[^\/]*$/..\/c++\/src\/cpp_doc_config/;
+die "unable to read file: $CPP_DOC_CONFIG\n" unless -r $file;
+my $H5_JAVA = $file;
+$H5_JAVA =~ s/[^\/]*$/..\/java\/src\/hdf\/hdf5lib\/H5.java/;
+die "unable to read file: $H5_JAVA\n" unless -r $file;
+my $TESTH5_JAVA = $file;
+$TESTH5_JAVA =~ s/[^\/]*$/..\/java\/test\/TestH5.java/;
+die "unable to read file: $TESTH5_JAVA\n" unless -r $file;
+my $REPACK_LAYOUT_PLUGIN_VERSION = $file;
+$REPACK_LAYOUT_PLUGIN_VERSION =~ s/[^\/]*$/..\/tools\/test\/h5repack\/testfiles\/h5repack_layout.h5-plugin_version_test.ddl/;
+die "unable to read file: $REPACK_LAYOUT_PLUGIN_VERSION\n" unless -r $file;
# Get the current version number.
open FILE, $file or die "unable to open $file: $!\n";
@@ -205,7 +212,7 @@ my (@curver) = getvers $contents;
# Determine the new version number.
my @newver; #new version
if ($set) {
- if ($set =~ /(\d+)\.(\d+)\.(\d+)(-([a-zA-Z]\w*))?/) {
+ if ($set =~ /(\d+)\.(\d+)\.(\d+)(-([\da-zA-Z]\w*))?/) {
@newver = ($1, $2, $3, $5);
} elsif ($set =~ /(\d+)\D+(\d+)\D+(\d+)(\s*\(([a-zA-Z]\w*)\))?\D*$/) {
@newver = ($1, $2, $3, $5);
@@ -242,9 +249,9 @@ if ($set) {
$README = "";
$RELEASE = "";
$CONFIGURE = "";
- $H5PUBCONF = "";
- $H5VMSPUBCONF = "";
- $LT_VERS = "";
+ $CPP_DOC_CONFIG = "";
+ $LT_VERS = "";
+ $HDF5CONFIGCMAKE = "";
@newver = @curver;
}
@@ -282,16 +289,20 @@ if ($LT_VERS && $version_increased) {
local($_) = $contentsy;
- my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m;
- my $new_lt_revision = $lt_revision+1;
- ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m;
-
- open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n";
- print FILE $contentsy;
- close FILE;
+# As of the HDF5 v1.8.16 release, h5vers should not increment
+# the LT_VERS numbers, so the next 6 lines are commented out.
+# A future version may copy the numbers to H5public.h, so this
+# section is retained for future reference.
+# my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m;
+# my $new_lt_revision = $lt_revision+1;
+# ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m;
+
+# open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n";
+# print FILE $contentsy;
+# close FILE;
}
-# Update the README.txt file
+# Update the README.md file
if ($README) {
open FILE, $README or die "$README: $!\n";
my @contents = <FILE>;
@@ -319,6 +330,115 @@ if ($RELEASE) {
close FILE;
}
+# Update the c++/src/cpp_doc_config file
+if ($CPP_DOC_CONFIG) {
+ my $data = read_file($CPP_DOC_CONFIG);
+ my $sub_rel_ver_str = (
+ $newver[3] eq ""
+ ? sprintf("%s", "")
+ : sprintf("%s", "-".$newver[3].", currently under development")
+ );
+ my $version_string = sprintf("\"%d.%d.%d%s%s\"",
+ @newver[0,1,2],
+ $sub_rel_ver_str);
+ $data =~ s/PROJECT_NUMBER\s*=.*/PROJECT_NUMBER = $version_string/;
+
+ write_file($CPP_DOC_CONFIG, $data);
+}
+
+# Update the config/cmake/scripts/HDF5config.cmake file
+if ($HDF5CONFIGCMAKE) {
+ my $data = read_file($HDF5CONFIGCMAKE);
+# my $sub_rel_ver_str = "";
+ my $sub_rel_ver_str = (
+ $newver[3] eq ""
+ ? sprintf("\"%s\"", "")
+ : sprintf("\"%s\"", "-".$newver[3])
+ );
+ my $version_string = sprintf("\"%d.%d.%d\"", @newver[0,1,2]);
+
+ $data =~ s/set \(CTEST_SOURCE_VERSION .*\)/set \(CTEST_SOURCE_VERSION $version_string\)/;
+ $data =~ s/set \(CTEST_SOURCE_VERSEXT .*\)/set \(CTEST_SOURCE_VERSEXT $sub_rel_ver_str\)/;
+
+ write_file($HDF5CONFIGCMAKE, $data);
+}
+
+# Update the java/src/hdf/hdf5lib/H5.java file
+if ($H5_JAVA) {
+ my $data = read_file($H5_JAVA);
+# my $sub_rel_ver_str = "";
+ my $sub_rel_ver_str = (
+ $newver[3] eq ""
+ ? sprintf("\"%s\"", "")
+ : sprintf("\"%s\"", "-".$newver[3].", currently under development")
+ );
+ my $version_string1 = sprintf("%d.%d.%d", @newver[0,1,2]);
+ my $version_string2 = sprintf("%d, %d, %d", @newver[0,1,2]);
+
+ $data =~ s/\@version HDF5 .* <BR>/\@version HDF5 $version_string1 <BR>/;
+ $data =~ s/ public final static int LIB_VERSION\[\] = \{\d*,.\d*,.\d*\};/ public final static int LIB_VERSION[] = \{$version_string2\};/;
+
+ write_file($H5_JAVA, $data);
+}
+
+# Update the java/test/TestH5.java file
+if ($TESTH5_JAVA) {
+ my $data = read_file($TESTH5_JAVA);
+# my $sub_rel_ver_str = "";
+ my $sub_rel_ver_str = (
+ $newver[3] eq ""
+ ? sprintf("\"%s\"", "")
+ : sprintf("\"%s\"", "-".$newver[3].", currently under development")
+ );
+ my $version_string1 = sprintf("%d, %d, %d", @newver[0,1,2]);
+ my $version_string2 = sprintf("int majnum = %d, minnum = %d, relnum = %d", @newver[0,1,2]);
+
+ $data =~ s/ int libversion\[\] = \{.*\};/ int libversion\[\] = \{$version_string1\};/;
+ $data =~ s/ int majnum = \d*, minnum = \d*, relnum = \d*;/ $version_string2;/;
+
+ write_file($TESTH5_JAVA, $data);
+}
+
+# Update the tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl file
+if ($REPACK_LAYOUT_PLUGIN_VERSION) {
+ my $data = read_file($REPACK_LAYOUT_PLUGIN_VERSION);
+ my $version_string = sprintf("%d %d %d", @newver[0,1,2]);
+
+ $data =~ s/ PARAMS \{ 9 \d* \d* \d* \}/ PARAMS \{ 9 $version_string \}/g;
+
+ write_file($REPACK_LAYOUT_PLUGIN_VERSION, $data);
+}
+
+# helper function to read the file for updating c++/src/cpp_doc_config,
+# config/cmake/scripts/HDF5Config.cmake, and java files.
+# The version string in that file is not at the top, so the string replacement
+# is not for the first line, and reading/writing the entire file as one string
+# facilitates the substring replacement.
+#Presumably these will also work for resetting the version in HDF5config.cmake.
+sub read_file {
+ my ($filename) = @_;
+
+ open my $in, $filename or die "Could not open '$filename' for reading $!";
+ local $/ = undef;
+ my $all = <$in>;
+ close $in;
+
+ return $all;
+}
+
+# helper function to write the file for updating c++/src/cpp_doc_config,
+# config/cmake/scripts/HDF5config.cmake and java files.
+sub write_file {
+ my ($filename, $content) = @_;
+
+ open my $out, ">$filename" or die "Could not open '$filename' for writing $!";;
+ print $out $content;
+ close $out;
+
+ return;
+}
+
+
sub gen_configure {
my ($name, $conf) = @_;
@@ -339,20 +459,20 @@ sub gen_configure {
print FILE @contents;
close FILE;
- $conf =~ /^(.*?)\/?configure.in$/;
+ $conf =~ /^(.*?)\/?configure.ac$/;
if ($1) {
- $rc = system("cd $1 && bin/reconfigure >/dev/null 2>/dev/null && rm -rf autom4te.cache");
+ $rc = system("cd $1 && ./autogen.sh >/dev/null 2>/dev/null && rm -rf autom4te.cache");
} else {
- $rc = system("bin/reconfigure >/dev/null 2>/dev/null && rm -rf autom4te.cache");
+ $rc = system("./autogen.sh >/dev/null 2>/dev/null && rm -rf autom4te.cache");
}
if ($rc) {
- printf("bin/reconfigure failed with exit code %d. Aborted.\n", $rc);
+ printf("./autogen.sh failed with exit code %d. Aborted.\n", $rc);
exit 1;
}
}
-# Update the configure.in files and regenerate them
+# Update the configure.ac files and regenerate them
gen_configure("HDF5", $CONFIGURE) if $CONFIGURE;
sub gen_h5pubconf {
@@ -392,12 +512,6 @@ sub gen_h5pubconf {
close FILE;
}
-# Update the Windows-maintained H5pubconf.h file
-gen_h5pubconf("HDF5", $H5PUBCONF, @newver) if $H5PUBCONF;
-
-# Update the VMS-maintained h5pubconf.h file
-gen_h5pubconf("HDF5", $H5VMSPUBCONF, @newver) if $H5VMSPUBCONF;
-
# Print the new version number
if ($verbose) {
printf("version %d.%d release %d%s\n", @newver[0,1,2],