Source: libdigidoc
Version: 3.10.1.1208-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that libdigidoc could not be built reproducibly.
It embeds the current build date into the manpage.

The attached patch adds support for SOURCE_DATE_EPOCH, which sets the
timestamp in the manpage to the date from the last changelog entry.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/patches/03-reproducible-build.patch b/debian/patches/03-reproducible-build.patch
new file mode 100644
index 0000000..2800959
--- /dev/null
+++ b/debian/patches/03-reproducible-build.patch
@@ -0,0 +1,17 @@
+Index: libdigidoc-3.10.1.1208/cmake/modules/VersionInfo.cmake
+===================================================================
+--- libdigidoc-3.10.1.1208.orig/cmake/modules/VersionInfo.cmake
++++ libdigidoc-3.10.1.1208/cmake/modules/VersionInfo.cmake
+@@ -10,7 +10,11 @@ if( WIN32 )
+ 	execute_process( COMMAND "cmd.exe" "/C date /T" OUTPUT_VARIABLE BUILD_DATE )
+ 	string( REGEX REPLACE ".*([0-3][0-9]).([0-1][0-9]).([0-9][0-9][0-9][0-9]).*" "\\1.\\2.\\3" BUILD_DATE ${BUILD_DATE} )
+ elseif( UNIX )
+-	execute_process( COMMAND "date" "+%d.%m.%Y" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE )
++	if (DEFINED ENV{SOURCE_DATE_EPOCH})
++		execute_process( COMMAND "date" "-u" "-d" "@$ENV{SOURCE_DATE_EPOCH}" "+%d.%m.%Y" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE )
++	else()
++		execute_process( COMMAND "date" "+%d.%m.%Y" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE )
++	endif()
+ else()
+ 	message( SEND_ERROR "date not implemented")
+ 	set( BUILD_DATE "00.00.0000" )
diff --git a/debian/patches/series b/debian/patches/series
index b8d86dd..4c2d8d1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 01-manpage.patch
 02-no-rpath.patch
+03-reproducible-build.patch
_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to