Skip to content

Commit 6d3c89d

Browse files
authored
Merge pull request #588 from cgwalters/makefile-reproducible
Makefile: Serialize tarballs reproducibly
2 parents 5e21297 + 91ed63c commit 6d3c89d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
prefix ?= /usr
22

3+
SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct)
4+
# https://reproducible-builds.org/docs/archives/
5+
TAR_REPRODUCIBLE = tar --mtime="@${SOURCE_DATE_EPOCH}" --sort=name --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime
6+
37
all:
48
cargo build --release
59

@@ -23,10 +27,10 @@ install-with-tests: install
2327
install -D -m 0755 target/release/tests-integration $(DESTDIR)$(prefix)/bin/bootc-integration-tests
2428

2529
bin-archive: all
26-
$(MAKE) install DESTDIR=tmp-install && tar --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
30+
$(MAKE) install DESTDIR=tmp-install && $(TAR_REPRODUCIBLE) --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
2731

2832
test-bin-archive: all
29-
$(MAKE) install-with-tests DESTDIR=tmp-install && tar --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
33+
$(MAKE) install-with-tests DESTDIR=tmp-install && $(TAR_REPRODUCIBLE) --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
3034

3135
install-kola-tests:
3236
install -D -t $(DESTDIR)$(prefix)/lib/coreos-assembler/tests/kola/bootc tests/kolainst/*

0 commit comments

Comments
 (0)