diff options
Diffstat (limited to 'bin/h5vers')
-rwxr-xr-x | bin/h5vers | 119 |
1 files changed, 77 insertions, 42 deletions
@@ -12,12 +12,10 @@ use strict; # # 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://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. # # Robb Matzke <matzke@llnl.gov> # 17 July 1998 @@ -127,7 +125,7 @@ EOF exit 1; } -# Parse arguments + my ($verbose, $set, $inc, $file, $rc); my (@files) = ("H5public.h", "src/H5public.h", "../src/H5public.h"); while ($_ = shift) { @@ -160,21 +158,26 @@ die "mutually exclusive options given\n" if $set && $inc; # Determine file to use as H5public.h, README.txt, # release_docs/RELEASE.txt, configure.ac, windows/src/H5pubconf.h -# and config/lt_vers.am. +# config/lt_vers.am and config/cmake/scripts/HDF5config.cmake. # The README.txt, release_docs/RELEASE.txt, configure.ac, -# windows/src/H5pubconf.h, and config/lt_vers.am +# 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) { ($file=$_,last) if -f $_; } } -die "unable to find source files\n" unless defined $file; +die "unable to find source file $file\n" unless defined $file; die "unable to read file: $file\n" unless -r $file; # config/lt_vers.am my $LT_VERS = $file; $LT_VERS =~ s/[^\/]*$/..\/config\/lt_vers.am/; die "unable to read file: $LT_VERS\n" unless -r $file; +# 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.txt my $README = $file; $README =~ s/[^\/]*$/..\/README.txt/; @@ -191,6 +194,9 @@ die "unable to read file: $CONFIGURE\n" unless -r $file; 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 $REPACK_LAYOUT_PLUGIN_VERSION = $file; +$REPACK_LAYOUT_PLUGIN_VERSION =~ s/[^\/]*$/..\/tools\/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"; @@ -239,18 +245,11 @@ if ($set) { $RELEASE = ""; $CONFIGURE = ""; $CPP_DOC_CONFIG = ""; - $LT_VERS = ""; + $LT_VERS = ""; + $HDF5CONFIGCMAKE = ""; @newver = @curver; } -# Note if the new version is for an official release. -# if the fourth version field is empty or contains "patch", -# "currently under development" shouldn't be printed as -# part of the version string. -my $is_official_release=""; -if ($newver[3] eq "" || $newver[3] =~ /patch\d/) { - $is_official_release="true"; -} # Note if the version increased or decreased my $version_increased=""; # Print a warning if the version got smaller (don't check annot field) @@ -284,29 +283,29 @@ if ($LT_VERS && $version_increased) { close FILE; local($_) = $contentsy; - - # 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; -} +# 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 if ($README) { open FILE, $README or die "$README: $!\n"; my @contents = <FILE>; close FILE; - $contents[0] = sprintf("HDF5 version %d.%d.%d%s\n", + $contents[0] = sprintf("HDF5 version %d.%d.%d%s %s", @newver[0,1,2], - $is_official_release ? $newver[3] eq "" ? "" : "-".$newver[3] : "-".$newver[3]." currently under development"); + $newver[3] eq "" ? "" : "-".$newver[3], + "currently under development\n"); open FILE, ">$README" or die "$README: $!\n"; print FILE @contents; close FILE; @@ -317,9 +316,10 @@ if ($RELEASE) { open FILE, $RELEASE or die "$RELEASE: $!\n"; my @contents = <FILE>; close FILE; - $contents[0] = sprintf("HDF5 version %d.%d.%d%s\n", + $contents[0] = sprintf("HDF5 version %d.%d.%d%s %s", @newver[0,1,2], - $is_official_release ? $newver[3] eq "" ? "" : "-".$newver[3] : "-".$newver[3]." currently under development"); + $newver[3] eq "" ? "" : "-".$newver[3], + "currently under development\n"); open FILE, ">$RELEASE" or die "$RELEASE: $!\n"; print FILE @contents; close FILE; @@ -328,19 +328,53 @@ if ($RELEASE) { # Update the c++/src/cpp_doc_config file if ($CPP_DOC_CONFIG) { my $data = read_file($CPP_DOC_CONFIG); - my $version_string = sprintf("\"%d.%d.%d%s\"", - @newver[0,1,2], - $is_official_release ? $newver[3] eq "" ? "" : "-".$newver[3] : "-".$newver[3]." currently under development"); - + 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); } -# helper function to read the file for updating c++/src/cpp_doc_config file. +# 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 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) = @_; @@ -352,7 +386,8 @@ sub read_file { return $all; } -# helper function to write the file for updating c++/src/cpp_doc_config file. +# 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) = @_; |