diff --git a/README.md b/README.md index d8c410674725eb51a64022d97e0e292d220814ef..ff2da87cbc608505e29066e2619bb5bb169c3efe 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,19 @@ Documentation can be found in the [docs directory](./docs/PHYEX.md). Several presentations were done, the materials can be found on the [wiki](https://github.com/UMR-CNRM/PHYEX/wiki). -Quick Start Guide: +Prerequisites: + - an internet connexion (with access to the github servers) is needed only for the installation + - python > 3.7 (but only tested with version 3.10) + - a C compiler (tested with cc 11.4.0) + - a FORTRAN compiler (tested with ifort and gfortran, but automatic installation only works with gfortran) + - some classical unix tools: wget, tar, make and git - - open a terminal on a linux system and type the following commands: - - git clone git@github.com:UMR-CNRM/PHYEX.git # Clone the PHYEX repository locally - - ./PHYEX/tools/INSTALL.sh --ALL --test # Install everything and run a test +Quick Start Guide: + - open a terminal on a system satisfying the prerequisites and enter the following commands + - if you don't have a github ssh key or don't know what it is: + > git@github.com:UMR-CNRM/PHYEX.git + > ./PHYEX/tools/INSTALL.sh --ALL --test + - if you have a github ssh key: + > git clone git@github.com:UMR-CNRM/PHYEX.git + > ./PHYEX/tools/INSTALL.sh --ALL --test --ssh - If all goes well, the last line should be "SUCCESS, files are identical" diff --git a/build/with_fcm/make_fcm.sh b/build/with_fcm/make_fcm.sh index 94cb82b33510dec4c07d27229e100f994a6513e8..ab8f35a0c48d3a1d3c6678b526705300a46c419b 100755 --- a/build/with_fcm/make_fcm.sh +++ b/build/with_fcm/make_fcm.sh @@ -16,6 +16,9 @@ function parse_args() { commit="" packcreation=0 compilation=0 + inplaceClean=0 + inplaceInstall=0 + ssh=0 # pass unrecognized arguments to fcm FCM_ARGS="" @@ -34,6 +37,9 @@ $0 [options] --commit commit hash (or a directory) to test; do not use this option from within a repository -p creates 'pack' (compilation directory) -c performs compilation +--inplace-install install, if needed, fiat and fcm in the directory where the current script is +--inplace-clean remove the fiat and fcm installation present in the directory where the current script is +--ssh use the ssh protocol to clone the pyft and fxtran repositories instead of https" Unrecognized options are passed to the fcm build command. Useful options include : --new clean build tree before building @@ -59,6 +65,9 @@ EOF '--commit') commit=$1; shift;; '-p') packcreation=1;; '-c') compilation=1;; + '--inplace-install') inplaceInstall=1;; + '--inplace-clean') inplaceClean=1;; + '--ssh') ssh=1;; *) FCM_ARGS="$FCM_ARGS $OPTION" ;; esac @@ -72,7 +81,9 @@ EOF echo "--arch option is mandatory if --mesonhprofile option is used" exit 3 fi - if [ $packcreation -eq 0 -a \ + if [ $inplaceInstall -eq 0 -a \ + $inplaceClean -eq 0 -a \ + $packcreation -eq 0 -a \ $compilation -eq 0 ]; then packcreation=1 compilation=1 @@ -84,7 +95,11 @@ function check_install_fcm() { echo "Performing FCM installation..." cd fcm rm -f .gitkeep - git clone https://github.com/metomi/fcm.git . + if [ $ssh -eq 1 ]; then + git clone git@github.com:metomi/fcm.git + else + git clone https://github.com/metomi/fcm.git . + fi git checkout $fcm_version touch .gitkeep cd .. @@ -97,7 +112,11 @@ function check_install_fiat() { echo "Performing fiat cloning..." cd fiat rm -f .gitkeep - git clone https://github.com/ecmwf-ifs/fiat.git . + if [ $ssh -eq 1 ]; then + git clone git@github.com:ecmwf-ifs/fiat.git + else + git clone https://github.com/ecmwf-ifs/fiat.git . + fi git checkout $fiat_version touch .gitkeep cd .. @@ -264,6 +283,30 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Parse command line arguments parse_args $* +if [ $inplaceClean -eq 1 ]; then + # Change current working dir + cd $DIR + + # Restore fcm + rm -rf fcm + git restore fcm + + # Restore fiat + rm -rf fiat + git restore fiat +fi + +if [ $inplaceInstall -eq 1 ]; then + # Change current working dir + cd $DIR + + # Check the fcm installation + check_install_fcm + + # Check the fiat installation + check_install_fiat +fi + if [ $packcreation -eq 1 ]; then # Change current working dir cd -P $DIR diff --git a/tools/INSTALL.sh b/tools/INSTALL.sh index f1e89fb6a6d997737e903ed2eb600ddd8e96b0e2..6a8afef554218de90199fbf993e270c5cd983906 100755 --- a/tools/INSTALL.sh +++ b/tools/INSTALL.sh @@ -4,15 +4,23 @@ set -e set -o pipefail #abort if left command on a pipe fails -PHYEXTOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +#This script installs PHYEX +#Call the script with the -h option to get more information. + +################################ +#### COMMAND LINE ARGUMENTS #### +################################ function usage { echo "Usage: $0 [-h] [--ALL] [--dataset] [--pyft] [--clean]" echo " --ALL Install or clean everything" echo " --dataset Install or clean a reduced dataset for the test programs" echo " --pyft Install or clean the pyft tool" + echo " --fiatfcm Install or clean the fiat and fcm tools" echo " --clean Clean instead of installing" echo " --test Perform a test" + echo " --ssh Use the ssh protocol to clone the pyft, fxtran, fiat and fcm" + echo " repositories instead of https" } ALL=0 @@ -20,15 +28,19 @@ dataset=0 pyft=0 clean=0 dotest=0 +ssh=0 +fiatfcm=0 while [ -n "$1" ]; do case "$1" in '--ALL') ALL=1;; '--dataset') dataset=1;; '--pyft') pyft=1;; + '--fiatfcm') fiatfcm=1;; '--clean') clean=1;; '--test') dotest=1;; - '-h') usage;; + '--sh') ssh=1;; + '-h') usage; exit;; *) echo "Unknown option $1"; exit 1;; esac shift @@ -37,8 +49,15 @@ done if [ $ALL == 1 ]; then dataset=1 pyft=1 + fiatfcm=1 fi +################################# +#### INSTALLATION / CLEANING #### +################################# + +PHYEXTOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + if [ $dataset -eq 1 ]; then cd $PHYEXTOOLSDIR/testprogs_data/ for file in https://github.com/UMR-CNRM/PHYEX/files/12783926/ice_adjust.tar.gz \ @@ -62,16 +81,39 @@ if [ $pyft -eq 1 ]; then if [ $clean -eq 1 ]; then rm -rf pyft else - git clone git@github.com:UMR-CNRM/pyft.git - pyft/bin/INSTALL.sh + if [ $ssh -eq 1 ]; then + git clone git@github.com:UMR-CNRM/pyft.git + ./pyft/bin/INSTALL.sh --ssh + else + git clone https://github.com/UMR-CNRM/pyft.git + ./pyft/bin/INSTALL.sh + fi + echo "" echo "Instead of sourcing the previous file, you can source $PHYEXTOOLSDIR/env.sh" echo "This file, among other things, source the previous displayed file." fi fi +if [ $fiatfcm -eq 1 ]; then + if [ $clean -eq 1 ]; then + $PHYEXTOOLSDIR/../build/with_fcm/make_fcm.sh --inplace-clean + else + if [ $ssh -eq 1 ]; then + $PHYEXTOOLSDIR/../build/with_fcm/make_fcm.sh --inplace-install --ssh + else + $PHYEXTOOLSDIR/../build/with_fcm/make_fcm.sh --inplace-install + fi + fi +fi + if [ $dotest -eq 1 ]; then . $PHYEXTOOLSDIR/env.sh + if [ $ssh -eq 1 ]; then + protocol="ssh" + else + protocol="https" + fi check_commit_testprogs.sh $(cd $PHYEXTOOLSDIR/.. && pwd) REF \ --computeRefIfNeeded \ - --repo-user UMR-CNRM --repo-protocol ssh + --repo-user UMR-CNRM --repo-protocol $protocol fi diff --git a/tools/check_commit_ial.sh b/tools/check_commit_ial.sh index 35069b7b9d806557d2924c2db421155187a57614..5cb1c29d1aad6228b17bf0ba2d36fa45faecd183 100755 --- a/tools/check_commit_ial.sh +++ b/tools/check_commit_ial.sh @@ -176,7 +176,7 @@ computeRefIfNeeded=0 while [ -n "$1" ]; do case "$1" in - '-h') usage;; + '-h') usage; exit;; '-s') suppress=1;; '-p') packcreation=1;; '-c') compilation=1;; diff --git a/tools/check_commit_lmdz.sh b/tools/check_commit_lmdz.sh index 391caa66793bc44d9518bccdd8c91baf87e2229c..97cd92a77c194f1d19de7f29fbf139087e18fa7d 100755 --- a/tools/check_commit_lmdz.sh +++ b/tools/check_commit_lmdz.sh @@ -65,7 +65,7 @@ remove=0 while [ -n "$1" ]; do case "$1" in - '-h') usage;; + '-h') usage; exit;; '-s') suppress=1;; '-p') packcreation=1;; '-c') compilation=1;; diff --git a/tools/check_commit_mesonh.sh b/tools/check_commit_mesonh.sh index b690ef9d10b7edf2f497b93091ea585445453f31..180cd03394715f6a61f8ae5a2a1ba5690dadc8a5 100755 --- a/tools/check_commit_mesonh.sh +++ b/tools/check_commit_mesonh.sh @@ -93,7 +93,7 @@ computeRefIfNeeded=0 while [ -n "$1" ]; do case "$1" in - '-h') usage;; + '-h') usage; exit;; '-s') suppress=1;; '-p') packcreation=1;; '-c') compilation=1;; diff --git a/tools/check_commit_testprogs.sh b/tools/check_commit_testprogs.sh index 44cb3e6d06bd2728b600c4c457ee21dc8accc6af..a8fa9a5ebdf68a95caef9f320076a0a617221e8f 100755 --- a/tools/check_commit_testprogs.sh +++ b/tools/check_commit_testprogs.sh @@ -125,7 +125,7 @@ perf=1 while [ -n "$1" ]; do case "$1" in - '-h') usage;; + '-h') usage; exit;; '-s') suppress=1;; '-p') packcreation=1;; '-c') compilation=1;;