summaryrefslogtreecommitdiff
path: root/review
blob: 6d7282729643ff33fcb32f9344dd01b751f0bc38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/env bash

# Grep for @@ items in build2 toolchain.
#
# Usage: review
#
usage="usage: $0"

modules="libbutl libbutl.bash build2 libbpkg bpkg bpkg-util bdep bdep-util brep libbbot bbot build2-toolchain libbuild2-kconfig libbuild2-autoconf"

owd=`pwd`
trap "{ cd $owd; exit 1; }" ERR
set -o errtrace # Trap in functions.

function info () { echo "$*" 1>&2; }
function error () { info "$*"; exit 1; }

for m in $modules; do
  # Top-level directories inside the module to exclude.
  #
  exclude=.git

  # Exclude submodules in build2-toolchain.
  #
  if [ $m = "build2-toolchain" ]; then
    exclude="$exclude submodules bdep bpkg build2 libbutl libbpkg libodb libodb-sqlite libsqlite3 libpkg-config libbuild2-kconfig libbuild2-autoconf"
  fi

  fo=
  if [ "$exclude" ]; then
    fo="-type d ("
    for e in $exclude; do
      fo="$fo -path $m/$e -o"
    done
    fo="$fo -false ) -prune -o"
  fi
  fo="$fo -type f -print"

  for f in `find $m $fo`; do
    grep --binary-files=without-match --color=always --with-filename \
'@@' $f || true
  done
done