Skip to content
Snippets Groups Projects
Commit 41dc5a83 authored by RIETTE Sébastien's avatar RIETTE Sébastien
Browse files

S. Riette 21 oct 2022: change github repository, add ial_version.json file

Add env variables and script options to define the git repository on github

Choice of the IAL version to use is now define by the content of the src/arom/ial_version.json file
parent 94e07ba4
No related branches found
No related tags found
No related merge requests found
{
"cycle":"48t3",
"branch":"main",
"version":"01"
}
......@@ -226,7 +226,7 @@ commit=9ce8119430dd603d35308d8ae94cf18636157473 #exemple of commit to test again
gmkpack -r ${cycle} -b phyex -v ${version} -l ${compiler} -o ${option} -p masterodb -f $TRUNK -u PHYEX/$commit
cd $HOMEPACK/PHYEX/$commit/src/local/phyex
git clone git@github.com:QuentinRodier/PHYEX.git
git clone git@github.com:UMR-CNRM/PHYEX.git
cd PHYEX
git checkout $commit
#The exact manipulation to perform depends on the commit to test. For a full description, please see the check\_commit\_ial.sh script
......
......@@ -70,6 +70,10 @@ function usage {
echo "--noexpand do not use mnh_expand (code will be in array-syntax)"
echo "-f full compilation (do not use pre-compiled pack)"
echo "--cycle CYCLE to force using CYCLE"
echo "--repo-user user hosting the PHYEX repository on github,"
echo " defaults to the env variable PHYEXREOuser (=$PHYEXREOuser)"
echo "--repo-protocol protocol (https or ssh) to reach the PHYEX repository on github,"
echo " defaults to the env variable PHYEXREOprotocol (=$PHYEXREOprotocol)"
echo ""
echo "If nothing is asked (compilation, running, check) everything is done"
echo
......@@ -106,6 +110,8 @@ while [ -n "$1" ]; do
'--noexpand') useexpand=0;;
'-f') fullcompilation=1;;
'--cycle') cycle="$2"; shift;;
'--repo-user') export PHYEXREPOuser=$2; shift;;
'--repo-protocol') export PHYEXREPOprotocol=$2; shift;;
#--) shift; break ;;
*) if [ -z "${commit-}" ]; then
commit=$1
......@@ -159,7 +165,7 @@ if [ $check -eq 1 -a -z "${reference-}" ]; then
exit 3
fi
function content2cycle {
function apl_arome_content2cycle {
# variable content_apl_arome must contain the source code of apl_arome.F90
if grep CPG_DYN_TYPE <(echo $content_apl_arome) > /dev/null; then
echo 48t3
......@@ -168,13 +174,23 @@ function content2cycle {
fi
}
function ial_version_content2cycle {
# variable content_ial_version must contain the source code of ial_version.json
content_ial_version=$content_ial_version python3 -c "import json; import os; print(json.loads(os.environ['content_ial_version'])['cycle'])"
}
#Name is choosen such as it can be produced with a main pack: PHYEX/${cycle}_XXXXXXXXX.01.${gmkpack_l}.${gmkpack_o}
fromdir=''
if echo $commit | grep '/' > /dev/null; then
fromdir=$commit
if [ "$cycle" == "" ]; then
content_apl_arome=$(scp $commit/src/arome/ext/apl_arome.F90 /dev/stdout)
cycle=$(content2cycle)
content_ial_version=$(scp $commit/src/arome/ial_version.json /dev/stdout 2>/dev/null || echo "")
if [ "$content_ial_version" == "" ]; then
content_apl_arome=$(scp $commit/src/arome/ext/apl_arome.F90 /dev/stdout)
cycle=$(apl_arome_content2cycle)
else
cycle=$(ial_version_content2cycle)
fi
fi
packBranch=$(echo $commit | sed 's/\//'${separator}'/g' | sed 's/:/'${separator}'/g' | sed 's/\./'${separator}'/g')
name="PHYEX/${cycle}_${packBranch}.01.${gmkpack_l}.${gmkpack_o}"
......@@ -189,8 +205,13 @@ elif echo $specialPack | grep -w $commit > /dev/null; then
else
packBranch="COMMIT$commit"
if [ "$cycle" == "" ]; then
content_apl_arome=$(wget --no-check-certificate https://raw.githubusercontent.com/QuentinRodier/PHYEX/${commit}/src/arome/ext/apl_arome.F90 -O - 2>/dev/null)
cycle=$(content2cycle)
content_ial_version=$(wget --no-check-certificate https://raw.githubusercontent.com/$PHYEXREPOuser/PHYEX/${commit}/src/arome/ial_version.json -O - 2>/dev/null || echo "")
if [ "$content_ial_version" == "" ]; then
content_apl_arome=$(wget --no-check-certificate https://raw.githubusercontent.com/$PHYEXREPOuser/PHYEX/${commit}/src/arome/ext/apl_arome.F90 -O - 2>/dev/null)
cycle=$(apl_arome_content2cycle)
else
cycle=$(ial_version_content2cycle)
fi
fi
name="PHYEX/${cycle}_${packBranch}.01.${gmkpack_l}.${gmkpack_o}"
[ $suppress -eq 1 -a -d $HOMEPACK/$name ] && rm -rf $HOMEPACK/$name
......
......@@ -26,6 +26,10 @@ function usage {
echo "-t comma separated list of tests to execute"
echo " or ALL to execute all tests"
echo "--expand use mnh_expand (code will use do loops)"
echo "--repo-user user hosting the PHYEX repository on github,"
echo " defaults to the env variable PHYEXREOuser (=$PHYEXREOuser)"
echo "--repo-protocol protocol (https or ssh) to reach the PHYEX repository on github,"
echo " defaults to the env variable PHYEXREOprotocol (=$PHYEXREOprotocol)"
echo ""
echo "If nothing is asked (compilation, running, check) everything is done"
echo
......@@ -54,7 +58,8 @@ while [ -n "$1" ]; do
'-C') check=1;;
'-t') tests="$2"; shift;;
'--expand') useexpand=1;;
#-b) param="$2"; shift ;;
'--repo-user') export PHYEXREPOuser=$2; shift;;
'--repo-protocol') export PHYEXREPOprotocol=$2; shift;;
#--) shift; break ;;
*) if [ -z "${commit-}" ]; then
commit=$1
......
......@@ -39,6 +39,10 @@ function usage {
echo "-t comma separated list of tests to execute"
echo " or ALL to execute all tests"
echo "--noexpand do not use mnh_expand (code will be in array-syntax)"
echo "--repo-user user hosting the PHYEX repository on github,"
echo " defaults to the env variable PHYEXREOuser (=$PHYEXREOuser)"
echo "--repo-protocol protocol (https or ssh) to reach the PHYEX repository on github,"
echo " defaults to the env variable PHYEXREOprotocol (=$PHYEXREOprotocol)"
echo ""
echo "If nothing is asked (compilation, running, check) everything is done"
echo
......@@ -69,6 +73,8 @@ while [ -n "$1" ]; do
'-C') check=1;;
'-t') tests="$2"; shift;;
'--noexpand') useexpand=0;;
'--repo-user') export PHYEXREPOuser=$2; shift;;
'--repo-protocol') export PHYEXREPOprotocol=$2; shift;;
#--) shift; break ;;
*) if [ -z "${commit-}" ]; then
commit=$1
......
......@@ -11,9 +11,6 @@ set -e
###### CONFIGURATION
repository_https=https://github.com/QuentinRodier/PHYEX.git
repository_ssh=git@github.com:QuentinRodier/PHYEX.git
PHYEXTOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
###### COMMAND LINE ARGUMENTS
......@@ -29,7 +26,8 @@ function usage {
echo "-p push the result as a new branch"
echo "-s SUB subdiretory or file (under src) to consider when merging and applying mnh_expand"
echo "--renameFf rename .F90 into .f90"
echo "--ssh use ssh instead of https for git cloning"
echo "--repo use this repository instead of the one derived (if any) from the env variables"
echo " PHYEXREPOuser (=$PHYEXREPOuser) and PHYEXREPOprotocol (=$PHYEXREPOprotocol)"
echo "-v add verbosity (up to 3 -v)"
echo ""
echo "* If the -c option is not provided, DIRECTORY must already contain files and directory as if"
......@@ -54,7 +52,17 @@ push=0
subs=""
renameFf=0
verbose=0
repository=$repository_https
if [ -z "${PHYEXREPOprotocol-}" ]; then
repository=""
else
if [ $PHYEXREPOprotocol == 'https' ]; then
repository=https://github.com/$PHYEXREPOuser/PHYEX.git
elif [ $PHYEXREPOprotocol == 'ssh' ]; then
repository=git@github.com:$PHYEXREPOuser/PHYEX.git
else
repository=""
fi
fi
while [ -n "$1" ]; do
case "$1" in
......@@ -65,7 +73,7 @@ while [ -n "$1" ]; do
'-s') subs="$subs $2"; shift;;
'-p') push=1;;
'--renameFf') renameFf=1;;
'--ssh') repository=$repository_ssh;;
'--repo') repository=$2; shift;;
'-v') verbose=$(($verbose+1));;
*) directory="$1";;
esac
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment