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