source: utils/CI/sette_ticket2304/all_functions.sh @ 12508

Last change on this file since 12508 was 12508, checked in by mathiot, 12 months ago

ticket #2304 : change in display output, synchrose all files that are not links instead of a selection of files as there is no consistancy in the various EXPREF between what is link or not, touch source files after synchronisation to trigger compilation in the unlikely case where source in CFG/MY_SRC is more recent than in REF/MY_SRC

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 21.1 KB
Line 
1######################################################
2# Author : Simona Flavoni for NEMO
3# Contact : sflod@locean-ipsl.upmc.fr
4#
5# ----------------------------------------------------------------------
6# NEMO/SETTE , NEMO Consortium (2010)
7# Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
8# ----------------------------------------------------------------------
9#
10# Some scripts called by sette.sh
11# all_functions.sh   : all functions used by sette.sh 
12######################################################
13#set -x
14#set -o posix
15#set -u
16#set -e
17#+
18#
19# ================
20# all_functions.sh
21# ================
22#
23# ----------------------------------------------
24# Set of functions used by sette.sh (NEMO tests)
25# ----------------------------------------------
26#
27# SYNOPSIS
28# ========
29#
30# ::
31#
32#  $ ./set_namelist INPUT_NAMELIST VARIABLE VALUE
33#  $ post_test_tidyup
34#
35#
36# DESCRIPTION
37# ===========
38#
39# function superegrep
40#   input variable value
41#
42# function set_namelist
43#   input namelist_name variable value
44#   output namelist
45#
46# function post_test_tidyup
47#   creates nemo_validation tree, and save output & debug files
48#   this function creates tree of validation in NEMO_VALIDATION_DIR as follows :
49#
50# NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/REVISION_NUMBER(or DATE)/TEST_NAME
51#
52# NEMO_VALIDATION_DIR           : is choosen in param.cfg
53#
54# WCONFIG_NAME                  : set by makenemo at the moment of compilation
55#
56# WCOMPILER_NAME                : set by makenemo at the moment of compilation
57#
58# REVISION_NUMBER(or DATE)      : revision number by svn info, if problems with svn date is taken
59#
60# TEST_NAME                     : set in sette.sh for each configuration to be tested (directory TEST_NAME is created under ${NEW_CONF} directory )
61#
62# EXAMPLES
63# ========
64#
65# ::
66#
67#  $ ./set_namelist namelist          nn_itend        75
68#  $ ./set_namelist namelist_ice      cn_icerst_in  \"00101231_restart_ice\"
69#  $ post_test_tidyup
70#
71#
72# TODO
73# ====
74#
75# option debug
76#
77#
78# EVOLUTIONS
79# ==========
80#
81# $Id$
82#
83#   * creation
84#-
85# function to find namelists parameters
86supergrep () {
87            grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
88    }
89
90usage=" Usage : set_namelist input_namelist variable_name value"
91usage=" if value is a string ths is neede syntax : ./set_namelist namelist_name var_name \"new_value\" "
92
93# sync MYSRC files (input CFG and CFG_ST)
94sync_config() {
95   if [ ${SYNC_CONFIGS} == "yes" ]; then
96
97      echo '-------------------------------------------------------------------------------'
98      echo '                    SOURCE AND CONFIG FILES SYNCHRONISATION                    '
99      echo ''
100      echo "configuration $3/$2 will be synchronised with $3/$1"
101      echo ''
102
103      lREF=$3/$1    # reference
104      lCFG=$3/$2    # target
105
106      # synchronise MY_SRC if $lCFG directory exist
107      if [ -d $lREF/MY_SRC ] && [ -d $lCFG ] ; then
108
109         if [ -d $lCFG/MY_SRC ] ; then
110
111            # Manage case number of file in MY_SRC changes
112            # find number of file only in $lCFG/MY_SRC
113            FCFG=`diff -r $lREF/MY_SRC $lCFG/MY_SRC | grep "Only in $lCFG/MY_SRC" | awk '{print $4}'`
114
115            # if more than 0, trigger a cleaning as Makenemo do not properly manage this case.
116            if [ ! -z "$FCFG" ]; then
117               echo ''
118               echo "$lCFG contains a different file list than $lREF :"
119               diff -r $lREF/MY_SRC $lCFG/MY_SRC | grep "Only in $lCFG/MY_SRC" | awk '{print $4}'
120               echo "Synchronisation is not enough because Makenemo does not handle well case where a file in MY_SRC is removed"
121               echo "Therefore, we need to clean $lCFG before starting runing it"
122               echo ''
123               CLEAN_CONFIGS="yes"
124            fi
125         fi
126
127         # synchronisation $lREF/MY_SRC directory (and delete file in target location if needed)
128         rsync -av --delete $lREF/MY_SRC/ $lCFG/MY_SRC
129
130         # rsync keep preserve the modification time stamp.
131         # To avoid case where a file in MY_SRC is replace by an older file, we touch the file
132         touch $lCFG/MY_SRC/*
133      fi
134
135      # synchronize EXPREF
136      if [ -d $lREF/EXPREF ] && [ -d $lCFG/EXP00 ] ; then
137         rsync -aq --no-links $lREF/EXPREF/ $lCFG/EXP00/.
138      fi
139      echo '-------------------------------------------------------------------------------'
140   fi
141}
142
143# clean _ST config (input CFG CFG_ST TYPE (test or ref))
144clean_config() {
145   if [ ${CLEAN_CONFIGS} == "yes" ]; then
146      lREF=$1
147      lCFG=$2
148      lTYP=$3
149      echo ''
150      echo '-------------------------------------------------------------------------------'
151      echo '                         CLEANING CONFIGURATION                                '
152      echo ''
153      echo "./makenemo -n $lCFG -a/-r $lREF clean"
154      echo ''
155      if [ ${lTYP} == 'tests' ]; then
156         ./makenemo -n $lCFG -a $lREF clean
157      elif [ ${lTYP} == 'cfgs' ]; then
158         ./makenemo -n $lCFG -r $lREF clean
159      else
160         echo 'ERROR in the cleaning process'; exit 42
161      fi
162      echo ''
163      echo "$lCFG configuration has been cleaned"
164      echo ''
165      echo '-------------------------------------------------------------------------------'
166   fi
167}
168
169# define validation dir
170set_valid_dir () {
171    LANG=en_US
172    REVISION_NB=`LC_MESSAGES=${LANG} ${SVN_CMD} info ${SETTE_DIR}/.. | grep "Last Changed Rev" | awk '{print $NF}'`
173    if [ ${#REVISION_NB} -eq 0 ]
174    then
175        echo "some problems with ${SVN_CMD} info command"
176        echo "some problems with ${SVN_CMD} info command" >> ${SETTE_DIR}/output.sette
177        REVISION_NB=`date +%Y%m%d`
178        echo "put in ${REVISION_NB} date"
179        echo "put in ${REVISION_NB} date" >> ${SETTE_DIR}/output.sette
180    else
181    echo "value of revision number of NEMOGCM: ${REVISION_NB}"
182    fi
183    [ `${SVN_CMD} status -q ${SETTE_DIR}/../{cfg,tests,src} | wc -l` -ge 1 ] && REVISION_NB=${REVISION_NB}+
184    NEMO_VALID=${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}
185}
186
187# clean valid dir (move old ocean_output/run.stat and tracer to avoid checking them in case something wrong happen.
188clean_valid_dir () {
189#   set_valid_dir # already done in sette_ref/sette_test
190   echo "validation directory is : $NEMO_VALID"
191   if [ -d $NEMO_VALID ] ; then
192      [ -f ${NEMO_VALID}/ocean.output ] && mv ${NEMO_VALID}/ocean.output ${NEMO_VALID}/ocean.output_old
193      [ -f ${NEMO_VALID}/run.stat ]     && mv ${NEMO_VALID}/run.stat     ${NEMO_VALID}/run.stat_old
194      [ -f ${NEMO_VALID}/tracer.stat ]  && mv ${NEMO_VALID}/tracer.stat  ${NEMO_VALID}/tracer.stat_old
195   fi
196}
197
198# function to set namelists parameters
199set_namelist () {
200   minargcount=3
201   if [ ${#} -lt ${minargcount} ]
202   then
203      echo "not enough arguments for set_namelist"
204      echo "${usage}"
205      exit 1
206   fi
207   unset minargcount
208   if [  ! -f ${SETTE_DIR}/output.sette ] ; then
209                touch ${SETTE_DIR}/output.sette
210        fi
211
212        echo "executing script : set_namelist $@" >> ${SETTE_DIR}/output.sette
213        echo "################" >> ${SETTE_DIR}/output.sette
214     
215   VAR_NAME=$( supergrep $2 ${EXE_DIR}/$1 )
216   if [ ${#VAR_NAME} -eq 0 ] 
217   then
218      echo "doing \"set_namelist $@\". "  >> ${SETTE_DIR}/output.sette
219      echo "variable: \"$2\" not found in \"${EXE_DIR}/$1\" "  >> ${SETTE_DIR}/output.sette
220                NAMREF=$( basename $1 _cfg )_ref
221      echo "doing more : search in ${EXE_DIR}/$NAMREF " >> ${SETTE_DIR}/output.sette
222                VAR_NAME=$( supergrep $2 ${EXE_DIR}/$NAMREF )
223           if [ ${#VAR_NAME} -eq 0 ] 
224           then
225                    echo " variable $VAR_NAME not found in ${EXE_DIR}/$1 nor in ${EXE_DIR}/$NAMREF "
226                    echo " check your variable name "
227            echo "exit"
228            echo "error in executing script : set_namelist $@" >> ${SETTE_DIR}/output.sette
229            echo "....." >> ${SETTE_DIR}/output.sette
230            exit 1
231                fi
232                LINEVAR=$( grep -s -n "$VAR_NAME" ${EXE_DIR}/$NAMREF | awk -F: '{ { print $1} }' )
233                echo " $VAR_NAME found in ${EXE_DIR}/$NAMREF at line $LINEVAR " >> ${SETTE_DIR}/output.sette
234
235#   search for namelist group name
236                NAMGRP=$( head -n$LINEVAR ${EXE_DIR}/$NAMREF | grep --line-buffered "^&nam" | tail -1 | awk -F" " '{ { print $1} }' ) 
237                echo " variable $VAR_NAME will be added in $NAMGRP namelist-group of namelist file ${EXE_DIR}/$1 " >> ${SETTE_DIR}/output.sette
238
239# check if namelist group present in namelist_cfg
240# if missing group is added at the end of namelist_cfg
241                NGRP=$(grep ${NAMGRP} ${EXE_DIR}/$1 | wc -l )
242                if [ ${NGRP} -eq 0 ]; then
243                   echo ''                                                                          >> ${SETTE_DIR}/output.sette
244                   echo "+++++ Group ${NAMGRP} containing ${2} is missing in ${EXE_DIR}/$1 +++++ "  >> ${SETTE_DIR}/output.sette
245                   echo "+++++ Group ${NAMGRP}                 is added   in ${EXE_DIR}/$1 +++++ "  >> ${SETTE_DIR}/output.sette
246                   echo ''                                                                          >> ${SETTE_DIR}/output.sette
247                   echo "&${NAMGRP}" >> ${EXE_DIR}/$1
248                   echo "/"          >> ${EXE_DIR}/$1
249                fi
250
251# Add $VARNAME in namelist file ${EXE_DIR}/$1 in namelist group $NAMGRP
252# on mac osx, replace sed --posix by gsed (available with mac port)
253                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
254
255# if file not empty replace ${EXE_DIR}/$1
256               if [ -s ${EXE_DIR}/$1.tmp ] ; then
257                   mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1 
258                else
259                echo "file ${EXE_DIR}/$1.tmp is empty. sed command went wrong "; exit 200
260                fi
261   fi
262
263        ARGS_LST="${@:3}"
264        sed -e "s;${VAR_NAME}.*;${VAR_NAME};" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
265        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
266        sed -e "s;${VAR_NAME};$2=${ARGS_LST};"  ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
267        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
268
269        echo "finished script : set_namelist $@" >> ${SETTE_DIR}/output.sette
270        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
271        echo "                " >> ${SETTE_DIR}/output.sette
272}
273
274
275# function to tidy up after each test and populate the NEMO_VALIDATION store
276post_test_tidyup () {
277# Save current exit status of caller script
278    RUN_STATUS=$? 
279    echo "Exit status: ${RUN_STATUS}" 
280#
281# requires the following variables defined and exported from the calling script:
282#  SETTE_DIR
283#  INPUT_DIR
284#  EXE_DIR
285#  CONFIG_DIR
286#  NEMO_VALIDATION_DIR
287#  NEW_CONF
288#  CMP_NAM
289#  TEST_NAME
290echo "SETTE directory is : ${SETTE_DIR}"
291echo "INPUT directory is : ${INPUT_DIR}"
292echo "EXECUTION directory is : ${EXE_DIR}"
293echo "CONFIG directory is : ${CONFIG_DIR}"
294echo "VALIDATION directory is : ${NEMO_VALID}"
295echo "NEW CONFIGURATION is : ${NEW_CONF}"
296echo "COMPILER is : ${CMP_NAM}"
297echo "TEST is : ${TEST_NAME}"
298echo "TOOLS directory is : ${TOOLS_DIR}"
299################################################################
300# SMALL DEBUG
301    EXIT_STATUS=${RUN_STATUS}
302    if [ ! -r ${EXE_DIR}/ocean.output ]
303        then
304        grep "E R R O R" ${EXE_DIR}/ocean.output && echo "Some ERRORS at execution time, see ${EXE_DIR}/ocean.output"
305        EXIT_STATUS=2
306        # exit 2 Error now catch in the report
307    fi
308
309    if [ ! -r ${EXE_DIR}/time.step ]
310        then
311        echo "file time.step does not exist"   >> ${SETTE_DIR}/output.sette
312        echo "some problems during execution of model"  >> ${SETTE_DIR}/output.sette
313        EXIT_STATUS=1
314        # exit 1 Error now catch in the report
315    else
316        echo "file time.step exists"  >> ${SETTE_DIR}/output.sette
317        echo "execution of model time step loop started"   >> ${SETTE_DIR}/output.sette
318    fi
319
320################################################################
321
322################################################################
323#
324# Creation of NEMO_VALIDATION tree
325#    set_valid_dir already done in sette_reference_config
326    mkdir -p ${NEMO_VALIDATION_DIR}
327    if [ -d ${NEMO_VALIDATION_DIR} ] ; then
328   echo "created ${NEMO_VALIDATION_DIR} directory"   >> ${SETTE_DIR}/output.sette
329    else
330   echo "problems in creating ${NEMO_VALIDATION_DIR} directory"   >> ${SETTE_DIR}/output.sette
331   echo "EXIT,"
332   exit 1
333    fi
334#
335# Exit before populating validation directory if the model run has
336# returned a non-zero exit status
337# On CRAY NEMO exit is not the expected 999 or 123456 (let this bloc in case useful later on).
338#    case ${EXIT_STATUS} in
339#        0|123456|999) echo " NEMO finished with exit code $EXIT_STATUS " ; post_test_tidyup ;;
340#        *) echo " NEMO abort on an unexpected error (segmentation fault or whatever) $EXIT_STATUS "
341#    esac
342
343    [ ${EXIT_STATUS} -ne 0 ] && exit ${EXIT_STATUS} 
344#
345# Save output & debug files in NEMO_VALIDATION tree
346    echo "saving ocean & ice output, run.stat, tracer.stat files ...." >> ${SETTE_DIR}/output.sette
347    echo "            " >> ${SETTE_DIR}/output.sette
348    [ -f ${EXE_DIR}/ocean.output ] && cp ${EXE_DIR}/*ocean.output ${NEMO_VALIDATION_DIR}/.
349    [ -f ${EXE_DIR}/run.stat ] && cp ${EXE_DIR}/*run.stat ${NEMO_VALIDATION_DIR}/.
350    [ -f ${EXE_DIR}/output.namelist.dyn ] && cp ${EXE_DIR}/*output.nam* ${NEMO_VALIDATION_DIR}/.
351    [ -f ${EXE_DIR}/tracer.stat ] && cp ${EXE_DIR}/*tracer.stat ${NEMO_VALIDATION_DIR}/.
352
353    if [ -n "$(ls ${NEMO_VALIDATION_DIR}/*run*)" ] ; then
354   echo "moved run.stat in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
355   echo "moved run.stat in ${NEMO_VALIDATION_DIR} directory" 
356    else
357   echo "problem in looking for run.stat file in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
358   echo "run.stat IS NOT in ${NEMO_VALIDATION_DIR} directory" 
359    fi
360    if [ -n "$(ls ${NEMO_VALIDATION_DIR}/*ocean.output*)" ] ; then
361   echo "moved ocean.output in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
362   echo "moved ocean.output in ${NEMO_VALIDATION_DIR} directory" 
363    else
364   echo "problem in looking for ocean.output file in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
365   echo "ocean.output IS NOT in ${NEMO_VALIDATION_DIR} directory" 
366    fi
367    if [ -n "$(ls ${NEMO_VALIDATION_DIR}/*tracer.stat*)" ] ; then
368        echo "moved tracer.stat in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
369        echo "moved tracer.stat in ${NEMO_VALIDATION_DIR} directory"
370    else
371        echo "problem in looking for tracer.stat file in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
372        echo "tracer.stat IS NOT in ${NEMO_VALIDATION_DIR} directory"
373    fi
374}
375
376#############################################################
377# extra functions to manipulate settings in the iodef.xml file
378#
379# Examples:
380#   set_xio_file_type    iodef.xml one_file
381#   set_xio_using_server iodef.xml true
382#   set_xio_buffer_size  iodef.xml 50000000
383#   set_xio_field_defs   iodef.xml
384#
385#############################################################
386
387usage2=" Usage : set_xio_file_type input_iodef.xml one_file||multiple_file"
388usage3=" Usage : set_xio_using_server input_iodef.xml true||false"
389usage4=" Usage : set_xio_buffer_size input_iodef.xml int_buffer_size"
390usage5=" Usage : set_xio_field_defs input_iodef.xml"
391
392set_xio_file_type () {
393        minargcount=2
394        if [ ${#} -lt ${minargcount} ]
395        then
396                echo "not enough arguments for set_xio_file_type"
397                echo "${usage2}"
398                exit 1
399        fi
400        if [ $2 != "one_file" ] && [ $2 != "multiple_file" ]
401        then
402                echo "unrecognised argument for set_xio_file_type"
403                echo "${usage2}"
404                echo $2
405                exit 1
406        fi
407        unset minargcount
408        if [  ! -f ${SETTE_DIR}/output.sette ] ; then
409                touch ${SETTE_DIR}/output.sette
410        fi
411
412        echo "executing script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette
413        echo "################" >> ${SETTE_DIR}/output.sette
414
415        VAR_NAME=$( grep "^.*<.*file_definition.*type.*=" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" )
416        if [ ${#VAR_NAME} -eq 0 ]
417        then
418                echo "doing \"set_xio_file_type $@\". "
419                echo "xml_tag: file_definition with variable: type is empty"
420                echo "confirm that an appropriate file_definition is in \"${EXE_DIR}/$1\" "
421                echo "exit"
422                echo "error in executing script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette
423                echo "....." >> ${SETTE_DIR}/output.sette
424                exit 1
425        fi
426        if [ $2 == "one_file" ] 
427        then
428           sed -e "s:multiple_file:one_file:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
429        else
430           sed -e "s:one_file:multiple_file:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
431        fi
432        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
433
434        echo "finished script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette
435        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
436        echo "                " >> ${SETTE_DIR}/output.sette
437}
438
439set_xio_using_server () {
440        minargcount=2
441        if [ ${#} -lt ${minargcount} ]
442        then
443                echo "not enough arguments for set_xio_using_server"
444                echo "${usage2}"
445                exit 1
446        fi
447        if [ $2 != "true" ] && [ $2 != "false" ]
448        then
449                echo "unrecognised argument for set_xio_using_server"
450                echo "${usage2}"
451                echo $2
452                exit 1
453        fi
454        unset minargcount
455        if [  ! -f ${SETTE_DIR}/output.sette ] ; then
456                touch ${SETTE_DIR}/output.sette
457        fi
458
459        echo "executing script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette
460        echo "################" >> ${SETTE_DIR}/output.sette
461
462        VAR_NAME=$( grep "^.*<.*variable id.*=.*using_server.*=.*bool" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" )
463        if [ ${#VAR_NAME} -eq 0 ]
464        then
465                echo "doing \"set_xio_using_server $@\". "
466                echo "xml_tag: "variable id=using_server" with variable: bool is empty"
467                echo "confirm that an appropriate variable id is in \"${EXE_DIR}/$1\" "
468                echo "exit"
469                echo "error in executing script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette
470                echo "....." >> ${SETTE_DIR}/output.sette
471                exit 1
472        fi
473        if [ $2 == "false" ]
474        then
475           sed -e "/using_server/s:true:false:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
476           export USING_MPMD=no
477        else
478           sed -e "/using_server/s:false:true:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
479           export USING_MPMD=yes
480        fi
481        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
482
483        echo "finished script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette
484        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
485        echo "                " >> ${SETTE_DIR}/output.sette
486}
487
488set_xio_buffer_size () {
489        minargcount=2
490        if [ ${#} -lt ${minargcount} ]
491        then
492                echo "not enough arguments for set_xio_buffer_size"
493                echo "${usage4}"
494                exit 1
495        fi
496        unset minargcount
497        if [  ! -f ${SETTE_DIR}/output.sette ] ; then
498                touch ${SETTE_DIR}/output.sette
499        fi
500
501        echo "executing script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette
502        echo "################" >> ${SETTE_DIR}/output.sette
503
504        VAR_NAME=$( grep "^.*<.*variable id.*=.*buffer_size.*=.*integer" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" )
505        if [ ${#VAR_NAME} -eq 0 ]
506        then
507                echo "doing \"set_xio_buffer_size $@\". "
508                echo "xml_tag: "variable id=buffer_size" with variable: integer is empty"
509                echo "confirm that an appropriate variable id is in \"${EXE_DIR}/$1\" "
510                echo "exit"
511                echo "error in executing script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette
512                echo "....." >> ${SETTE_DIR}/output.sette
513                exit 1
514        fi
515        sed -e "/buffer_size/s:>.*<:>$2<:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
516        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
517
518        echo "finished script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette
519        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
520        echo "                " >> ${SETTE_DIR}/output.sette
521}
522
523set_xio_field_defs () {
524        minargcount=1
525        if [ ${#} -lt ${minargcount} ]
526        then
527                echo "not enough arguments for set_xio_field_defs"
528                echo "${usage5}"
529                exit 1
530        fi
531        unset minargcount
532        if [  ! -f ${SETTE_DIR}/output.sette ] ; then
533                touch ${SETTE_DIR}/output.sette
534        fi
535
536        echo "executing script : set_xio_field_defs $@" >> ${SETTE_DIR}/output.sette
537        echo "################" >> ${SETTE_DIR}/output.sette
538
539
540        [ -f ${EXE_DIR}/field_def_nemo-oce.xml ] || sed -i '/field_def_nemo-oce/d' $1
541        [ -f ${EXE_DIR}/field_def_nemo-ice.xml ] || sed -i '/field_def_nemo-ice/d' $1
542        [ -f ${EXE_DIR}/field_def_nemo-pisces.xml ] || sed -i '/field_def_nemo-pisces/d' $1
543
544        echo "finished script : set_xio_field_defs $@" >> ${SETTE_DIR}/output.sette
545        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
546        echo "                " >> ${SETTE_DIR}/output.sette
547}
Note: See TracBrowser for help on using the repository browser.