Skip to content

Commit 91ed63c

Browse files
cgwaltersjeckersb
authored andcommitted
Makefile: Serialize tarballs reproducibly
This ensures that when we rerun the container build without changing the source, we get the same thing. Which then further ensures we don't invalidate any cached disk images, etc. Signed-off-by: Colin Walters <[email protected]>
1 parent 5e21297 commit 91ed63c

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)