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/branches/UKMO/NEMO_4.0.2_mirror/doc/tools – NEMO

source: NEMO/branches/UKMO/NEMO_4.0.2_mirror/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
Line 
1#!/bin/sh
2
3#set -evx
4
5if [[ $* != '' ]]; then
6    if [[ $1 = 'all' ]]; then models='NEMO SI3 TOP'; else models=$1; fi
7else
8    models='NEMO'
9fi
10
11for model in $models; do
12    [[ $model =~ ^(SI3|TOP)$ ]] && continue
13
14    files=$( find latex/$model -type f -name *.tex )
15
16    echo '¤ Missing namelist groups in '$model' manual'
17
18    for nlst in $( ls namelists ); do
19        [[ ! $( grep \\nlst{$nlst} $files ) ]] && printf '%s ' $nlst
20    done
21
22    echo; echo
23    echo '¤ Vanished index entries in '$model' manual (\{hf,jp,key,mdl,ngn,nlst,np,rou}{...})'
24
25    for file in $files; do
26
27        items=$( grep -Eho "(hf|jp|key|mdl|ngn|nlst|np|rou){[a-zA-Z0-9_\]*}" $file | sort -u )
28
29        if [[ $items == '' ]]; then
30            continue
31        else
32            printf ${file/latex\/*\/subfiles\/}': '
33        fi
34
35        for item in $items; do
36
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
47                printf $item' '
48            fi
49
50        done
51
52        echo
53
54    done
55
56done
57
58echo
59echo '¤ Namelist parameters unfollowing naming conventions (^[cdlnr]n_* or uppercase somewhere)'
60
61for nlst in $( ls namelists ); do
62    np_list=$( sed '/^ *[!/&]/d; s|[!/&].*||' namelists/$nlst | tr -d ' ' | cut -d= -f1 )
63    array=()
64
65    for np in ${np_list}; do
66
67        if [[ ! ${np:0:3} =~ ^[cdlnr]n_$ || $( echo $np | grep [A-Z] ) ]]; then
68            array+=$np' '
69        fi
70
71    done
72
73    if (( ${#array[@]} != 0 )); then
74        printf '%15s: ' $nlst
75        echo ${array[@]}
76    fi
77
78done
79
80exit 0
Note: See TracBrowser for help on using the repository browser.