Commit 25e78ffa authored by Aaron Puchert's avatar Aaron Puchert

Make tar archives reproducible by setting Pax headers

When POSIXLY_CORRECT is set, GNU tar will add ctime, atime and the PID
of the tar process that created the archive, as pointed out in [1].
To circumvent this, we set the Pax headers manually as recommended, but
we only do this when SOURCE_DATE_EPOCH is set, i.e. reproducible builds
are desired.


Test Plan:
Repeated builds produce the same files now. Changing the input files'
timestamps seems without effect.

Reviewers: kfunk, #kdevelop, kossebau

Reviewed By: #kdevelop, kossebau

Differential Revision:
parent 381aec18
......@@ -66,7 +66,8 @@ macro(kdevplatform_create_template_archive _templateName)
set(extraArgs "")
# We assume there is tar > 1.28 if a reproducible build is wanted.
set(extraArgs --mtime="@$ENV{SOURCE_DATE_EPOCH}" --sort=name)
set(extraArgs --mtime="@$ENV{SOURCE_DATE_EPOCH}" --sort=name,delete=atime,delete=ctime)
add_custom_command(OUTPUT ${_template}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment