Chris Lamb wrote on Sun, Dec 11, 2016 at 15:00:43 +0100:
> Patch attached.

You beat me to it :-)  The patch I've come up with is slightly different
to yours, so I'll post it here and let the maintainer choose.

Cheers,

Daniel


diff --git a/debian/patches/dirname-agnostic-1.patch 
b/debian/patches/dirname-agnostic-1.patch
index e69de29..6793c5d 100644
--- a/debian/patches/dirname-agnostic-1.patch
+++ b/debian/patches/dirname-agnostic-1.patch
@@ -0,0 +1,29 @@
+Description: Extract version number from within the build directory
+ Makes the build reproducible when the absolute path to the source root
+ directory differs.
+Author: Daniel Shahaf <danie...@apache.org>
+Bug: https://bugs.debian.org/-1
+Forwarded: no
+Last-Update: 2016-12-11
+
+--- a/src/build/print_version_str
++++ b/src/build/print_version_str
+@@ -19,17 +19,7 @@
+ 
+       version_str="$branch-$rev (svn)"
+ else
+-      dirname=`cd "$basedir" && pwd | xargs basename`
+-      case "$dirname" in
+-              "$progname"-*)
+-                      version=`echo "$dirname" | sed -e "s/^$progname-//"`
+-                      ;;
+-              *)
+-                      version="unknown"
+-                      ;;
+-      esac
+-
+-      version_str="$version"
++      version_str="`< "${basedir}"/ChangeLog head -n1 | awk '{print $2}'`"
+ fi
+ 
+ echo "$version_str"
diff --git a/debian/patches/dirname-agnostic-2.patch 
b/debian/patches/dirname-agnostic-2.patch
index e69de29..825a6a9 100644
--- a/debian/patches/dirname-agnostic-2.patch
+++ b/debian/patches/dirname-agnostic-2.patch
@@ -0,0 +1,18 @@
+Description: Use the debian package version instead of the upstream version
+ Follow-up to dirname-agnostic-1.patch.
+Author: Daniel Shahaf <danie...@apache.org>
+Bug: https://bugs.debian.org/-1
+Forwarded: not-needed
+Last-Update: 2016-12-11
+
+--- a/src/build/print_version_str
++++ b/src/build/print_version_str
+@@ -19,7 +19,7 @@
+ 
+       version_str="$branch-$rev (svn)"
+ else
+-      version_str="`< "${basedir}"/ChangeLog head -n1 | awk '{print $2}'`"
++      version_str="`cd "${basedir}" && dpkg-parsechangelog -SVersion`"
+ fi
+ 
+ echo "$version_str"
diff --git a/debian/patches/series b/debian/patches/series
index 94c3b93..036d7c2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,5 @@ flags.patch
 docs.patch
 reproducible-build.patch
 sparc32.patch
+dirname-agnostic-1.patch
+dirname-agnostic-2.patch

Reply via email to