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.
manuals_checking.sh in NEMO/trunk/doc/tools – NEMO

source: NEMO/trunk/doc/tools/manuals_checking.sh @ 12658

Last change on this file since 12658 was 11004, checked in by nicolasmartin, 5 years ago

Review of main building script

  • Exportig Python package checking to external script check_pkg.py for sharing it with the verification of deps for the user guide (sphinx, extension and theme)
  • Renaming to explicit manual_build.sh
  • Addition of basic checking for LaTeX installation (latexmk binary)
  • Implementation of loop and argument reading in order to use the same script for the 3 manuals
  • Improvment of code commentary
  • Property svn:executable set to *
File size: 2.3 KB
RevLine 
[10075]1#!/bin/sh
2
[10443]3#set -evx
4
[10146]5if [[ $* != '' ]]; then
[10443]6    if [[ $1 = 'all' ]]; then models='NEMO SI3 TOP'; else models=$1; fi
[10146]7else
[10443]8    models='NEMO'
[10146]9fi
10
11for model in $models; do
[10443]12    [[ $model =~ ^(SI3|TOP)$ ]] && continue
[10146]13
[10568]14    files=$( find latex/$model -type f -name *.tex )
[10146]15
[10443]16    echo '¤ Missing namelist groups in '$model' manual'
17
18    for nlst in $( ls namelists ); do
[10568]19        [[ ! $( grep \\nlst{$nlst} $files ) ]] && printf '%s ' $nlst
[10443]20    done
21
22    echo; echo
[10568]23    echo '¤ Vanished index entries in '$model' manual (\{hf,jp,key,mdl,ngn,nlst,np,rou}{...})'
[10443]24
[10568]25    for file in $files; do
[10443]26
[10550]27        items=$( grep -Eho "(hf|jp|key|mdl|ngn|nlst|np|rou){[a-zA-Z0-9_\]*}" $file | sort -u )
[10443]28
[10568]29        if [[ $items == '' ]]; then
30            continue
31        else
32            printf ${file/latex\/*\/subfiles\/}': '
33        fi
[10550]34
35        for item in $items; do
36
[10568]37            arg=$( echo $item | sed 's/.*{\([^}]*\)}/\1/' | tr -d '\\' )
38
39            if [[ ( $item =~ ^hf   && ! $( find ../src -type f -name   $arg.h90               ) ) || \
40                  ( $item =~ ^jp   && ! $( grep ":: *$arg"             ../src/OCE/par_oce.F90 ) ) || \
41                  ( $item =~ ^key  && ! $( grep -ri "#if .* $arg"      ../src                 ) ) || \
42                  ( $item =~ ^mdl  && ! $( find ../src -type f -name   $arg.[Ff]90            ) ) || \
43                  ( $item =~ ^ngn  && ! $( grep \&$arg                 namelists/*            ) ) || \
44                  ( $item =~ ^nlst && ! -f namelists/$arg                                       ) || \
45                  ( $item =~ ^np   && ! $( grep " $arg *="             namelists/*            ) ) || \
46                  ( $item =~ ^rou  && ! $( grep -ri "SUBROUTINE *$arg" ../src                 ) )      ]]; then
[10550]47                printf $item' '
[10443]48            fi
[10550]49
[10443]50        done
51
[10550]52        echo
[10443]53
[10550]54    done
55
[10443]56done
57
58echo
[10448]59echo '¤ Namelist parameters unfollowing naming conventions (^[cdlnr]n_* or uppercase somewhere)'
[10443]60
61for nlst in $( ls namelists ); do
[10448]62    np_list=$( sed '/^ *[!/&]/d; s|[!/&].*||' namelists/$nlst | tr -d ' ' | cut -d= -f1 )
[10443]63    array=()
64
65    for np in ${np_list}; do
66
[10448]67        if [[ ! ${np:0:3} =~ ^[cdlnr]n_$ || $( echo $np | grep [A-Z] ) ]]; then
[10443]68            array+=$np' '
[10146]69        fi
70
71    done
72
[10443]73    if (( ${#array[@]} != 0 )); then
74        printf '%15s: ' $nlst
75        echo ${array[@]}
76    fi
[10146]77
[10075]78done
79
80exit 0
Note: See TracBrowser for help on using the repository browser.