summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_build.sh
blob: 230389373d4092f6c061f499a0d31312b558ca21 (plain)
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
#!/bin/bash

# Copyright 2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2

. /srv/jenkins/bin/common-functions.sh
common_init "$@"

if [ -d misc.git ] ; then
	cd misc.git
	git pull
	cd ..
else
	git clone git://git.debian.org/git/reproducible/misc.git misc.git
fi

COUNT_TOTAL=0
COUNT_GOOD=0
COUNT_BAD=0
for PACKAGE in "$@" ; do
	let "COUNT_TOTAL=COUNT_TOTAL+1"
	rm b1 b2 -rf
	apt-get source --download-only ${PACKAGE}
	sudo pbuilder --build --basetgz /var/cache/pbuilder/base-reproducible.tgz ${PACKAGE}_*.dsc
	mkdir b1 b2
	dcmd cp /var/cache/pbuilder/result/${PACKAGE}_*.changes b1
	sudo dcmd rm /var/cache/pbuilder/result/${PACKAGE}_*.changes
	sudo pbuilder --build --basetgz /var/cache/pbuilder/base-reproducible.tgz ${PACKAGE}_*.dsc
	dcmd cp /var/cache/pbuilder/result/${PACKAGE}_*.changes b2
	sudo dcmd rm /var/cache/pbuilder/result/${PACKAGE}_*.changes

	TMPFILE=$(mktemp)
	./misc.git/diffp b1/*.changes b2/*.changes | tee $TMPFILE
	if grep -qv '^\*\*\*\*\*' $TMPFILE ; then
		figlet ${PACKAGE}
		echo
		echo "${PACKAGE} build successfull."
		let "COUNT_GOOD=COUNT_GOOD+1"
	else
		echo "Warning: ${PACKAGE} failed to build reproducible."
		let "COUNT_BAD=COUNT_BAD+1"
	fi

	rm b1 b2 $TMPFILE -rf
done

echo
echo "$COUNT_TOTAL packages attempted to build in total."
echo "$COUNT_GOOD packages successfully built reproducible."
echo "$COUNT_GOOD packages failed to built reproducible."
echo
echo "The full list of packages: $@"