From 6924e1f9f8c8b3bf3e44871d3319c6a3337cb093 Mon Sep 17 00:00:00 2001 From: lrknox Date: Tue, 21 Feb 2017 15:18:17 -0600 Subject: h5vers: Added code to update version strings in config/cmake/scripts/HDF5config.cmake. release: Added options to create CMake tar.gz and zip files containing the HDF5 source and scripts to build and test HDF5 with cmake and ctest by running a single command. These were previously assembled manually. Added a call to h5vers to set the version being released where it occurs in files. In particular, the sub-release version string "currently under development" was not being removed from cpp_doc_config or HDF5config.cmake. --- bin/h5vers | 48 ++++++++++++--- bin/release | 195 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 229 insertions(+), 14 deletions(-) diff --git a/bin/h5vers b/bin/h5vers index 9babf97..6ecf446 100755 --- a/bin/h5vers +++ b/bin/h5vers @@ -127,7 +127,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,9 +160,10 @@ 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) { @@ -175,6 +176,10 @@ 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; +# 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/; @@ -239,7 +244,8 @@ if ($set) { $RELEASE = ""; $CONFIGURE = ""; $CPP_DOC_CONFIG = ""; - $LT_VERS = ""; + $LT_VERS = ""; + $HDF5CONFIGCMAKE = ""; @newver = @curver; } @@ -321,20 +327,43 @@ 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 %s\"", + 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], - $newver[3] eq "" ? "" : "-".$newver[3], - "currently under development"); - + $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].", currently under development") + ); + 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); +} + + + # helper function to read the file for updating c++/src/cpp_doc_config file. # 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) = @_; @@ -346,7 +375,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 +# and config/cmake/scripts/HDF5config.cmake files. sub write_file { my ($filename, $content) = @_; diff --git a/bin/release b/bin/release index f742926..8bfd626 100755 --- a/bin/release +++ b/bin/release @@ -57,8 +57,13 @@ for compressing the resulting tar archive (if none are given then tar -- use tar and don't do any compressing. gzip -- use gzip with "-9" and append ".gz" to the output name. + cmake-tgz -- create a tar file using the gzip default level with a build-unix.sh + command file and all other CMake files needed to build HDF5 source + using CMake on unix machines. bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name. zip -- convert all text files to DOS style and form a zip file for Windows use. + cmake-zip -- convert all text files to DOS style and create a zip file inluding cmake + scripts and .bat files to build HDF5 source using CMake on Windows. doc -- produce the latest doc tree in addition to the archive. An md5 checksum is produced for each archive created and stored in the md5 file. @@ -95,9 +100,9 @@ EOF # Modifications # # Steps: -# 1. untar the tarball in a temporay directory; +# 1. untar the tarball in a temporary directory; # Note: do this in a temporary directory to avoid changing -# the original source directory which maybe around. +# the original source directory which may be around. # 2. convert all its text files to DOS (LF-CR) style; # 3. form a zip file which is usable by Windows users. # @@ -114,7 +119,7 @@ tar2zip() echo "usage: tar2zip " return 1 fi - ztmpdir=/tmp/tmpdir$$ + ztmpdir=/tmp/ztmpdir$$ mkdir -p $ztmpdir version=$1 tarfile=$2 @@ -153,6 +158,175 @@ tar2zip() rm -rf $ztmpdir } +# Function name: tar2cmakezip +# Convert the release tarball to a Windows zipball with files to run CMake build. +# +# Programmer: Larry Knox +# Creation date: 2017-02-20 +# +# Modifications +# +# Steps: +# 1. untar the tarball in a temporary directory; +# Note: do this in a temporary directory to avoid changing +# the original source directory which may be around. +# 2. add build-unix.sh script. +# 3. add SZIP.tar.gz, ZLib.tar.gz and cmake files to top level directory. +# 4. create gzipped tar file with these contents: +# build-unix.sh script +# hdf5- source code directory extracted from tar file +# CTestScript.cmake cmake file copied from /config/cmake/scripts +# HDF5config.cmake cmake file copied from /config/cmake/scripts +# HDF5options.cmake cmake file copied from /config/cmake/scripts +# SZip.tar.gz copied from /mnt/scr1/pre-release/hdf5/CMake +# ZLib.tar.gz copied from /mnt/scr1/pre-release/hdf5/CMake + + +# Parameters: +# $1 version +# $2 release tarball +# $3 output zipball file name +# +# Returns 0 if successful; 1 otherwise +# + # need function to create another temporary directory, extract the + # $tmpdir/$HDF5_VERS.tar into it, add (create) build-unix.sh, + # CTestScript.cmake, HDF5config.cmake, SZIP.tar.gz and ZLib.tar.gz, + # and then tar.gz it. +tar2cmakezip() +{ + if [ $# -ne 3 ]; then + echo "usage: tar2cmakezip " + return 1 + fi + cmziptmpdir=/tmp/cmziptmpdir$$ + mkdir -p $cmziptmpdir + version=$1 + tarfile=$2 + zipfile=$3 + + # step 1: untar tarball in cmgztmpdir + (cd $cmziptmpdir; tar xf -) < $tarfile + # sanity check + if [ ! -d $cmziptmpdir/$version ]; then + echo "untar did not create $cmziptmpdir/$version source dir" + # cleanup + rm -rf $cmziptmpdir + return 1 + fi + + # step 2: add batch file for building CMake on window + cp /mnt/scr1/pre-release/hdf5/CMake/build-VS2012-32.bat $cmziptmpdir + cp /mnt/scr1/pre-release/hdf5/CMake/build-VS2012-64.bat $cmziptmpdir + cp /mnt/scr1/pre-release/hdf5/CMake/build-VS2013-32.bat $cmziptmpdir + cp /mnt/scr1/pre-release/hdf5/CMake/build-VS2013-64.bat $cmziptmpdir + cp /mnt/scr1/pre-release/hdf5/CMake/build-VS2015-32.bat $cmziptmpdir + cp /mnt/scr1/pre-release/hdf5/CMake/build-VS2015-64.bat $cmziptmpdir + + # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files + cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmziptmpdir + cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmziptmpdir + cp $cmziptmpdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpdir + cp $cmziptmpdir/$version/config/cmake/scripts/HDF5config.cmake $cmziptmpdir + cp $cmziptmpdir/$version/config/cmake/scripts/HDF5options.cmake $cmziptmpdir + + # step 4: convert text files + # There maybe a simpler way to do this. + # options used in unix2dos: + # -k Keep the date stamp + # -q quiet mode + # grep redirect output to /dev/null because -q or -s are not portable. + find $cmziptmpdir/$version | \ + while read inf; do \ + if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ + unix2dos -q -k $inf; \ + fi\ + done + # step 3: make zipball + # -9 maximum compression + # -y Store symbolic links as such in the zip archive + # -r recursive + # -q quiet + (cd $cmziptmpdir; zip -9 -y -r -q CMake-$version.zip *) + mv $cmziptmpdir/CMake-$version.zip $zipfile + + # cleanup + rm -rf $cmziptmpdir +} + +# Function name: tar2cmaketgz +# Convert the release tarball to a Windows zipball with files to run CMake build. +# +# Programmer: Larry Knox +# Creation date: 2017-02-20 +# +# Modifications +# +# Steps: +# 1. untar the tarball in a temporary directory; +# Note: do this in a temporary directory to avoid changing +# the original source directory which may be around. +# 2. add build-unix.sh script. +# 3. add SZIP.tar.gz, ZLib.tar.gz and cmake files to top level directory. +# 4. create gzipped tar file with these contents: +# build-unix.sh script +# hdf5- source code directory extracted from tar file +# CTestScript.cmake cmake file copied from /config/cmake/scripts +# HDF5config.cmake cmake file copied from /config/cmake/scripts +# HDF5options.cmake cmake file copied from /config/cmake/scripts +# SZip.tar.gz copied from /mnt/scr1/pre-release/hdf5/CMake +# ZLib.tar.gz copied from /mnt/scr1/pre-release/hdf5/CMake + + +# Parameters: +# $1 version +# $2 release tarball +# $3 output zipball file name +# +# Returns 0 if successful; 1 otherwise +# + # need function to create another temporary directory, extract the + # $tmpdir/$HDF5_VERS.tar into it, add (create) build-unix.sh, + # CTestScript.cmake, HDF5config.cmake, SZIP.tar.gz and ZLib.tar.gz, + # and then tar.gz it. +tar2cmaketgz() +{ + if [ $# -ne 3 ]; then + echo "usage: tar2cmaketgz " + return 1 + fi + cmgztmpdir=/tmp/cmgztmpdir$$ + mkdir -p $cmgztmpdir + version=$1 + tarfile=$2 + tgzfile=$3 + + # step 1: untar tarball in cmgztmpdir + (cd $cmgztmpdir; tar xf -) < $tarfile + # sanity check + if [ ! -d $cmgztmpdir/$version ]; then + echo "untar did not create $cmgztmpdir/$version source dir" + # cleanup + rm -rf $cmgztmpdir + return 1 + fi + + + # step 2: add build-unix.sh script + (cd $cmgztmpdir; echo "ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log" > build-unix.sh; chmod 755 build-unix.sh) + + # step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files + cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmgztmpdir + cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpdir + cp $cmgztmpdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpdir + cp $cmgztmpdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpdir + cp $cmgztmpdir/$version/config/cmake/scripts/HDF5options.cmake $cmgztmpdir + tar czf $DEST/CMake-$HDF5_VERS.tar.gz -C $cmgztmpdir . || exit 1 + + # cleanup + rm -rf $cmgztmpdir +} + # This command must be run at the top level of the hdf5 source directory. # Verify this requirement. if [ ! \( -f configure.ac -a -f bin/release \) ]; then @@ -256,6 +430,7 @@ if [ X$pmode = Xyes ]; then # (h5vers does not correctly handle just m.n.r-$today.) VERS=`echo $VERS | sed -e s/-.*//`-of$today echo Private release of $VERS +else bin/h5vers -s $VERS fi @@ -325,6 +500,11 @@ for comp in $methods; do gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz (cd $DEST; md5sum $HDF5_VERS.tar.gz >> $MD5file) ;; + cmake-tgz) + test "$verbose" && echo " Creating CMake tar.gz file..." 1>&2 + tar2cmaketgz $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/CMake-$HDF5_VERS.tar.gz 1>&2 + (cd $DEST; md5sum CMake-$HDF5_VERS.tar.gz >> $MD5file) + ;; bzip2) test "$verbose" && echo " Running bzip2..." 1>&2 bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2 @@ -335,6 +515,11 @@ for comp in $methods; do tar2zip $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2 (cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file) ;; + cmake-zip) + test "$verbose" && echo " Creating CMake-zip ball..." 1>&2 + tar2cmakezip $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/CMake-$HDF5_VERS.zip 1>&2 + (cd $DEST; md5sum CMake-$HDF5_VERS.zip >> $MD5file) + ;; doc) if [ "${DOCVERSION}" = "" ]; then DOCVERSION=master @@ -342,12 +527,12 @@ for comp in $methods; do test "$verbose" && echo " Creating docs..." 1>&2 # Check out docs from git repo (cd $tmpdir; git clone -q $DOC_URL ${DOCVERSION} > /dev/null) || exit 1 - # Create doxygen C++ RM + # Create doxygen C++ RM (cd c++/src && doxygen cpp_doc_config > /dev/null ) || exit 1 # Replace version of C++ RM with just-created version rm -rf $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME mv c++/src/$CPPLUS_RM_NAME $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME - # Compress the docs and move them to the release area + # Compress the docs and move them to the release area mv $tmpdir/${DOCVERSION} $tmpdir/${HDF5_VERS}_docs (cd $tmpdir && tar cf ${HDF5_VERS}_docs.tar ${HDF5_VERS}_docs) mv $tmpdir/${HDF5_VERS}_docs.tar $DEST -- cgit v0.12