Changeset 21


Ignore:
Timestamp:
03/29/07 16:48:14 (17 years ago)
Author:
bellier
Message:

JB: suppress the diff/rm/update options of model script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modipsl/trunk/util/model

    r13 r21  
    88MAIL_COM=mail 
    99#MAIL_COM=Mail 
    10 #--- 
    11 #- Dirname and Basename 
    12 #--- 
     10#- 
     11# Dirname and Basename 
     12#- 
    1313d_n=${0%/*}; b_n=${0##*/}; 
    14 #--- 
    15 #- Retrieve and validate the options 
    16 #--- 
    17 m_n=""; m_a=""; m_v='silencious'; no_tag='false'; 
    18 while getopts :heudrvH V 
     14#- 
     15# Retrieve and validate the options 
     16#- 
     17m_n=""; m_a="checkout"; m_v='silencious'; no_tag='false'; 
     18while getopts :hevH V 
    1919  do 
    2020    case $V in 
    2121      (h)  m_a='help';; 
    2222      (e)  m_a='checkout';; 
    23       (u)  m_a='update';; 
    24       (d)  m_a='diff';; 
    25       (r)  m_a='remove';; 
    2623      (v)  m_v='verbose';; 
    2724      (H)  no_tag='true';; 
     
    3330  done 
    3431shift $(($OPTIND-1)); 
    35 #--- 
    36 #- Validate the action 
    37 #--- 
    38 [[ -z "${m_a}" ]] && { m_a='checkout'; } 
    39 [[ ${m_a} = help || ${m_a} = checkout || ${m_a} = update || \ 
    40    ${m_a} = diff || ${m_a} = remove ]] || \ 
    41   { echo 'Action '"${m_a}"' not supported' 1>&2; exit 4; } 
    42 #--- 
    43 #- Retrieve the model name 
    44 #--- 
     32#- 
     33# Validate the action 
     34#- 
     35[[ ${m_a} = help || ${m_a} = checkout ]] || \ 
     36 { 
     37  echo 'Action '"${m_a}"' not supported' 1>&2; 
     38  echo 'Try "'${b_n}' -h [model-name]"' 1>&2; 
     39  exit 4; 
     40 } 
     41#- 
     42# Retrieve the model name 
     43#- 
    4544[[ ${#} -gt 1 ]] && \ 
    4645  { echo 'Only one model can be specified' 1>&2; exit 3; } 
     
    5251  exit 3; 
    5352 } 
    54 #--- 
    55 #- Test of presence of the definition file 
    56 #--- 
     53#- 
     54# Test availability of the definition file 
     55#- 
    5756F_DEF=${d_n}'/mod.def' 
    5857[[ ! -f "${F_DEF}" ]] && { echo "${F_DEF} unreachable ..."; exit 3; } 
    59 #--- 
    60 #- Extract the names of the supported models 
    61 #--- 
     58#- 
     59# Extract the names of the supported models 
     60#- 
    6261qi=0; 
    6362while read v0 v1 v2 
     
    6766  done <${F_DEF} 
    6867unset v0 v1 v2; 
    69 #--- 
    70 #- Model name validation and data retrieving 
    71 #--- 
     68#- 
     69# Model name validation and data retrieving 
     70#- 
    7271[[ -n "${m_n}" ]] && \ 
    7372  { 
     
    184183    # N/A 
    185184  } 
    186 #--- 
    187 #- send an email at the first use of modipsl 
    188 #- ie directory ~/.modipsl does not exist 
    189 #--- 
     185#- 
     186# send an email at the first use of modipsl 
     187# ie directory ~/.modipsl does not exist 
     188#- 
    190189D_LOG=${HOME}/.modipsl 
    191190[[ -d "${D_LOG}" ]] || \ 
    192   { 
    193     mkdir "${D_LOG}"; 
    194     echo $(date +"%D %T") $(whoami) $(uname -m) \ 
    195      first use of model | \ 
     191 { 
     192  mkdir "${D_LOG}"; 
     193  echo $(date +"%D %T") $(whoami) $(uname -m) \ 
     194    first use of model | \ 
    196195    ${MAIL_COM} -s "first use of modipsl" \ 
    197      ${MAIL_ADDRESS} >/dev/null 2>&1; 
    198     echo $(date +"%D %T") creation >"${D_LOG}"/first; 
     196    ${MAIL_ADDRESS} >/dev/null 2>&1; 
     197   echo $(date +"%D %T") creation >"${D_LOG}"/first; 
    199198  } 
    200 #--- 
    201 #- "help" action 
    202 #--- 
     199#- 
     200# "help" action 
     201#- 
    203202[[ ${m_a} = 'help' ]] && \ 
    204203 { 
     
    210209    echo ${b_n} '[-h]'; 
    211210    echo ${b_n} '[-h] model_name'; 
    212     echo ${b_n} '[-e/u/d/r] [-H] [-v] model_name'; 
     211    echo ${b_n} '[-e] [-H] [-v] model_name'; 
    213212    echo 'h            : this help'; 
    214213    echo 'h model-name : help on model'; 
    215     echo 'e/u/d/r      : extract/update/diff/remove model'; 
     214    echo 'e            : extract model'; 
    216215    echo 'H            : suppress the tags and take the HEAD version'; 
    217216    echo 'v            : verbose mode'; 
     
    247246  exit 0; 
    248247 } 
    249 #--- 
    250 #- Record information about the action in the "log" file 
    251 #--- 
     248#- 
     249# Record information about the action in the "log" file 
     250#- 
    252251F_LOG=${d_n}'/log' 
    253252echo "${F_LOG}" 
    254253echo $(date +"%D %T") $0 $* >>"${F_LOG}" 
    255 #--- 
    256 #- Verbose mode 
    257 #--- 
     254#- 
     255# Verbose mode 
     256#- 
    258257[ ${m_v} = 'verbose' ] && \ 
    259258 { echo '--- Model        : '${m_n}; 
    260259   echo '--- Action       : '${m_a}; 
    261260   echo '--- Mode         : '${m_v}; } 
    262 #--- 
    263 #- Record information about the action in the "log" file 
    264 #--- 
     261#- 
     262# Record information about the action in the "log" file 
     263#- 
    265264{ echo '--- Model        : '${m_n}; 
    266265  echo '--- Action       : '${m_a}; 
    267266  echo '--- Mode         : '${m_v}; 
    268267  echo '--- Mail address : '${m_m}; } >>"${F_LOG}" 
    269 #--- 
    270 #- Components root directory 
    271 #--- 
     268#- 
     269# Components root directory 
     270#- 
    272271d_m=${d_n}'/..'; 
    273 #--- 
    274 #- send an email at the first use of this IPSL model 
    275 #- ie file ~/.modipsl/log.${m_n} does not exist 
    276 #--- 
     272#- 
     273# send an email at the first use of this IPSL model 
     274# ie file ~/.modipsl/log.${m_n} does not exist 
     275#- 
    277276M_LOG=${D_LOG}/log.${m_n} 
    278277[[ -f "${M_LOG}" ]] || \ 
     
    284283   echo $(date +"%D %T") model ${m_n} >"${M_LOG}"; 
    285284  } 
    286 #--- 
    287 #- Extract the model components 
    288 #--- 
     285#- 
     286# Extract the model components 
     287#- 
    289288qi=0; while (( ${qi} < ${#m_c[@]} )) 
    290289  do 
     
    301300       echo '--- Directory  : '${zd}; 
    302301       echo '--- Local Dir  : '${zl}; } 
    303 #--- 
    304 #-   Record information about the action in the "log" file 
    305 #--- 
     302#----- 
     303#----  Record information about the action in the "log" file 
     304#----- 
    306305     { echo '---'; 
    307306       echo '--- Component  : '${zc}; 
     
    314313    [[ ${zp} = 'cvs' ]] && \ 
    315314     { 
    316       case ${m_a} in 
    317         ( checkout | update | diff ) 
    318           c_c='(cd '${d_m}/${zl}'; '${zp}' -d :pserver:'${zs}' '${m_a}; 
    319           [[ ${m_a} = 'checkout' && ${zt} != '?' ]] && \ 
    320            { c_c=${c_c}' -r '${zt}; } 
    321           [[ ${m_a} = 'checkout' && ${zd} != '.' ]] && \ 
    322            { c_c=${c_c}' -d '${zd}; } 
    323           c_c=${c_c}' '${zc}')';; 
    324         ( remove ) 
    325           c_c='(cd '${d_m}/${zl}'; rm -rf '${zc}')';; 
    326       esac 
     315      c_c='(cd '${d_m}/${zl}'; '${zp}' -d :pserver:'${zs}' '${m_a}; 
     316      [[ ${zt} != '?' ]] && { c_c=${c_c}' -r '${zt}; } 
     317      [[ ${zd} != '.' ]] && { c_c=${c_c}' -d '${zd}; } 
     318      c_c=${c_c}' '${zc}')'; 
    327319      grep "${zs%%/*}"'.*/'"${zs#*/}" ~/.cvspass > /dev/null; 
    328320      [[ ${?} != 0 ]] && \ 
     
    336328    [[ ${zp} = 'svn' ]] && \ 
    337329     { 
    338       case ${m_a} in 
    339         ( checkout | update | diff ) 
    340           c_c='(cd '${d_m}/${zl}'; '${zp}' '${m_a}; 
    341           [[ ${m_a} = 'checkout' && ${zt} != '?' ]] && \ 
    342            { c_c=${c_c}' -r '${zt}; } 
    343           c_c=${c_c}' '${zs}'/'${zc}; 
    344           [[ ${m_a} = 'checkout' && ${zd} != '.' ]] && \ 
    345            { c_c=${c_c}' '${zd}; } 
    346           c_c=${c_c}')';; 
    347         ( remove ) 
    348           c_c='(cd '${d_m}/${zl}'; rm -rf '${zc##*/}')';; 
    349       esac 
     330      c_c='(cd '${d_m}/${zl}'; '${zp}' '${m_a}; 
     331      [[ ${zt} != '?' ]] && { c_c=${c_c}' -r '${zt}; } 
     332      c_c=${c_c}' '${zs}'/'${zc}; 
     333      [[ ${zd} != '.' ]] && { c_c=${c_c}' '${zd}; } 
     334      c_c=${c_c}')'; 
    350335     } 
    351336#--- 
     
    353338    eval ${c_c}; 
    354339  done 
    355 #--- 
    356 #- Actions related to the WORK directory for the OPA models 
    357 #--- 
     340#- 
     341# Actions related to the WORK directory for the OPA models 
     342#- 
    358343case ${m_n} in 
    359344  ( EEL* |  ORCA* | OFF_TRC | IPSLCM* | ORCA_TOYATM | \ 
    360345    NEMO_ORCA2_LIM | GYRE ) 
    361346    d_m1=${d_m}/modeles/OPA  ; 
    362     [ ${m_a} = 'checkout' -o ${m_a} = 'remove' ] && 
    363       { [ -d ${d_m1}/WORK ] && \rm -rf ${d_m1}/WORK; }; 
    364     [ ${m_a} = 'checkout' -o ${m_a} = 'update' ] && 
    365    { 
    366      [ -d ${d_m1}/WORK ] || mkdir ${d_m1}/WORK; 
    367      cd ${d_m1}/WORK; 
    368 # Getting the configuration files to build the Makefile 
    369      ln -sf ../../../*/${m_n}/scripts/BB_make AA_make; 
    370      ln -sf ../../../*/${m_n}/scripts/BB_make.ldef AA_make.ldef ; 
    371      case ${m_n} in 
    372        ( ORCA2_LMDZ96x71 ) 
    373          echo " Creation du catalogue OPA/WORK = ORCA + LIM" 
    374          ln -sf ../SRC_ORCA/*.[Ffh] . 
    375          ln -sf ../SRC_UCL/[a-z]* . 
    376          ln -sf ../../${m_n}/scripts/prep.sed.coupled .;; 
    377        ( ORCA2 | ORCA4 | ORCA05 | EEL2 | EEL6 ) 
    378          echo " Creation du catalogue OPA/WORK = ORCA" 
    379          ln -sf ../SRC_ORCA/*.[Ffh] .;; 
    380        ( ORCA*LIM | IPSLCM* | ORCA_TOYATM | ORCA*LMD* ) 
    381          [ "${m_n}" = "IPSLCM4_LOOP" ] && \ 
    382           echo " Creation du catalogue OPA/WORK = ORCA + LIM + TRC" || \ 
    383           echo " Creation du catalogue OPA/WORK = ORCA + LIM" 
    384          ln -sf ../SRC_ORCA/*.[Ffh] . 
    385          [ "${m_n}" = "IPSLCM4_LOOP" ] && \rm *.passivetrc.h 
    386          [ "${m_n}" = "IPSLCM4_LOOP" ] && \ 
    387            ln -sf ../SRC_TRC/*.[Ffh] ../SRC_TRC/trc_sms/*.[Ffh] . 
    388          ln -sf ../SRC_UCL/[a-z]* .;; 
    389        ( ORCA*_LIM_TRC ) 
    390          echo " Creation du catalogue OPA/WORK = ORCA + LIM + TRC" 
    391          ln -sf ../SRC_ORCA/*.[Ffh] . 
    392          \rm *.passivetrc.h 
    393          ln -sf ../SRC_TRC/*.[Ffh] ../SRC_TRC/trc_sms/*.[Ffh] . 
    394          ln -sf ../SRC_UCL/[a-z]* .;; 
    395        ( *LOBSTER1 ) 
    396          echo " Creation du catalogue OPA/WORK = ORCA + TRC" 
    397          ln -sf ../SRC_ORCA/*.[Ffh] . 
    398          \rm *.passivetrc.h 
    399          ln -sf ../SRC_TRC/*.[Ffh] ../SRC_TRC/trc_sms/*.[Ffh] .;; 
    400        ( ORCA*_OFF_TRC ) 
    401          echo " Creation du catalogue OPA/WORK = TRC + OFFLINE" 
    402          ln -sf ../SRC_TRC/*.[Ffh] ../SRC_TRC/trc_sms/*.[Ffh] . 
    403          ln -sf ../SRC_OFFLINE_TRC/*.[Ffh] .;; 
    404      esac 
    405 # Building the standard list of source files 
    406      cat >.patron <<"EOF" 
     347    [ -d ${d_m1}/WORK ] && \rm -rf ${d_m1}/WORK; 
     348    mkdir ${d_m1}/WORK; 
     349    cd ${d_m1}/WORK; 
     350#-- Getting the configuration files to build the Makefile 
     351    ln -sf ../../../*/${m_n}/scripts/BB_make AA_make; 
     352    ln -sf ../../../*/${m_n}/scripts/BB_make.ldef AA_make.ldef ; 
     353    case ${m_n} in 
     354     ( ORCA2_LMDZ96x71 ) 
     355      echo " Creation du catalogue OPA/WORK = ORCA + LIM" 
     356      ln -sf ../SRC_ORCA/*.[Ffh] . 
     357      ln -sf ../SRC_UCL/[a-z]* . 
     358      ln -sf ../../${m_n}/scripts/prep.sed.coupled .;; 
     359     ( ORCA2 | ORCA4 | ORCA05 | EEL2 | EEL6 ) 
     360      echo " Creation du catalogue OPA/WORK = ORCA" 
     361      ln -sf ../SRC_ORCA/*.[Ffh] .;; 
     362     ( ORCA*LIM | IPSLCM* | ORCA_TOYATM | ORCA*LMD* ) 
     363      [ "${m_n}" = "IPSLCM4_LOOP" ] && \ 
     364       echo " Creation du catalogue OPA/WORK = ORCA + LIM + TRC" || \ 
     365       echo " Creation du catalogue OPA/WORK = ORCA + LIM" 
     366      ln -sf ../SRC_ORCA/*.[Ffh] . 
     367      [ "${m_n}" = "IPSLCM4_LOOP" ] && \rm *.passivetrc.h 
     368      [ "${m_n}" = "IPSLCM4_LOOP" ] && \ 
     369       ln -sf ../SRC_TRC/*.[Ffh] ../SRC_TRC/trc_sms/*.[Ffh] . 
     370      ln -sf ../SRC_UCL/[a-z]* .;; 
     371     ( ORCA*_LIM_TRC ) 
     372      echo " Creation du catalogue OPA/WORK = ORCA + LIM + TRC" 
     373      ln -sf ../SRC_ORCA/*.[Ffh] . 
     374      \rm *.passivetrc.h 
     375      ln -sf ../SRC_TRC/*.[Ffh] ../SRC_TRC/trc_sms/*.[Ffh] . 
     376      ln -sf ../SRC_UCL/[a-z]* .;; 
     377     ( *LOBSTER1 ) 
     378      echo " Creation du catalogue OPA/WORK = ORCA + TRC" 
     379      ln -sf ../SRC_ORCA/*.[Ffh] . 
     380      \rm *.passivetrc.h 
     381      ln -sf ../SRC_TRC/*.[Ffh] ../SRC_TRC/trc_sms/*.[Ffh] .;; 
     382     ( ORCA*_OFF_TRC ) 
     383      echo " Creation du catalogue OPA/WORK = TRC + OFFLINE" 
     384      ln -sf ../SRC_TRC/*.[Ffh] ../SRC_TRC/trc_sms/*.[Ffh] . 
     385      ln -sf ../SRC_OFFLINE_TRC/*.[Ffh] .;; 
     386    esac 
     387#-- Building the standard list of source files 
     388    cat >.patron <<"EOF" 
    407389CVS 
    408390SRC_PARAM 
     
    423405thersf.f 
    424406EOF 
    425      ls -1 | fgrep -v -f .patron  >SRC_FILE_LIST; 
    426      cp SRC_FILE_LIST SRC_FILE_LIST.temp; 
    427 # 
    428      KEY=$(grep P_P AA_make.ldef); 
    429      [ -f "KEY_CPP" ] || echo $KEY > KEY_CPP; 
    430     };; 
     407    ls -1 | fgrep -v -f .patron  >SRC_FILE_LIST; 
     408    cp SRC_FILE_LIST SRC_FILE_LIST.temp; 
     409    KEY=$(grep P_P AA_make.ldef); 
     410    [ -f "KEY_CPP" ] || echo $KEY > KEY_CPP; 
     411  ;; 
    431412esac 
    432413#--- 
Note: See TracChangeset for help on using the changeset viewer.