diff options
author | Scarlett Clark <scarlett.gately.clark@gmail.com> | 2020-09-27 19:29:31 +0200 |
---|---|---|
committer | Sandro Knauß <sknauss@kde.org> | 2020-11-02 01:22:26 +0100 |
commit | c1eb37b193600d22833714f84f8c74776d741a76 (patch) | |
tree | cd4049c14323685528d51db95c0a7d0c34301605 /kde-modules | |
parent | 523e95465a814e7538f78fc1e5a19af8977d9ae1 (diff) | |
download | extra-cmake-modules-c1eb37b193600d22833714f84f8c74776d741a76.tar.gz extra-cmake-modules-c1eb37b193600d22833714f84f8c74776d741a76.tar.bz2 |
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.
Diffstat (limited to 'kde-modules')
-rw-r--r-- | kde-modules/KDEPackageAppTemplates.cmake | 19 |
1 files 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}") |