From 68a8152d0340b3f589f76ba05fc5807c9fc91e26 Mon Sep 17 00:00:00 2001 From: John Omotani Date: Fri, 23 Feb 2024 10:55:19 +0000 Subject: [PATCH 1/3] Replace `realpath` with Python in machine setup script `realpath` is not necessarily portable, while we already require Python to be available for the Julia-downloader script. Using Python's `os` module should be pretty portable. --- machines/machine_setup.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/machines/machine_setup.sh b/machines/machine_setup.sh index 2f85133b0..0d29ea3e5 100755 --- a/machines/machine_setup.sh +++ b/machines/machine_setup.sh @@ -174,8 +174,11 @@ if [ $REQUEST_INPUT -eq 0 ]; then fi fi # Ensure we have the resolved path for $JULIA, to avoid potentially creating a -# self-referencing symlink at bin/julia -JULIA=$(realpath $JULIA) +# self-referencing symlink at bin/julia. +# Use Python's `os.path` module instead of GNU coreutils `realpath` as +# `realpath` may not be available on all systems (e.g. some MacOS versions), +# but we already assume Python is available. +JULIA=$(/usr/bin/env python3 -c "import os; juliapath = os.path.realpath('$JULIA'); not os.path.isfile(juliapath) and exit(1); print(juliapath)") # Make sure $JULIA is actually an executable. If not, prompt the user to try # again. @@ -191,9 +194,13 @@ while [[ -z "$JULIA" || ! $(command -v $JULIA) ]]; do read -e -p "> " JULIA done # Convert $JULIA (which might be a relative path) to an absolute path. -# '-s' to skip resolving symlinks (if we did resolve symlinks, it might make -# the path look different than expected). -JULIA=$(realpath -s $JULIA) +# Use Python's `os.path` module instead of GNU coreutils `realpath` as +# `realpath` may not be available on all systems (e.g. some MacOS versions), +# but we already assume Python is available. +# Use `os.path.abspath` rather than `os.path.realpath` to skip resolving +# symlinks (if we did resolve symlinks, it might make the path look different +# than expected). +JULIA=$(/usr/bin/env python3 -c "import os; juliapath = os.path.abspath('$JULIA'); not os.path.isfile(juliapath) and exit(1); print(juliapath)") echo echo "Using Julia at $JULIA" echo @@ -224,11 +231,16 @@ if [ ! -z "$input" ]; then JULIA_DIRECTORY=$input fi # Convert input (which might be a relative path) to an absolute path. -# '-m' to avoid erroring if the directory does not exist already. -# '-s' to skip resolving symlinks (if we did resolve symlinks, it might make -# the path look different than expected). +# Note that here we do not require the directory to exist already - if it does +# not exist then Julia will create it. +# Use Python's `os.path` module instead of GNU coreutils `realpath` as +# `realpath` may not be available on all systems (e.g. some MacOS versions), +# but we already assume Python is available. +# Use `os.path.abspath` rather than `os.path.realpath` to skip resolving +# symlinks (if we did resolve symlinks, it might make the path look different +# than expected). if [ ! -z "$JULIA_DIRECTORY" ]; then - JULIA_DIRECTORY=$(realpath -m -s $JULIA_DIRECTORY) + JULIA_DIRECTORY=$(/usr/bin/env python3 -c "import os; print(os.path.abspath('$JULIA_DIRECTORY'))") fi echo echo "Using julia_directory=$JULIA_DIRECTORY" From 0e5d6fff56f0e03fa2a6f97d2be2f1479fb40df8 Mon Sep 17 00:00:00 2001 From: John Omotani Date: Wed, 13 Mar 2024 13:10:07 +0000 Subject: [PATCH 2/3] Update HDF5 source code download link --- machines/generic-batch-template/compile_dependencies.sh | 2 +- machines/generic-pc/compile_dependencies.sh | 2 +- machines/marconi/compile_dependencies.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/machines/generic-batch-template/compile_dependencies.sh b/machines/generic-batch-template/compile_dependencies.sh index ba52a4d75..2e4367867 100755 --- a/machines/generic-batch-template/compile_dependencies.sh +++ b/machines/generic-batch-template/compile_dependencies.sh @@ -79,7 +79,7 @@ fi if [[ $BUILDHDF5 == "y" ]]; then HDF5=hdf5-1.14.3 # Download and extract the source - wget -O ${HDF5}.tar.bz2 https://www.hdfgroup.org/package/hdf5-1-14-3-tar-bz2/?wpdmdl=18469 + wget -O ${HDF5}.tar.bz2 https://www.hdfgroup.org/package/hdf5-1-14-3-tar-bz2-2/?wpdmdl=18564 tar xjf ${HDF5}.tar.bz2 cd $HDF5 diff --git a/machines/generic-pc/compile_dependencies.sh b/machines/generic-pc/compile_dependencies.sh index 852a1d451..c2bf07f60 100755 --- a/machines/generic-pc/compile_dependencies.sh +++ b/machines/generic-pc/compile_dependencies.sh @@ -73,7 +73,7 @@ fi if [[ $BUILDHDF5 == "y" ]]; then HDF5=hdf5-1.14.3 # Download and extract the source - wget -O ${HDF5}.tar.bz2 https://www.hdfgroup.org/package/hdf5-1-14-3-tar-bz2/?wpdmdl=18469 + wget -O ${HDF5}.tar.bz2 https://www.hdfgroup.org/package/hdf5-1-14-3-tar-bz2-2/?wpdmdl=18564 tar xjf ${HDF5}.tar.bz2 cd $HDF5 diff --git a/machines/marconi/compile_dependencies.sh b/machines/marconi/compile_dependencies.sh index 1e11e7420..bd8d1ce03 100755 --- a/machines/marconi/compile_dependencies.sh +++ b/machines/marconi/compile_dependencies.sh @@ -32,7 +32,7 @@ fi if [ $BUILDHDF5 -eq 0 ]; then HDF5=hdf5-1.14.3 # Download and extract the source - wget -O ${HDF5}.tar.bz2 https://www.hdfgroup.org/package/hdf5-1-14-3-tar-bz2/?wpdmdl=18469 + wget -O ${HDF5}.tar.bz2 https://www.hdfgroup.org/package/hdf5-1-14-3-tar-bz2-2/?wpdmdl=18564 tar xjf ${HDF5}.tar.bz2 cd $HDF5 From 93caa51b648758cad77e1a976357d9a450fb936d Mon Sep 17 00:00:00 2001 From: John Omotani Date: Wed, 13 Mar 2024 13:21:46 +0000 Subject: [PATCH 3/3] Better download link for HDF5 source code Officially-supported download link that does not require going through an interactive web page. Thanks to forum threads: https://forum.hdfgroup.org/t/direct-download-link-for-1-10-x-binaries/4962/13 https://forum.hdfgroup.org/t/please-provide-stable-urls-for-official-binaries-without-auth/7378/8 --- machines/generic-batch-template/compile_dependencies.sh | 2 +- machines/generic-pc/compile_dependencies.sh | 2 +- machines/marconi/compile_dependencies.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/machines/generic-batch-template/compile_dependencies.sh b/machines/generic-batch-template/compile_dependencies.sh index 2e4367867..2f333f12b 100755 --- a/machines/generic-batch-template/compile_dependencies.sh +++ b/machines/generic-batch-template/compile_dependencies.sh @@ -79,7 +79,7 @@ fi if [[ $BUILDHDF5 == "y" ]]; then HDF5=hdf5-1.14.3 # Download and extract the source - wget -O ${HDF5}.tar.bz2 https://www.hdfgroup.org/package/hdf5-1-14-3-tar-bz2-2/?wpdmdl=18564 + wget -O ${HDF5}.tar.bz2 https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.3/src/hdf5-1.14.3.tar.bz2 tar xjf ${HDF5}.tar.bz2 cd $HDF5 diff --git a/machines/generic-pc/compile_dependencies.sh b/machines/generic-pc/compile_dependencies.sh index c2bf07f60..15c3c5860 100755 --- a/machines/generic-pc/compile_dependencies.sh +++ b/machines/generic-pc/compile_dependencies.sh @@ -73,7 +73,7 @@ fi if [[ $BUILDHDF5 == "y" ]]; then HDF5=hdf5-1.14.3 # Download and extract the source - wget -O ${HDF5}.tar.bz2 https://www.hdfgroup.org/package/hdf5-1-14-3-tar-bz2-2/?wpdmdl=18564 + wget -O ${HDF5}.tar.bz2 https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.3/src/hdf5-1.14.3.tar.bz2 tar xjf ${HDF5}.tar.bz2 cd $HDF5 diff --git a/machines/marconi/compile_dependencies.sh b/machines/marconi/compile_dependencies.sh index bd8d1ce03..e18a41e25 100755 --- a/machines/marconi/compile_dependencies.sh +++ b/machines/marconi/compile_dependencies.sh @@ -32,7 +32,7 @@ fi if [ $BUILDHDF5 -eq 0 ]; then HDF5=hdf5-1.14.3 # Download and extract the source - wget -O ${HDF5}.tar.bz2 https://www.hdfgroup.org/package/hdf5-1-14-3-tar-bz2-2/?wpdmdl=18564 + wget -O ${HDF5}.tar.bz2 https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.3/src/hdf5-1.14.3.tar.bz2 tar xjf ${HDF5}.tar.bz2 cd $HDF5