[rkward] /: Debian build: Make build reproducible

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Sun Nov 29 19:58:29 UTC 2015


Git commit 2bd7f0454a20e6e64844153df69f59d1a1b79847 by Thomas Friedrichsmeier.
Committed on 29/11/2015 at 19:50.
Pushed by tfry into branch 'master'.

Debian build: Make build reproducible

Summary: Diff taken from https://bugs.debian.org/783290 for testing purposes.

Test Plan: The idea itself is acceptable, of course, but, importantly, needs to support building without specified build-timestamp (need to adjust rkpackage_install.cmake.in, only, I think).

Subscribers: RKWard-Devel-list, tfry

Differential Revision: https://phabricator.kde.org/D104

M  +2    -0    debian/changelog
M  +5    -1    debian/rules
M  +1    -1    rkward/rbackend/rpackages/CMakeLists.txt
M  +6    -2    rkward/rbackend/rpackages/rpackage_install.cmake.in

http://commits.kde.org/rkward/2bd7f0454a20e6e64844153df69f59d1a1b79847

diff --git a/debian/changelog b/debian/changelog
index 87ab96e..2a3d7d8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ rkward (0.6.3z+0.6.4+devel1-1) unstable; urgency=low
   * new upstream release
   * now uses QtWebKit module, adjust build-depends, accordingly (in a way that is
     backwards compatible with Ubuntu Lucid)
+  * Make build reproducible (thanks to Philip Rinn)
+    closes: #783290
 
  -- Thomas Friedrichsmeier <tfry at users.sourceforge.net>  Thu, 26 Feb 2015 10:30:00 +0100
 
diff --git a/debian/rules b/debian/rules
index 8ccc0ae..3200f21 100755
--- a/debian/rules
+++ b/debian/rules
@@ -26,6 +26,9 @@ RVERS = $(shell dpkg-query -W --showformat='$${Version}' r-base-core)
 RMAJOR = $(shell echo $(RVERS) | awk -F. '{print $$1}')
 RMINOR = $(shell echo $(RVERS) | awk -F. '{print $$2}')
 
+# set built-time of GNUR packages to time of created binary package based on stamp in changelog
+builttime = $(shell dpkg-parsechangelog -l$(CURDIR)/debian/changelog | awk -F': ' '/Date/ {print $$2}')
+
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
 	CFLAGS += -O0
 else
@@ -65,7 +68,8 @@ build-stamp:
 		-DCMAKE_VERBOSE_MAKEFILE=ON \
 		-DKDE4_DISABLE_MULTIMEDIA=ON \
 		-DR_EXECUTABLE=/usr/bin/R/ \
-		-DR_LIBDIR=/usr/lib/R/site-library/
+		-DR_LIBDIR=/usr/lib/R/site-library/ \
+		-DBUILD_TIMESTAMP="$(builttime)"
 
 	# Add here commands to compile the package.
 	cd $(CURDIR)/build && $(MAKE)
diff --git a/rkward/rbackend/rpackages/CMakeLists.txt b/rkward/rbackend/rpackages/CMakeLists.txt
index f6e566e..7b62af4 100644
--- a/rkward/rbackend/rpackages/CMakeLists.txt
+++ b/rkward/rbackend/rpackages/CMakeLists.txt
@@ -5,4 +5,4 @@ CONFIGURE_FILE(
 	"${CMAKE_CURRENT_BINARY_DIR}/rpackage_install.cmake"
 	@ONLY)
 
-INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/rpackage_install.cmake -DDESTDIR=${DESTDIR})
+INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/rpackage_install.cmake -DDESTDIR=${DESTDIR} -DBUILD_TIMESTAMP=${BUILD_TIMESTAMP})
diff --git a/rkward/rbackend/rpackages/rpackage_install.cmake.in b/rkward/rbackend/rpackages/rpackage_install.cmake.in
index 67edd1b..e1d8eb1 100644
--- a/rkward/rbackend/rpackages/rpackage_install.cmake.in
+++ b/rkward/rbackend/rpackages/rpackage_install.cmake.in
@@ -2,6 +2,10 @@ SET(DESTDIR $ENV{DESTDIR})
 
 MESSAGE(STATUS "Installing R support packages")
 
+IF(NOT ${BUILD_TIMESTAMP} EQUAL "")
+	SET (TIMESTAMPARG "--built-timestamp=${BUILD_TIMESTAMP}")
+ENDIF(NOT ${BUILD_TIMESTAMP} EQUAL "")
+
 IF(WIN32)
 	SET(R_LIBDIR @R_LIBDIR@)
 	IF(DESTDIR)
@@ -11,7 +15,7 @@ IF(WIN32)
 		FILE(MAKE_DIRECTORY "${R_LIBDIR}")
 	ENDIF(DESTDIR)
 	EXECUTE_PROCESS(
-		COMMAND @R_EXECUTABLE@ CMD INSTALL -c -l ${R_LIBDIR} "@CMAKE_CURRENT_SOURCE_DIR@/rkward" "@CMAKE_CURRENT_SOURCE_DIR@/rkwardtests"
+		COMMAND @R_EXECUTABLE@ CMD INSTALL ${TIMESTAMPARG} -c -l ${R_LIBDIR} "@CMAKE_CURRENT_SOURCE_DIR@/rkward" "@CMAKE_CURRENT_SOURCE_DIR@/rkwardtests"
 		WORKING_DIRECTORY @CMAKE_CURRENT_BINARY_DIR@
 		RESULT_VARIABLE R_LIB_INSTALL_EXIT_CODE
 	)
@@ -20,7 +24,7 @@ ELSE(WIN32)
 		COMMAND mkdir -p @CMAKE_CURRENT_BINARY_DIR@/tmp ${DESTDIR}/@R_LIBDIR@
 	)
 	EXECUTE_PROCESS(
-		COMMAND env TMPDIR=@CMAKE_CURRENT_BINARY_DIR@/tmp @R_EXECUTABLE@ CMD INSTALL -c -l ${DESTDIR}/@R_LIBDIR@ "@CMAKE_CURRENT_SOURCE_DIR@/rkward" "@CMAKE_CURRENT_SOURCE_DIR@/rkwardtests"
+		COMMAND env TMPDIR=@CMAKE_CURRENT_BINARY_DIR@/tmp @R_EXECUTABLE@ CMD INSTALL ${TIMESTAMPARG} -c -l ${DESTDIR}/@R_LIBDIR@ "@CMAKE_CURRENT_SOURCE_DIR@/rkward" "@CMAKE_CURRENT_SOURCE_DIR@/rkwardtests"
 		WORKING_DIRECTORY @CMAKE_CURRENT_BINARY_DIR@
 		RESULT_VARIABLE R_LIB_INSTALL_EXIT_CODE
 	)



More information about the rkward-tracker mailing list