[med-svn] [plast] 01/05: make build reproducible

Sascha Steinbiss sascha at steinbiss.name
Sat May 28 12:54:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

sascha-guest pushed a commit to branch master
in repository plast.

commit ac07b22d551855278e6177f494c398fa82d5d47a
Author: Sascha Steinbiss <sascha at steinbiss.name>
Date:   Sat May 28 11:31:07 2016 +0000

    make build reproducible
---
 debian/changelog                  |  8 +++++
 debian/patches/reproducible.patch | 64 +++++++++++++++++++++++++++++++++++++++
 debian/patches/series             |  1 +
 debian/rules                      |  5 ++-
 4 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 247173f..ca2f678 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+plast (2.3.1+dfsg-3) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Make build reproducible.
+    - Use predictable strings for build date and OS.
+
+ -- Sascha Steinbiss <sascha at steinbiss.name>  Sat, 28 May 2016 11:05:55 +0000
+
 plast (2.3.1+dfsg-2) unstable; urgency=medium
 
   * Make sure wrapper script is calling bash
diff --git a/debian/patches/reproducible.patch b/debian/patches/reproducible.patch
new file mode 100644
index 0000000..29fa8a1
--- /dev/null
+++ b/debian/patches/reproducible.patch
@@ -0,0 +1,64 @@
+Description: make build reproducible
+Author: Sascha Steinbiss <sascha at steinbiss.name>
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -14,20 +14,20 @@
+ set (plast_VERSION_MINOR 3)
+ set (plast_VERSION_PATCH 1)
+ set (plast-version ${plast_VERSION_MAJOR}.${plast_VERSION_MINOR}.${plast_VERSION_PATCH})
+-set (plast-date "xxxx-xx-xx")
++set (plast-date $ENV{BDATE})
+ 
+ ################################################################################
+ # update date pattern with real value
+ ################################################################################
+-INCLUDE(FindPerl)
++#INCLUDE(FindPerl)
+ 
+ # We execute a command that retrieves the current date.
+-IF (PERL_FOUND)
+-    EXECUTE_PROCESS (
+-        COMMAND "${PERL_EXECUTABLE}" "-le" "@T=localtime; printf (\"%04d-%02d-%02d %02d:%02d:%02d\",$T[5]+1900,$T[4]+1,$T[3],$T[2],$T[1],$T[0])"
+-        OUTPUT_VARIABLE plast-date
+-    )
+-ENDIF (PERL_FOUND)
++#IF (PERL_FOUND)
++#    EXECUTE_PROCESS (
++#        COMMAND "${PERL_EXECUTABLE}" "-le" "@T=localtime; printf (\"%04d-%02d-%02d %02d:%02d:%02d\",$T[5]+1900,$T[4]+1,$T[3],$T[2],$T[1],$T[0])"
++#        OUTPUT_VARIABLE plast-date
++#    )
++#ENDIF (PERL_FOUND)
+ 
+ ################################################################################
+ # set files
+@@ -35,7 +35,9 @@
+ set (LIBRARY_OUTPUT_PATH    lib/${CMAKE_BUILD_TYPE})
+ set (EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
+ file (GLOB_RECURSE  PlastLibraryFiles  src/*)
++list (SORT PlastLibraryFiles)
+ file (GLOB_RECURSE  PlastCmdFiles      src/*)
++list (SORT PlastCmdFiles)
+ 
+ ################################################################################
+ # prepare targets
+--- a/src/misc/api/version.hpp.in
++++ b/src/misc/api/version.hpp.in
+@@ -37,7 +37,7 @@
+ #define PLAST_BUILD_DATE   	"${plast-date}"
+ 
+ /** Os the library. */
+-#define PLAST_BUILD_OS   	"${CMAKE_SYSTEM}"
++#define PLAST_BUILD_OS   	"Debian"
+ 
+ /** Compiler used for library build. */
+ #define PLAST_COMPILER  	 "${CMAKE_C_COMPILER} (${CMAKE_CXX_COMPILER_VERSION})"
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -26,6 +26,7 @@
+ add_definitions (${plast-flags})
+ 
+ file (GLOB_RECURSE  LibraryFiles  ./*)
++list (SORT LibraryFiles)
+ 
+ include_directories (${plast-includes}  ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 105e6f8..b204cb8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ fix_format_string.patch
 adapt_auto_test_script.sh
 no_msse3.patch
 spelling.patch
+reproducible.patch
diff --git a/debian/rules b/debian/rules
index 4bd8896..2491990 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,6 +4,8 @@
 
 DEBPKGNAME := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')
 BUILD_DIR := obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+BUILD_DATE := $(shell TZ=UTC LC_ALL=C dpkg-parsechangelog | grep Date: | cut -d' ' -f2-7)
+export BDATE=$(shell TZ=UTC LC_ALL=C date -d"$(BUILD_DATE)" +'%Y-%m-%d')
 
 %:
 	dh $@ --buildsystem=cmake
@@ -16,4 +18,5 @@ override_dh_install:
 	rm -rf debian/*/usr/include
 
 override_dh_auto_test:
-	scripts/test-plast.sh
\ No newline at end of file
+	scripts/test-plast.sh
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/plast.git



More information about the debian-med-commit mailing list