636fb2c6f108ca225e07009257d245a1ce3875ce
[nethome.git] / bin / diffgdbdir
1 #! /bin/sh
2
3 x="*.log"
4 o=""
5 while true;do
6         if [ "$1" = "-r" ];then
7                 o="$o -r"
8                 shift
9                 continue
10         fi
11         if [ "$1" = "-N" ];then
12                 o="$o -N"
13                 shift
14                 continue
15         fi
16         if [ "$1" = "log" ];then
17                 x="*.sum"
18                 o="-r"
19                 shift
20                 continue
21         fi
22         break
23 done
24
25 if [ $# != 2 ];then
26         echo >&2 "$0 hammock/xxxxyyzzname hammock/XXXXYYZZothername"
27         exit 1
28 fi
29
30 diffed=false
31 function diffitraw
32 {
33         dir1=$1
34         dir2=$2
35         if [ ! -e "$dir2" ];then
36                 echo "MISSING: $dir1 $dir2"
37                 return
38         fi
39         diffgdb $o -x "$x" $dir1 $dir2
40         diffed=true
41 }
42 function diffit
43 {
44         diffitraw $1/out $2/out
45 }
46
47 if [ -f "$1" -a ! -e "${1%.tar.xz}" ];then
48         (
49                 cd "$(dirname "$1")"
50                 tar xJf "$(basename "$1")"
51         )
52         set "${1%.tar.xz}" "$2"
53         if [ ! -d "$1" ];then
54                 echo "! $1"
55                 exit 1
56         fi
57 fi
58 if [ -f "$2" -a ! -e "${2%.tar.xz}" ];then
59         (
60                 cd "$(dirname "$2")"
61                 tar xJf "$(basename "$2")"
62         )
63         set "$1" "${2%.tar.xz}"
64         if [ ! -d "$2" ];then
65                 echo "! $2"
66                 exit 1
67         fi
68 fi
69
70 for arch in x86_64 i386;do
71         if [ -d $1-$arch ];then
72                 diffit $1-$arch $2-$arch
73         fi
74         if [ -d $1$arch ];then
75                 diffit $1$arch $2$arch
76         fi
77         if [ -d $1/*-$arch ];then
78                 diffit $1/*-$arch $2/*-$arch
79         fi
80 done
81 if [ -d $1/out ];then
82         diffit $1 $2
83         diffed=true
84 fi
85 if [ "$1" != "${1#tests/}" -a -d $1 ];then
86         diffitraw $1 $2
87         diffed=true
88 fi
89 if ! $diffed;then
90         echo "NOT FOUND: $1 $2"
91 fi