[devscripts] 02/03: debrepro: Compare .changes files and fallback to use debdiff
Antonio Terceiro
terceiro at moszumanska.debian.org
Wed Oct 19 16:01:34 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to branch master
in repository devscripts.
commit 0be42ea6fd466f492fbc317f186a39231eb4947a
Author: Guillem Jover <guillem at debian.org>
Date: Tue Oct 18 04:29:43 2016 +0200
debrepro: Compare .changes files and fallback to use debdiff
We should be checking all artifacts generated not just .deb files,
this includes .udebs and by-hand artifacts. This will also allow
adding support for source comparison.
If diffoscope is not present fallback to debdiff which is better than
a simple cmp(1).
Signed-off-by: Antonio Terceiro <terceiro at debian.org>
---
scripts/debrepro.sh | 35 +++++++++++++++--------------------
1 file changed, 15 insertions(+), 20 deletions(-)
diff --git a/scripts/debrepro.sh b/scripts/debrepro.sh
index e1444fb..e7b19dd 100755
--- a/scripts/debrepro.sh
+++ b/scripts/debrepro.sh
@@ -3,6 +3,7 @@
# debrepro: a reproducibility tester for Debian packages
#
# © 2016 Antonio Terceiro <terceiro at debian.org>
+# Copyright © 2016 Guillem Jover <guillem at debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -100,28 +101,22 @@ build() {
mv "$tmpdir/build" "$tmpdir/$which_build"
}
-binmatch() {
- cmp --silent "$1" "$2"
-}
-
compare() {
rc=0
- for first_deb in "$tmpdir"/first/*.deb; do
- deb="$(basename "$first_deb")"
- second_deb="$tmpdir"/second/"$deb"
- if binmatch "$first_deb" "$second_deb"; then
- echo "✓ $deb: binaries match"
- else
- echo ""
- rc=1
- if which diffoscope >/dev/null; then
- diffoscope "$first_deb" "$second_deb" || true
- else
- echo "✗ $deb: binaries don't match"
- fi
- fi
- done
- if [ "$rc" -ne 0 ]; then
+ first_changes=$(echo "$tmpdir"/first/*.changes)
+ changes="$(basename "$first_changes")"
+ second_changes="$tmpdir/second/$changes"
+
+ if which diffoscope >/dev/null; then
+ diffoscope "$first_changes" "$second_changes" || rc=1
+ else
+ debdiff -q -d --control --controlfiles ALL \
+ "$first_changes" "$second_changes" || rc=1
+ fi
+ if [ "$rc" -eq 0 ]; then
+ echo "✓ $changes: artifacts match"
+ else
+ echo "✗ $changes: artifacts do not match"
echo "E: package is not reproducible."
if ! which diffoscope >/dev/null; then
echo "I: install diffoscope for a deeper comparison between binaries"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list