Skip to content

ENT-14061: Make the source and package tarballs reproducible#3166

Draft
larsewi wants to merge 1 commit into
cfengine:masterfrom
larsewi:reproducible-tar-package
Draft

ENT-14061: Make the source and package tarballs reproducible#3166
larsewi wants to merge 1 commit into
cfengine:masterfrom
larsewi:reproducible-tar-package

Conversation

@larsewi
Copy link
Copy Markdown
Contributor

@larsewi larsewi commented May 28, 2026

This makes both the make dist source tarball and the make tar-package package tarball reproducible:

  • Add --sort=name to the exported TAR_OPTIONS so $(am__tar) emits members in a stable order for both recipes.
  • In dist-hook, normalize directory permissions to 755 and, when SOURCE_DATE_EPOCH is set, clamp every mtime to it.
  • In tar-package, clamp staged file mtimes to SOURCE_DATE_EPOCH and pass -n to gzip so the gzip header carries no timestamp.

Ticket: ENT-14061
Together: cfengine/buildscripts#2271

@larsewi
Copy link
Copy Markdown
Contributor Author

larsewi commented May 28, 2026

@cf-bottom Jenkins please :)

@larsewi larsewi added the cherry-pick? Fixes which may need to be cherry-picked to LTS branches label May 28, 2026
@cfengine cfengine deleted a comment from cf-bottom May 28, 2026
@larsewi larsewi force-pushed the reproducible-tar-package branch from a549186 to 6437978 Compare May 29, 2026 09:50
@larsewi larsewi changed the title ENT-14061: Make tar-package reproducible via SOURCE_DATE_EPOCH ENT-14061: Make the source and package tarballs reproducible May 29, 2026
@cfengine cfengine deleted a comment from cf-bottom May 29, 2026
@cfengine cfengine deleted a comment from cf-bottom May 29, 2026
@cfengine cfengine deleted a comment from cf-bottom May 29, 2026
@cfengine cfengine deleted a comment from cf-bottom Jun 1, 2026
@larsewi larsewi force-pushed the reproducible-tar-package branch 2 times, most recently from ca2bd45 to 5dbc2fb Compare June 1, 2026 12:00
Two builds of the same source tree now produce byte-identical
tarballs, following GNU tar's reproducibility guidance:

* Select tar-pax in configure.ac so $(am__tar) emits --format=posix,
  giving stable, version-independent header encoding for both
  "make dist" and "make tar-package".
* Expand the exported TAR_OPTIONS: --sort=name for stable member
  order, --numeric-owner / --owner=0 / --group=0 to drop buildslave
  identity, --mode=go+u,go-w for deterministic permissions, and the
  --pax-option flags to keep tar's PID out of header names and omit
  atime/ctime (leaving the archive in the ustar subset).
* In dist-hook, normalize directory permissions to 755 and, when
  SOURCE_DATE_EPOCH is set, clamp every mtime to it.
* In tar-package, clamp staged file mtimes to SOURCE_DATE_EPOCH and
  pass -n to gzip so the gzip header carries no timestamp.

Ticket: ENT-14061
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
@larsewi larsewi force-pushed the reproducible-tar-package branch from 5dbc2fb to 77c11ba Compare June 1, 2026 13:30
@cfengine cfengine deleted a comment from cf-bottom Jun 1, 2026
@cf-bottom
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick? Fixes which may need to be cherry-picked to LTS branches

Development

Successfully merging this pull request may close these issues.

2 participants