[education/rkward] rkward/rbackend/rpackages: Assume GNU tar on linux, only.

Thomas Friedrichsmeier null at kde.org
Mon Mar 28 16:37:41 BST 2022


Git commit 0f28322bb58ff69fec1d5e6e14b3a694f013572f by Thomas Friedrichsmeier.
Committed on 28/03/2022 at 15:37.
Pushed by tfry into branch 'master'.

Assume GNU tar on linux, only.

M  +6    -5    rkward/rbackend/rpackages/CMakeLists.txt

https://invent.kde.org/education/rkward/commit/0f28322bb58ff69fec1d5e6e14b3a694f013572f

diff --git a/rkward/rbackend/rpackages/CMakeLists.txt b/rkward/rbackend/rpackages/CMakeLists.txt
index 87c17dc0..fd4921ba 100644
--- a/rkward/rbackend/rpackages/CMakeLists.txt
+++ b/rkward/rbackend/rpackages/CMakeLists.txt
@@ -1,16 +1,17 @@
 MACRO(createRpackage name)
 	FILE(GLOB_RECURSE rkwardfiles${name} LIST_DIRECTORIES true CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${name}/*")
-	IF(APPLE OR WIN32)
+	IF(UNIX AND (${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
+		# For reproducible builds, avoid getting user name/id into the tar. Works with GNU tar, only, unfortunately.
 		ADD_CUSTOM_COMMAND(OUTPUT ${name}.tgz
-			COMMAND ${CMAKE_COMMAND} -E tar "cfz" "${CMAKE_CURRENT_BINARY_DIR}/${name}.tgz" "${name}"
+			COMMAND tar "cfz" "${CMAKE_CURRENT_BINARY_DIR}/${name}.tgz" "--owner=0" "--group=0" "--numeric-owner" "${name}"
 			WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 			DEPENDS ${rkwardfiles${name}})
-	ELSE(APPLE OR WIN32)
+	ELSE(UNIX AND (${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
 		ADD_CUSTOM_COMMAND(OUTPUT ${name}.tgz
-			COMMAND tar "cfz" "${CMAKE_CURRENT_BINARY_DIR}/${name}.tgz" "--owner=0" "--group=0" "--numeric-owner" "${name}"
+			COMMAND ${CMAKE_COMMAND} -E tar "cfz" "${CMAKE_CURRENT_BINARY_DIR}/${name}.tgz" "${name}"
 			WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 			DEPENDS ${rkwardfiles${name}})
-	ENDIF(APPLE OR WIN32)
+	ENDIF(UNIX AND (${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
 ENDMACRO()
 
 createRpackage(rkward)


More information about the rkward-tracker mailing list