aboutsummaryrefslogtreecommitdiffstats
path: root/Tools/portbuild/scripts/bothlogs
blob: da767fe154b14e309886e22be017102b04ba98f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh

# prints out logs that are in dir1 but not in dir2

if [ $# -ne 3 ]; then
  echo "usage: $0 arch dir1 dir2"
  exit 1
fi

here=$(pwd)
arch=$1
dir1=$2
dir2=$3
fdir1=$here/${arch}-$dir1
fdir2=$here/${arch}-$dir2
ldir2=$(cd $fdir2; pwd | sed -e 's/e\./a./')

plus="$(echo $2 $3 | sed -e 's/ /+/g')"

of=$here/$arch-$plus.html

echo "<html><head><title>Logs that are in both $dir1 and $dir2</title>" >$of
echo "<h1>Logs that are in both $dir1 and $dir2</h1>" >>$of
echo "</head><body>" >>$of

cd $fdir1
logs=$(find . -name \*.log -o -name \*.log.bz2 | sed -e 's/\.log\.bz2/\.log/g')
nlogs=$(echo $logs | wc -w)

if [ $nlogs -eq 0 ]; then
  echo "No errors" >>$of;
else
  num=0
  echo "<table border=1>" >>$of
  echo "<tr><th>Log</th></tr>" >>$of
  for i in $logs; do
    if [ -f ${fdir2}/${i}.bz2 -o -f ${fdir2}/${i} ]; then
      fname1=$(basename $i .bz2)
      fname=$(basename $fname1 .log)
      echo -n "<tr>" >> $of
      echo -n "<td><a href=\"$arch-$dir1/$fname.log\">$fname</a></td>" >>$of
      echo -n "<td><a href=\"$arch-$dir2/$fname.log\">$fname</a></td>" >>$of
      echo "</tr>" >>$of
      num=$(($num + 1))
    fi
  done
  echo "</table><br>" >> $of
  echo "$num errors<br>" >> $of
fi

echo "<hr>" >> $of
echo "<a href=\"../\">back to top</a>" >> $of

echo "</body></html>" >>$of