build:wafsamba: Update dist/distcheck commands
[samba.git] / buildtools / compare_generated.sh
1 #!/bin/sh
2
3 # compare the generated files from a waf
4
5 old_build=$HOME/samba_old
6
7 gen_files=$(cd bin/default && find . -type f -name '*.[ch]')
8
9 2>&1
10
11 strip_file()
12 {
13     in_file=$1
14     out_file=$2
15     cat $in_file |
16                    grep -v 'The following definitions come from' |
17                    grep -v 'Automatically generated at' |
18                    grep -v 'Generated from' |
19                    sed 's|/home/tnagy/samba/source4||g' |
20                    sed 's|/home/tnagy/samba/|../|g' |
21                    sed 's|bin/default/source4/||g' |
22                    sed 's|bin/default/|../|g' |
23                    sed 's/define _____/define ___/g' |
24                    sed 's/define __*/define _/g' |
25                    sed 's/define _DEFAULT_/define _/g' |
26                    sed 's/define _SOURCE4_/define ___/g' |
27                    sed 's/define ___/define _/g' |
28                    sed 's/ifndef ___/ifndef _/g' |
29                    sed 's|endif /* ____|endif /* __|g' |
30                    sed s/__DEFAULT_SOURCE4/__/ |
31                    sed s/__DEFAULT_SOURCE4/__/ |
32                    sed s/__DEFAULT/____/           > $out_file
33 }
34
35 compare_file()
36 {
37     f=$f
38     bname=$(basename $f)
39     t1=/tmp/$bname.old.$$
40     t2=/tmp/$bname.new.$$
41     strip_file $old_build/$f $t1
42     strip_file bin/default/$f     $t2
43     diff -u -b $t1 $t2 2>&1
44     rm -f $t1 $t2
45 }
46
47 for f in $gen_files; do
48     compare_file $f
49 done
50