Debian Codegraph @

dist/check-api-change

raw
1 #!/bin/sh
2 #
3 # simplistic script to check all header files for
4 # differences. Intended to help detect api changes
5 # between releases.
6 #
7 # it's not pretty or efficient, and inspection of
8 # the results must be done manually.
9 #
10 # it's also not secure (don't run as root)
11 # or portable. Tested on Linux.
12 #
13
14 if [ "x$1" = "x" -o "x$2" = "x" ]; then
15 echo "Usage: $0 <old-dir> <new-dir>"
16 exit 1
17 fi
18
19 od=$1
20 nd=$2
21 DIR=/tmp
22 OUTPUT=$DIR/api-diff.pat
23 ODT=$DIR/api-od
24
25 if [ ! -d $od ]; then
26 echo "old dir $od doesn't exist"
27 exit 1
28 fi
29
30 if [ ! -d $nd ]; then
31 echo "old dir $nd doesn't exist"
32 exit 1
33 fi
34
35 # find header in nd
36 rm -f $OUTPUT $ODT 2>/dev/null
37 (cd $od && find . -type f -name "*.h"|sort > $ODT)
38
39 OH=`cat $ODT`
40 for h in $OH
41 do
42 nh=$nd/$h
43 oh=$od/$h
44 echo "* $nh"
45 if [ -f "$nh" ]; then
46 echo "* diff: $h vs $nh" >> $OUTPUT
47 diff -u $oh $nh >> $OUTPUT 2>&1
48 else
49 echo "* Old header $h not found in new headers" >> $OUTPUT
50 fi
51 done
52
53 echo "Inspect output in $OUTPUT"
54 echo "See Makefile.top for libtool version bumping rules."