1+ #! /bin/bash
2+
3+ # Since it's a pain to manually update the acceptable diffs, this script will pick
4+ # new and modified diffs from the buildbot results, massage them slightly, display
5+ # the difference between the old and new (or the new if no old one) and ask
6+ # whether the diff should be updated.
7+ #
8+ # This script assumes that buildbot log files are available in $bblogdir; this
9+ # will be true only on the buildbot master.
10+
11+ program=${0##*/ }
12+ progdir=${0%/* }
13+
14+ bblogdir=/var/lib/buildbot/master/ietfdb/builder1
15+ diffdir=$progdir /diff
16+
17+ function die() { echo " $program : $* " ; echo " Terminating" ; exit 1; }
18+
19+ latest=$( ls $bblogdir | egrep " ^[0-9]+$" | sort -nr | head -n 1)
20+
21+ modprefix=" $bblogdir /$latest -log-django-test-mod_"
22+
23+ if ls $modprefix * > /dev/null; then
24+ for mod in $modprefix * ; do
25+ diff=" $diffdir /${mod# $modprefix } "
26+ [ -f $diff ] || echo " Missing diff-file: $diff "
27+ temp=" /tmp/${mod##*/ } "
28+ tail -n +3 $mod | head -n -1 | tr -d " \r" > $temp
29+ echo " ========================================================================"
30+ echo " ${diff##*/ } "
31+ echo " ------------------------------------------------------------------------"
32+ if diff $diff $temp | grep -v " \ No newline at end of file" ; then
33+ echo " "
34+ read -p " Update diff [y/N]?" update
35+ if [ " $update " = " Y" -o " $update " = " y" -o " $update " = " yes" ]; then cp $temp $diff ; fi
36+ fi
37+ rm $temp
38+ done
39+ fi
40+
41+ modprefix=" $bblogdir /$latest -log-django-test-diff_"
42+
43+ if ls $modprefix * > /dev/null; then
44+ for mod in $modprefix * ; do
45+ diff=" $diffdir /${mod# $modprefix } "
46+ [ -f $diff ] && die " Diff-file $diff exists when it shouldn't..."
47+ temp=" /tmp/${mod##*/ } "
48+ tail -n +3 $mod | head -n -1 | tr -d " \r" > $temp
49+ echo " ========================================================================"
50+ echo " ${diff##*/ } "
51+ echo " ------------------------------------------------------------------------"
52+ cat $temp
53+ echo " "
54+ read -p " Create diff [y/N]?" update
55+ if [ " $update " = " Y" -o " $update " = " y" -o " $update " = " yes" ]; then cp $temp $diff ; fi
56+ rm $temp
57+ done
58+ fi
0 commit comments