[Reproducible-commits] [misc] 02/02: prebuilder: do a precheck with cmp to skip huge diffoscope installation if it's reproducible
Reiner Herrmann
reiner at reiner-h.de
Sat Jan 9 13:05:41 UTC 2016
This is an automated email from the git hooks/post-receive script.
deki-guest pushed a commit to branch master
in repository misc.
commit 2272c00e889dd6ac46b1dbfc57af67f2e864ef0f
Author: Reiner Herrmann <reiner at reiner-h.de>
Date: Sat Jan 9 14:03:42 2016 +0100
prebuilder: do a precheck with cmp to skip huge diffoscope installation if it's reproducible
---
prebuilder/pbuilderhooks/B92_diffoscope | 41 ++++++++++++++++++++++++++-------
1 file changed, 33 insertions(+), 8 deletions(-)
diff --git a/prebuilder/pbuilderhooks/B92_diffoscope b/prebuilder/pbuilderhooks/B92_diffoscope
index 62ec04f..dd44145 100755
--- a/prebuilder/pbuilderhooks/B92_diffoscope
+++ b/prebuilder/pbuilderhooks/B92_diffoscope
@@ -5,6 +5,17 @@
# of diffoscope that matches our build environment; and get the latest
# improvements if it's unstable.
+print_reproducible() {
+ echo
+ echo " _ _ _ _ "
+ echo " _ __ ___ _ __ _ __ ___ __| |_ _ ___(_) |__ | | ___ "
+ echo "| '__/ _ \ '_ \| '__/ _ \ / _\` | | | |/ __| | '_ \| |/ _ \\"
+ echo "| | | __/ |_) | | | (_) | (_| | |_| | (__| | |_) | | __/"
+ echo "|_| \___| .__/|_| \___/ \__,_|\__,_|\___|_|_.__/|_|\___|"
+ echo " |_| "
+ echo
+}
+
[ -f /tmp/buildd/initial_build.tar ] || exit 0
echo "I: unpacking initial build material"
@@ -12,18 +23,32 @@ mkdir -p /tmp/initial_build
tar -C /tmp/initial_build -xf /tmp/buildd/initial_build.tar
rm /tmp/buildd/initial_build.tar
+
+echo "I: comparing build artefacts with cmp"
+[ -x /usr/bin/dcmd ] || apt-get install -y --no-install-recommends devscripts 2>&1 > /dev/null
+FILES1=$(dcmd find /tmp/initial_build/*.changes -exec basename '{}' \; | LC_ALL=C sort)
+FILES2=$(dcmd find /tmp/buildd/*.changes -exec basename '{}' \; | LC_ALL=C sort)
+if [ "$FILES1" = "$FILES2" ]; then
+ DIFF=0
+ for file in $FILES1;
+ do
+ cmp -s "/tmp/initial_build/$file" "/tmp/buildd/$file"
+ DIFF=$?
+ [ $DIFF -gt 0 ] && break
+ done
+ if [ $DIFF -eq 0 ]; then
+ print_reproducible
+ echo "D: skipping installing and running diffoscope as package is reproducible"
+ exit 0
+ fi
+fi
+
+
echo "I: installing diffoscope and running it on the package"
apt-get install -y --install-recommends sudo diffoscope 2>&1 > /dev/null
touch /tmp/buildd/diffoscope.{txt,html}
chown nobody /tmp/buildd/diffoscope.{txt,html}
if sudo -u nobody diffoscope --text /tmp/buildd/diffoscope.txt --html /tmp/buildd/diffoscope.html /tmp/initial_build/*.changes /tmp/buildd/*.changes; then
- echo
- echo " _ _ _ _ "
- echo " _ __ ___ _ __ _ __ ___ __| |_ _ ___(_) |__ | | ___ "
- echo "| '__/ _ \ '_ \| '__/ _ \ / _\` | | | |/ __| | '_ \| |/ _ \\"
- echo "| | | __/ |_) | | | (_) | (_| | |_| | (__| | |_) | | __/"
- echo "|_| \___| .__/|_| \___/ \__,_|\__,_|\___|_|_.__/|_|\___|"
- echo " |_| "
- echo
+ print_reproducible
rm -f /tmp/buildd/diffoscope.{txt,html}
fi
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/misc.git
More information about the Reproducible-commits
mailing list