| 1 | #!/bin/bash |
| 2 | |
| 3 | # this script checks for bad settings when exporting a package. |
| 4 | # It shall be run executed the top-level directory. |
| 5 | |
| 6 | ################################################################################ |
| 7 | logging_facilities_check() |
| 8 | { |
| 9 | echo -n "checking that all logging facilities are turned off ... " |
| 10 | |
| 11 | local cnt1=$(grep -c "log_def(" src/Logging.def) |
| 12 | local cnt2=$(grep -c "log_def(0" src/Logging.def) |
| 13 | |
| 14 | if [ $cnt1 != $cnt2 ] |
| 15 | then |
| 16 | echo " |
| 17 | *** |
| 18 | *** Cannot build packages because one or more logging facility |
| 19 | *** is ON in file src/Logging.def |
| 20 | *** |
| 21 | " |
| 22 | exit 1 |
| 23 | fi |
| 24 | echo "OK." |
| 25 | } |
| 26 | |
| 27 | ################################################################################ |
| 28 | Q_check() |
| 29 | { |
| 30 | echo -n "checking that all Q() macros were removed ... " |
| 31 | |
| 32 | local files_cc=$(find src -name '*.cc' -exec echo -n " {}" \;) |
| 33 | local files_hh=$(find src -name '*.hh' -exec echo -n " {}" \;) |
| 34 | local files_icc=$(find src -name '*.icc' -exec echo -n " {}" \;) |
| 35 | local files="$files_cc $files_hh $files_icc" |
| 36 | local q=$(grep 'Q(' $files | grep -v '#define Q(x)') |
| 37 | |
| 38 | if [ -n "$q" ] |
| 39 | then |
| 40 | echo " |
| 41 | *** |
| 42 | *** Cannot build packages because some Q() macros were not removed: |
| 43 | *** |
| 44 | $q |
| 45 | " |
| 46 | exit 1 |
| 47 | fi |
| 48 | echo "OK." |
| 49 | } |
| 50 | |
| 51 | ################################################################################ |
| 52 | # main()... |
| 53 | |
| 54 | if [ -d tools -a -d src ] |
| 55 | then true |
| 56 | else |
| 57 | echo " |
| 58 | *** |
| 59 | *** error: run this script from the GNU APL toplevel directory ! |
| 60 | *** |
| 61 | " |
| 62 | exit 1 |
| 63 | fi |
| 64 | |
| 65 | logging_facilities_check |
| 66 | Q_check |
| 67 | |
| 68 | exit 0 |
| 69 |