Hi!

On Mon, 2016-10-17 at 23:14:01 -0400, James McCoy wrote:
> Thanks for the patches!  I think the first patch is straight forward
> enough.  I'll let Antonio comment on whether he wants to apply the other
> two.  I just had one comment, inline.

Perfect thanks!

> > @@ -83,13 +81,9 @@ create_build_script() {
> >      echo 'cd ../disorderfs'
> >    fi
> >  
> > -  echo
> > -  echo 'dpkg-source --before-build .'
> > -  echo 'fakeroot debian/rules clean'
> > -
> >    variation date
> > -  vary 'fakeroot debian/rules binary' \
> > -    'faketime "+213days +7hours +13minutes" fakeroot debian/rules binary'
> > +  vary 'dpkg-buildpackage -b' \
> > +    'dpkg-buildpackage -b -r"faketime +213days+7hours+13minutes fakeroot"'
> 
> Shouldn't these use "-us -uc" too?  The intention of debrepro is just to
> check for variance, not to produce something to upload, so I don't think
> it should default to signing.

Ah, indeed sorry, I've gotten used to not pass those anymore as I've
set them as default on my ~/.config/dpkg/buildpackage.conf file. :)

Attached rebased and fixed patches.

Thanks,
Guillem
From c9be0604cf10da3fbda6bec1b87f2905c80dcf7a Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@debian.org>
Date: Tue, 18 Oct 2016 03:54:21 +0200
Subject: [PATCH 1/2] debrepro: Use dpkg-buildpackage instead of ad-hoc code

Part of the reproducible machinery is handled already by
dpkg-buildpackage, so there's no need to duplicate it. We can also
pass faketime+fakeroot as a normal gain-root-command.
---
 scripts/debrepro.sh | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/scripts/debrepro.sh b/scripts/debrepro.sh
index 38dd14f..e1444fb 100755
--- a/scripts/debrepro.sh
+++ b/scripts/debrepro.sh
@@ -56,8 +56,6 @@ create_build_script() {
   echo "# package"
   echo
 
-  echo 'export SOURCE_DATE_EPOCH=$(date -d "$(dpkg-parsechangelog -SDate)" +%s)'
-
   variation PATH
   vary '' 'export PATH="$PATH":/i/capture/the/path'
 
@@ -83,13 +81,9 @@ create_build_script() {
     echo 'cd ../disorderfs'
   fi
 
-  echo
-  echo 'dpkg-source --before-build .'
-  echo 'fakeroot debian/rules clean'
-
   variation date
-  vary 'fakeroot debian/rules binary' \
-    'faketime "+213days +7hours +13minutes" fakeroot debian/rules binary'
+  vary 'dpkg-buildpackage -b -us -uc' \
+    'dpkg-buildpackage -b -us -uc -r"faketime +213days+7hours+13minutes fakeroot"'
 }
 
 
-- 
2.9.3

From 123cba54129187c45e3241c434f866921b19b10f Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@debian.org>
Date: Tue, 18 Oct 2016 04:29:43 +0200
Subject: [PATCH 2/2] 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).
---
 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 <terce...@debian.org>
+# Copyright © 2016 Guillem Jover <guil...@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"
-- 
2.9.3

_______________________________________________
devscripts-devel mailing list
devscripts-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel

Reply via email to