[Buildroot] [git commit branch/next] fs/tar: make results reproducible

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Wed Nov 23 21:55:34 UTC 2016


commit: https://git.buildroot.net/buildroot/commit/?id=59f9c4ca9feb2c070df508c7196f06a6e87307b4
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/next

In order to make tar images reproducible, force files order in tarball.

This work was sponsored by `BA Robotic Systems'.

Signed-off-by: Jérôme Pouiller <jezz at sysmic.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
 fs/tar/tar.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/tar/tar.mk b/fs/tar/tar.mk
index 11c69c5..b14c977 100644
--- a/fs/tar/tar.mk
+++ b/fs/tar/tar.mk
@@ -7,7 +7,8 @@
 TAR_OPTS := $(call qstrip,$(BR2_TARGET_ROOTFS_TAR_OPTIONS))
 
 define ROOTFS_TAR_CMD
-	tar $(TAR_OPTS) -cf $@ --numeric-owner -C $(TARGET_DIR) .
+	(cd $(TARGET_DIR); find -print0 | LC_ALL=C sort -z | \
+		tar $(TAR_OPTS) -cf $@ --null -T - --no-recursion --numeric-owner)
 endef
 
 $(eval $(call ROOTFS_TARGET,tar))


More information about the buildroot mailing list