From c1eb37b193600d22833714f84f8c74776d741a76 Mon Sep 17 00:00:00 2001 From: Scarlett Clark Date: Sun, 27 Sep 2020 19:29:31 +0200 Subject: Make KDEPackageAppTemplates to create reproducible tarball. By default tar glues files in a random order together, this makes the output non reproducible. In order to fix, produce a sorted output and uniquify user/group and chmod. --- kde-modules/KDEPackageAppTemplates.cmake | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/kde-modules/KDEPackageAppTemplates.cmake b/kde-modules/KDEPackageAppTemplates.cmake index 54fb6fa6..7f9feeb5 100644 --- a/kde-modules/KDEPackageAppTemplates.cmake +++ b/kde-modules/KDEPackageAppTemplates.cmake @@ -107,11 +107,20 @@ function(kde_package_app_templates) add_custom_target(${_baseName} ALL DEPENDS ${_template}) - add_custom_command(OUTPUT ${_template} - COMMAND ${CMAKE_COMMAND} -E tar "cvfj" ${_template} . - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName} - ) - + if(GNU_TAR_FOUND) + # Make tar archive reproducible, the arguments are only available on UNIX like systems + add_custom_command(OUTPUT ${_template} + COMMAND tar ARGS -c ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName} + --exclude .kdev_ignore --exclude .svn --sort=name --mode=go=rX,u+rw,a-s --owner=root + --group=root --numeric-owner -j -v -f ${_template} . + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName} + ) + else() + add_custom_command(OUTPUT ${_template} + COMMAND ${CMAKE_COMMAND} -E tar "cvfj" ${_template} . + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName} + ) + endif() install(FILES ${_template} DESTINATION ${ARG_INSTALL_DIR}) set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_template}") -- cgit v1.2.1