New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 12289 for utils/CI/sette_ticket2304/all_functions.sh – NEMO

Ignore:
Timestamp:
2019-12-30T16:31:18+01:00 (4 years ago)
Author:
mathiot
Message:

as suggested by Simon, instead of stopping sette if namelist group is missing, we now add it at the end of the namelist + rm useless line in sette_list_avail_rev.sh + add syncronisation of MY_SRC, namelist_cfg, xml, cppkey files between REF and _ST (ticket #2304)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • utils/CI/sette_ticket2304/all_functions.sh

    r12238 r12289  
    9090usage=" Usage : set_namelist input_namelist variable_name value" 
    9191usage=" if value is a string ths is neede syntax : ./set_namelist namelist_name var_name \"new_value\" " 
     92 
     93# sync MYSRC files 
     94sync_mysrc() { 
     95lREF=cfgs/$1    # reference  
     96lCFG=cfgs/$2    # target 
     97if [ -d $lREF/MY_SRC ] ; then 
     98   cp $lREF/MY_SRC/* $lCFG/MY_SRC/* 
     99fi 
     100} 
     101 
     102# sync namelist files and xios related files 
     103sync_expcfg() { 
     104set -x 
     105lREF=cfgs/$1 
     106lCFG=cfgs/$2 
     107if [ -d $lREF/EXPREF ] ; then 
     108   cp $lREF/EXPREF/*namelist*_cfg  $lCFG/EXP00/. 
     109   cp $lREF/EXPREF/iodef.xml       $lCFG/EXP00/. 
     110   cp $lREF/EXPREF/context_*.xml   $lCFG/EXP00/. 
     111   cp $lREF/EXPREF/file_def_*.xml  $lCFG/EXP00/. 
     112fi 
     113set +x 
     114} 
     115 
     116# sync cppkey file 
     117sync_cppcfg() { 
     118lREF=cfgs/$1 
     119lCFG=cfgs/$2 
     120if [ -f $lREF/cpp_$1.fcm ] ; then 
     121   cp $lREF/cpp_$1.fcm $lCFG/cpp_$2.fcm 
     122fi 
     123} 
    92124 
    93125# define validation dir 
     
    156188                LINEVAR=$( grep -s -n "$VAR_NAME" ${EXE_DIR}/$NAMREF | awk -F: '{ { print $1} }' ) 
    157189                echo " $VAR_NAME found in ${EXE_DIR}/$NAMREF at line $LINEVAR " >> ${SETTE_DIR}/output.sette 
     190 
    158191#   search for namelist group name 
    159192                NAMGRP=$( head -n$LINEVAR ${EXE_DIR}/$NAMREF | grep --line-buffered "^&nam" | tail -1 | awk -F" " '{ { print $1} }' )  
    160193                echo " variable $VAR_NAME will be added in $NAMGRP namelist-group of namelist file ${EXE_DIR}/$1 " >> ${SETTE_DIR}/output.sette 
     194 
     195# check if namelist group present in namelist_cfg 
     196# if missing group is added at the end of namelist_cfg 
     197                NGRP=$(grep ${NAMGRP} ${EXE_DIR}/$1 | wc -l ) 
     198                if [ ${NGRP} -eq 0 ]; then 
     199                   echo '' 
     200                   echo "+++++ Group ${NAMGRP} containing ${2} is missing in ${EXE_DIR}/$1 +++++ "       
     201                   echo "+++++ Group ${NAMGRP}                 is added   in ${EXE_DIR}/$1 +++++ "       
     202                   echo '' 
     203                   echo "&${NAMGRP}" >> ${EXE_DIR}/$1 
     204                   echo "/"          >> ${EXE_DIR}/$1 
     205                fi 
     206 
    161207# Add $VARNAME in namelist file ${EXE_DIR}/$1 in namelist group $NAMGRP 
    162208# on mac osx, replace sed --posix by gsed (available with mac port) 
    163209                sed --posix "/${NAMGRP} /a\ ${VAR_NAME} " ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp || gsed --posix "/${NAMGRP} /a\ ${VAR_NAME} " ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 
     210 
    164211# if file not empty replace ${EXE_DIR}/$1 
    165                 # check if namelist group present in namelist_cfg 
    166                 NGRP=$(grep ${NAMGRP} ${EXE_DIR}/$1 | wc -l ) 
    167                 if [ ${NGRP} -eq 0 ]; then 
    168                    echo '' 
    169                    echo "+++++ Cannot update ${2} because group ${NAMGRP} is missing in ${EXE_DIR}/$1  +++++ "       
    170                    echo '' 
    171                    exit 42 
    172                 fi 
    173                 if [ -s ${EXE_DIR}/$1.tmp ] ; then 
     212               if [ -s ${EXE_DIR}/$1.tmp ] ; then 
    174213                   mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1  
    175214                else 
Note: See TracChangeset for help on using the changeset viewer.