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