-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtarball_bzr_diff.sh
executable file
·66 lines (54 loc) · 2.13 KB
/
tarball_bzr_diff.sh
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
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
retval=0
STATEPATH=${HOME}/versions
BNT=in_bzr_but_not_in_tarball.txt
TNB=in_tarball_but_not_in_bzr.txt
BNTSAVED=$STATEPATH/$BNT.saved
TNBSAVED=$STATEPATH/$TNB.saved
if [ ! -d "$STATEPATH" ]
then
bzr co bzr://jenkins.openstack.org/ "$STATEPATH"
else
(cd $STATEPATH ; bzr up)
fi
bzr ls -R . --versioned | sort > bzr.lst
tar tzf nova-*.tar.gz | cut -f2- -d/ | grep -v ^$ | sort -g > tarball.lst
rm -rf dist dist.zip
diff -u bzr.lst tarball.lst | grep -v ^--- | grep -v ^+++ > diff
grep ^- diff | sed -e s/^.// > $BNT
grep ^+ diff | sed -e s/^.// > $TNB
if [ "$1" = "ack" ]
then
cp $BNT $BNTSAVED
cp $TNB $TNBSAVED
( cd $STATEPATH ; bzr commit "Ran ack" )
exit 0
fi
> report.txt
if ! diff -Nq $BNTSAVED $BNT > /dev/null
then
retval=1
echo "The list of files in bzr, but not in the tarball changed." >> report.txt
echo "Lines beginning with - denote files that were either removed from bzr or recently included in the tarball." >> report.txt
echo "Lines beginning with + denote files that were either got added to bzr recently or got removed from the tarball." >> report.txt
diff -uN $BNTSAVED $BNT >> report.txt
fi
if ! diff -qN $TNBSAVED $TNB > /dev/null
then
retval=1
echo "The list of files in the tarball, but not in bzr changed." >> report.txt
echo "Lines beginning with - denote files that were removed from the tarball, but is still in bzr." >> report.txt
echo "Lines beginning with + denote files that were either got added to the tarball recently or which disappeared from bzr, but stayed in the tarball." >> report.txt
diff -uN $TNBSAVED $TNB >> report.txt
fi
mkdir -p html/
echo '<html><title>Tarball vs bzr delta changes</title><body><pre>' > html/report.html
cat report.txt >> html/report.html
echo '</pre>' >> html/report.html
if [ $retval = 1 ]
then
echo "<p>If these differences are ok, <a href="http://hudson.openstack.org/job/nova-tarball-bzr-delta/build">run the job again</a> and check the 'ack' box.</p>" >> report.txt
fi
echo '</body></html>' >> html/report.html
( cd $STATEPATH ; bzr commit "Finished bzr diff" )
exit $retval