summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2014-10-22 22:44:53 +0200
committerHolger Levsen <holger@layer-acht.org>2014-10-22 22:44:53 +0200
commit5b5a28d7b9490542afbe7ba5f13ee846e7658079 (patch)
treef21f63d5f9ebb2227cccf18425de66fd0a7cb234
parente17f68c7ea0abee36622b15a897518ef6e0b8795 (diff)
downloadjenkins.debian.net-5b5a28d7b9490542afbe7ba5f13ee846e7658079.tar.xz
reproducible: check if the pbuilder base.tgz contains the wanted versions, abort if not
-rwxr-xr-xbin/reproducible_setup_pbuilder.sh29
1 files changed, 21 insertions, 8 deletions
diff --git a/bin/reproducible_setup_pbuilder.sh b/bin/reproducible_setup_pbuilder.sh
index 6075789f..e8e3afc2 100755
--- a/bin/reproducible_setup_pbuilder.sh
+++ b/bin/reproducible_setup_pbuilder.sh
@@ -24,7 +24,9 @@ done
# create script to configure a pbuilder chroot
#
create_setup_tmpfile() {
- cat > ${TMPFILE} <<- EOF
+ TMPFILE=$1
+ shift
+ cat > $TMPFILE <<- EOF
#
# this script is run within the pbuilder environment to further customize it
#
@@ -59,7 +61,7 @@ Mb0BawlXZui0MNUSnZtxHMxrjejdvZdqtskHl9srB1QThH0jasmUqbQPxCnxMbf1
-----END PGP PUBLIC KEY BLOCK-----" | apt-key add -
echo 'deb http://reproducible.alioth.debian.org/debian/ ./' > /etc/apt/sources.list.d/reproducible.list
apt-get update
-apt-get install -y dpkg dpkg-dev debhelper dh-python discount
+apt-get install -y $@
echo
dpkg -l
echo
@@ -72,14 +74,25 @@ EOF
# setup pbuilder for reproducible builds
#
setup_pbuilder() {
- echo "$(date) - creating /var/cache/pbuilder/${1}.tgz now..."
+ NAME=$1
+ shift
+ PACKAGES="$@"
+ echo "$(date) - creating /var/cache/pbuilder/${NAME}.tgz now..."
TMPFILE=$(mktemp)
- create_setup_tmpfile
- sudo pbuilder --create --basetgz /var/cache/pbuilder/${1}-new.tgz --distribution sid
- sudo pbuilder --execute --save-after-exec --basetgz /var/cache/pbuilder/${1}-new.tgz -- ${TMPFILE}
- sudo mv /var/cache/pbuilder/${1}-new.tgz /var/cache/pbuilder/${1}.tgz
+ LOG=$(mktemp)
+ create_setup_tmpfile ${TMPFILE} "${PACKAGES}"
+ sudo pbuilder --create --basetgz /var/cache/pbuilder/${NAME}-new.tgz --distribution sid
+ sudo pbuilder --execute --save-after-exec --basetgz /var/cache/pbuilder/${NAME}-new.tgz -- ${TMPFILE} | tee ${LOG}
+ echo
+ echo "Now let's see whether the correct packages where installed..."
+ for PKG in ${PACKAGES} ; do
+ grep "http://reproducible.alioth.debian.org/debian/ ./ Packages" ${LOG} \
+ | grep -v grep | grep "${PKG} " \
+ || ( echo ; echo "Package ${PKG} is not installed at all or probably rather not in our version, so removing the chroot and exiting now." ; sudo rm -v /var/cache/pbuilder/${NAME}-new.tgz ; exit 1 )
+ done
+ sudo mv /var/cache/pbuilder/${NAME}-new.tgz /var/cache/pbuilder/${NAME}.tgz
rm ${TMPFILE}
echo
}
-setup_pbuilder base-reproducible
+setup_pbuilder base-reproducible dpkg dpkg-dev debhelper dh-python discount