Changeset 12289 for utils/CI/sette_ticket2304/all_functions.sh
- Timestamp:
- 2019-12-30T16:31:18+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
utils/CI/sette_ticket2304/all_functions.sh
r12238 r12289 90 90 usage=" Usage : set_namelist input_namelist variable_name value" 91 91 usage=" if value is a string ths is neede syntax : ./set_namelist namelist_name var_name \"new_value\" " 92 93 # sync MYSRC files 94 sync_mysrc() { 95 lREF=cfgs/$1 # reference 96 lCFG=cfgs/$2 # target 97 if [ -d $lREF/MY_SRC ] ; then 98 cp $lREF/MY_SRC/* $lCFG/MY_SRC/* 99 fi 100 } 101 102 # sync namelist files and xios related files 103 sync_expcfg() { 104 set -x 105 lREF=cfgs/$1 106 lCFG=cfgs/$2 107 if [ -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/. 112 fi 113 set +x 114 } 115 116 # sync cppkey file 117 sync_cppcfg() { 118 lREF=cfgs/$1 119 lCFG=cfgs/$2 120 if [ -f $lREF/cpp_$1.fcm ] ; then 121 cp $lREF/cpp_$1.fcm $lCFG/cpp_$2.fcm 122 fi 123 } 92 124 93 125 # define validation dir … … 156 188 LINEVAR=$( grep -s -n "$VAR_NAME" ${EXE_DIR}/$NAMREF | awk -F: '{ { print $1} }' ) 157 189 echo " $VAR_NAME found in ${EXE_DIR}/$NAMREF at line $LINEVAR " >> ${SETTE_DIR}/output.sette 190 158 191 # search for namelist group name 159 192 NAMGRP=$( head -n$LINEVAR ${EXE_DIR}/$NAMREF | grep --line-buffered "^&nam" | tail -1 | awk -F" " '{ { print $1} }' ) 160 193 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 161 207 # Add $VARNAME in namelist file ${EXE_DIR}/$1 in namelist group $NAMGRP 162 208 # on mac osx, replace sed --posix by gsed (available with mac port) 163 209 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 164 211 # 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 174 213 mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1 175 214 else
Note: See TracChangeset
for help on using the changeset viewer.