fs/tar: make results reproducible
authorJérôme Pouiller <jezz@sysmic.org>
Wed, 23 Nov 2016 12:58:43 +0000 (13:58 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 23 Nov 2016 21:55:34 +0000 (22:55 +0100)
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@sysmic.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
fs/tar/tar.mk

index 11c69c5a8baca725af1625e5fedea11f933118d0..b14c977d761c5c0d638c8c01d0e84c4b4b61ec8f 100644 (file)
@@ -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))