[10713] | 1 | #!/bin/bash -f |
---|
| 2 | # set -vx |
---|
[12430] | 3 | |
---|
| 4 | SETTE_DIR=$(cd $(dirname "$0"); pwd) |
---|
| 5 | MAIN_DIR=$(dirname $SETTE_DIR) |
---|
| 6 | |
---|
| 7 | . ./param.cfg |
---|
| 8 | |
---|
| 9 | if [ $# -gt 0 ]; then |
---|
| 10 | while getopts c:h option; do |
---|
| 11 | case $option in |
---|
| 12 | c) COMPILER=$OPTARG;; |
---|
| 13 | h | *) echo '' |
---|
| 14 | echo 'sette_list_avail_rev.sh : ' |
---|
| 15 | echo ' list all sette directory and available revisions created with the compiler specified in param.cfg or in the startup file)' |
---|
| 16 | echo '-c COMPILER_name :' |
---|
| 17 | echo ' list all sette directory and available revisions created with the compiler specified' |
---|
| 18 | echo '' |
---|
| 19 | exit 42;; |
---|
| 20 | esac |
---|
| 21 | done |
---|
| 22 | shift $((OPTIND - 1)) |
---|
| 23 | fi |
---|
| 24 | |
---|
[10713] | 25 | # |
---|
| 26 | lst_rev () { |
---|
[11153] | 27 | # get the list of revision available for a configuration |
---|
| 28 | if [ ! -d $1 ] ; then |
---|
| 29 | CFGLST=-9999 |
---|
| 30 | else |
---|
| 31 | CFGLST=`ls $1 | sort -u -r ` |
---|
| 32 | fi |
---|
| 33 | # config name |
---|
[10713] | 34 | CONFIG=$2 |
---|
[11153] | 35 | # list of all revision available |
---|
[10713] | 36 | ALLLST=${@:3} |
---|
[11153] | 37 | # number of revision total and for CONFIG |
---|
[10713] | 38 | nrevall=`echo $ALLLST | wc -w` |
---|
| 39 | nrevcfg=`echo $CFGLST | wc -w` |
---|
[11153] | 40 | # display |
---|
[10713] | 41 | echo "" |
---|
| 42 | printf "%-27s : " $CONFIG |
---|
| 43 | irev=1 |
---|
| 44 | irevcfg=1 |
---|
| 45 | while [[ $irev -le $nrevall ]] ; do |
---|
| 46 | rev=`echo $ALLLST | cut -d\ -f ${irev}` |
---|
[11153] | 47 | cfgrev=`echo $CFGLST | cut -d\ -f ${irevcfg}` |
---|
[12237] | 48 | if [ -z $cfgrev ] ; then cfgrev=-9999 ; fi |
---|
[11153] | 49 | if [ $cfgrev == $rev ] ; then |
---|
| 50 | printf "%-6s " $rev |
---|
| 51 | irevcfg=$((irevcfg+1)) |
---|
| 52 | else |
---|
| 53 | printf "%-5s " "***** " |
---|
| 54 | fi |
---|
[10713] | 55 | irev=$((irev+1)) |
---|
| 56 | done |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | |
---|
[12237] | 60 | NEMO_VALID=${NEMO_VALIDATION_DIR}/ |
---|
[10713] | 61 | |
---|
| 62 | # list of all revision available |
---|
[12237] | 63 | DIRLST=`find ${NEMO_VALID} -maxdepth 3 -mindepth 3 -type d -regex ".*\/W.*\/${COMPILER}\/.*" | sed -e "s/.*\/W.*\/${COMPILER}\///" | sort -u -r` |
---|
[10713] | 64 | |
---|
[11153] | 65 | # display header |
---|
[10713] | 66 | echo "" |
---|
[10769] | 67 | echo " Compiler used is : $COMPILER" |
---|
| 68 | echo "" |
---|
[10713] | 69 | printf " List of all avail. rev. is : " |
---|
| 70 | for dir in `echo $DIRLST`; do printf "%5s " $dir ; done |
---|
| 71 | printf "\n" |
---|
[11153] | 72 | |
---|
| 73 | # start checking configuration revision |
---|
[10713] | 74 | echo "" |
---|
| 75 | echo " !---- check revision available for each configuration ----! " |
---|
| 76 | for CONFIG in WGYRE_PISCES_ST WORCA2_ICE_PISCES_ST WORCA2_OFF_PISCES_ST WAMM12_ST WORCA2_SAS_ICE_ST WAGRIF_DEMO_ST WSPITZ12_ST WISOMIP_ST WOVERFLOW_ST WLOCK_EXCHANGE_ST WVORTEX_ST WICE_AGRIF_ST |
---|
| 77 | do |
---|
| 78 | DIR=${NEMO_VALIDATION_DIR}/${CONFIG}/${COMPILER} |
---|
| 79 | lst_rev $DIR $CONFIG $DIRLST |
---|
| 80 | done |
---|
| 81 | printf "\n" |
---|
| 82 | printf "\n" |
---|
| 83 | # |
---|
| 84 | exit |
---|