Ugly hacked in -N.
[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 diffit
32 {
33         dir1=$1/out
34         dir2=$2/out
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
43 if [ -f "$1" -a ! -e "${1%.tar.xz}" ];then
44         (
45                 cd "$(dirname "$1")"
46                 tar xJf "$(basename "$1")"
47         )
48         set "${1%.tar.xz}" "$2"
49         if [ ! -d "$1" ];then
50                 echo "! $1"
51                 exit 1
52         fi
53 fi
54 if [ -f "$2" -a ! -e "${2%.tar.xz}" ];then
55         (
56                 cd "$(dirname "$2")"
57                 tar xJf "$(basename "$2")"
58         )
59         set "$1" "${2%.tar.xz}"
60         if [ ! -d "$2" ];then
61                 echo "! $2"
62                 exit 1
63         fi
64 fi
65
66 for arch in x86_64 i386;do
67         if [ -d $1-$arch ];then
68                 diffit $1-$arch $2-$arch
69         fi
70         if [ -d $1$arch ];then
71                 diffit $1$arch $2$arch
72         fi
73         if [ -d $1/*-$arch ];then
74                 diffit $1/*-$arch $2/*-$arch
75         fi
76 done
77 if [ -d $1/out ];then
78         diffit $1 $2
79         diffed=true
80 fi
81 if ! $diffed;then
82         echo "NOT FOUND: $1 $2"
83 fi