From 440ad905e70cebccaa1fa5e1750336d1ff871336 Mon Sep 17 00:00:00 2001 From: not populated <acc@noc.ac.uk> Date: Wed, 1 Dec 2021 10:50:42 +0000 Subject: [PATCH] Tried to restore correct time order to test directories by prepending date to short hash. Date is a 5-digit number constructed from a 2-digit year and 3-digit year-day --- sette/all_functions.sh | 15 ++++++++++----- sette/param.cfg | 10 ++++++---- sette/sette_eval.sh | 11 +++++++---- sette/sette_rpt.sh | 11 +++++++---- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/sette/all_functions.sh b/sette/all_functions.sh index 0184f86db..8e817db7c 100755 --- a/sette/all_functions.sh +++ b/sette/all_functions.sh @@ -171,19 +171,24 @@ clean_config() { # define validation dir set_valid_dir () { - #REVISION_NB=`${SVN_CMD} info ${SETTE_DIR}/.. | grep "Last Changed Rev" | awk '{print $NF}'` - REVISION_NB=`git rev-list --abbrev-commit origin | tail -1l` + REVISION_NB=`git rev-list --abbrev-commit origin | head -1l` + REV_DATE0="`git log -1 | grep Date | sed -e 's/.*Date: *//' -e's/ +.*$//'`" + REV_DATE=`${DATE_CONV}"${REV_DATE0}" +"%y%j"` + REVISION_NB=${REV_DATE}_${REVISION_NB} if [ ${#REVISION_NB} -eq 0 ] then - echo "some problems with ${SVN_CMD} info command" - echo "some problems with ${SVN_CMD} info command" >> ${SETTE_DIR}/output.sette + echo "some problems with git rev-list command" + echo "some problems with git rev-list command" >> ${SETTE_DIR}/output.sette REVISION_NB=`date +%Y%m%d` echo "put in ${REVISION_NB} date" echo "put in ${REVISION_NB} date" >> ${SETTE_DIR}/output.sette else echo "value of revision number of NEMOGCM: ${REVISION_NB}" fi - #[ `${SVN_CMD} status -q ${SETTE_DIR}/../{cfgs,tests,src} | wc -l` -ge 1 ] && REVISION_NB=${REVISION_NB}+ + localchanges=`git status --short -uno | wc -l` + if [ $localchanges > 0 ] ; then + REVISION_NB=${REVISION_NB}+ + fi # remove last _ST followed by zero or more alphanumeric characters NEW_CONF1=$( echo $NEW_CONF | sed -e 's/_ST\([0-9a-zA-Z]*\)$//' ) export NEMO_VALID=${NEMO_VALIDATION_DIR}/${CMP_NAM}/${REVISION_NB}/${NEW_CONF1}/${TEST_NAME} diff --git a/sette/param.cfg b/sette/param.cfg index f55998608..4d1651b43 100644 --- a/sette/param.cfg +++ b/sette/param.cfg @@ -7,7 +7,7 @@ NEMO_REV_REF=0000 # # ------------------------------------------------------------------------------------------ # IMPORTANT: -# variables (COMPILER, BATCH_CMD, BATCH_STAT, BATCH_NAME, FORCING_DIR, SVN_CMD) +# variables (COMPILER, BATCH_CMD, BATCH_STAT, BATCH_NAME, FORCING_DIR) # can be exported from your shell startup files. # If it is the case, nothing to do # otherwise, you need to update the default initialisation @@ -46,9 +46,11 @@ JOB_PREFIX_NOMPMD=${SETTE_JOB_PREFIX_NOMPMD:-batch} # ------------------------------------------------------------------------------------------ # # MISCELLANEOUS -# command for svn (some people use git svn) -# used in sette_rpt and in all_function to display revision and build correct repository name -SVN_CMD=${SETTE_SVN_CMD:-svn} +# command for converting date (from git log -1) into 2-digit year + yearday +date -j -f "%a %b %d %H:%M:%S %Y" "Tue Nov 30 17:10:53 2021" +"%y%j" >& /dev/null +if [ $? == 0 ] ; then DATE_CONV='date -j -f "%a %b %d %H:%M:%S %Y" ' ;fi +date --date="Tue Nov 30 17:10:53 2021" +"%y%j" >& /dev/null +if [ $? == 0 ] ; then DATE_CONV='date --date=' ;fi # only for IBM #TMPDIR=${CONFIG_DIR}/${NEW_CONF}/EXP00 # cleaning CFG_ST diff --git a/sette/sette_eval.sh b/sette/sette_eval.sh index f204e4c9a..f942f177f 100755 --- a/sette/sette_eval.sh +++ b/sette/sette_eval.sh @@ -150,7 +150,7 @@ function runcmpres(){ ## ## ######################################################################################### # -# LOAD param variable (COMPILER, NEMO_VALIDATION_DIR, SVN_CMD) +# LOAD param variable (COMPILER, NEMO_VALIDATION_DIR ) SETTE_DIR=$(cd $(dirname "$0"); pwd) MAIN_DIR=$(dirname $SETTE_DIR) quiet=0 @@ -235,12 +235,15 @@ function runcmpres(){ # if [ ${quiet} -eq 0 ] ; then echo "" ; fi localchanges=`git status --short -uno | wc -l` -revision=`git rev-list --abbrev-commit origin | tail -1l` -branchname=`${SVN_CMD} info ${MAIN_DIR} | grep ^URL | awk -F ipsl/forge/projets/nemo/svn/ '{print $NF}'` +revision=`git rev-list --abbrev-commit origin | head -1l` +rev_date0=`git log -1 | grep Date | sed -e 's/.*Date: *//' -e's/ +.*$//'` +rev_date=`${DATE_CONV}"${rev_date0}" +"%y%j"` +revision=${rev_date}_${revision} +branchname=`git branch --show-current` if [ ${quiet} -eq 0 ] ; then if [ $localchanges > 0 ] ; then echo "Current code is : $branchname @ $revision ( with local changes )" - lastchange=${revision}_++ + lastchange=${revision}+ else echo "Current code is : $branchname @ $revision" lastchange=$revision diff --git a/sette/sette_rpt.sh b/sette/sette_rpt.sh index 62689be72..5d922bf8f 100755 --- a/sette/sette_rpt.sh +++ b/sette/sette_rpt.sh @@ -463,7 +463,7 @@ function identictest(){ ## ## ######################################################################################### # -# LOAD param variable (COMPILER, NEMO_VALIDATION_DIR, SVN_CMD) +# LOAD param variable (COMPILER, NEMO_VALIDATION_DIR ) SETTE_DIR=$(cd $(dirname "$0"); pwd) MAIN_DIR=$(dirname $SETTE_DIR) . ./param.cfg @@ -542,11 +542,14 @@ function identictest(){ # echo "" localchanges=`git status --short -uno | wc -l` -revision=`git rev-list --abbrev-commit origin | tail -1l` -branchname=`${SVN_CMD} info ${MAIN_DIR} | grep ^URL | awk -F ipsl/forge/projets/nemo/svn/ '{print $NF}'` +revision=`git rev-list --abbrev-commit origin | head -1l` +rev_date0=`git log -1 | grep Date | sed -e 's/.*Date: *//' -e's/ +.*$//'` +rev_date=`${DATE_CONV}"${rev_date0}" +"%y%j"` +revision=${rev_date}_${revision} +branchname=`git branch --show-current` if [ $localchanges > 0 ] ; then echo "Current code is : $branchname @ $revision ( with local changes )" - lastchange=${revision}_++ + lastchange=${revision}+ else echo "Current code is : $branchname @ $revision" lastchange=$revision -- GitLab