summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-03-21 10:44:48 +0100
committerSlávek Banko <slavek.banko@axis.cz>2020-03-23 17:30:42 +0100
commitf0659a0437dbe9f6943c7429dd6651d165dfa1c3 (patch)
treea9ceb27c77c853562ac56049585c41f6d48cf53e
parentca613e7db0996d77aafcbecaa0805e83eb82cb2a (diff)
downloadtde-cmake-f0659a0437dbe9f6943c7429dd6651d165dfa1c3.tar.gz
tde-cmake-f0659a0437dbe9f6943c7429dd6651d165dfa1c3.zip
tde_create_tarball: Add options to ensure reproducibility.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 6574bc5ae92f85d97705d1f41cf52709246122e5)
-rw-r--r--modules/TDEMacros.cmake16
1 files changed, 12 insertions, 4 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 66aedf3..8478f2a 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1951,6 +1951,13 @@ macro( tde_create_tarball )
string( REGEX REPLACE "^([^\n]*)\n.*" "\\1" TAR_VERSION "${TAR_VERSION}" )
if( "${TAR_VERSION}" MATCHES "GNU *tar" )
set( TAR_SETOWNER "--owner=root;--group=root" )
+ set( TAR_REPRODUCIBLE "--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime" )
+ tde_read_src_metadata()
+ if( TDE_PKG_DATETIME )
+ list( APPEND TAR_REPRODUCIBLE --mtime "${TDE_PKG_DATETIME}" )
+ elseif( TDE_SCM_MODULE_DATETIME )
+ list( APPEND TAR_REPRODUCIBLE --mtime "${TDE_SCM_MODULE_DATETIME}" )
+ endif( )
elseif( "${TAR_VERSION}" MATCHES "bsd *tar" )
set( TAR_SETOWNER "--uname=root;--gname=root" )
else( )
@@ -1963,9 +1970,9 @@ macro( tde_create_tarball )
endif( )
if( _compression )
if( "${_compression}" STREQUAL "gzip" )
- set( _compression "-z" )
+ set( TAR_COMPRESSION "|" ${_compression} "-n" )
else( )
- set( _compression "--use-compress-program=\"${_compression}\"" )
+ set( TAR_COMPRESSION "|" ${_compression} )
endif( )
endif( )
@@ -1976,8 +1983,9 @@ macro( tde_create_tarball )
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_target}" )
add_custom_command(
- COMMAND ${TAR_EXECUTABLE} cf ${CMAKE_CURRENT_BINARY_DIR}/${_target}
- ${_compression} ${TAR_SETOWNER} -- ${_files}
+ COMMAND ${TAR_EXECUTABLE} cf -
+ ${TAR_SETOWNER} ${TAR_REPRODUCIBLE} -- ${_files}
+ ${TAR_COMPRESSION} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}
WORKING_DIRECTORY "${_sourcedir}"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_target}"
DEPENDS ${_files_deps}