build: Use stable file ordering in sysupgrade.tar
authorSven Eckelmann <sven@narfation.org>
Thu, 6 Dec 2018 10:09:18 +0000 (11:09 +0100)
committerMathias Kresin <dev@kresin.me>
Wed, 2 Jan 2019 21:36:16 +0000 (22:36 +0100)
The file ordering in the current sysupgrade depends on the order of file in
a filesystem. This is often already in a sane (alphabetical order) but this
is not always the case. For example, the OpenWrt build servers return a
different ordering.

This breaks the reproducibility of the sysupgrade tarballs significantly
and also resulted in images which cannot be used for upgrades on devices
like the OpenMesh A42/A62.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
scripts/sysupgrade-tar.sh

index 45b17daccd81587916ea640ab0406f766e2a43de..ca5577387d6837e0085995ae8a57368b8fe937ae 100755 (executable)
@@ -61,7 +61,7 @@ if [ -n "$SOURCE_DATE_EPOCH" ]; then
        mtime="--mtime=@${SOURCE_DATE_EPOCH}"
 fi
 
-(cd "$tmpdir"; tar cvf sysupgrade.tar sysupgrade-${board} ${mtime})
+(cd "$tmpdir"; tar --sort=name -cvf sysupgrade.tar sysupgrade-${board} ${mtime})
 err="$?"
 if [ -e "$tmpdir/sysupgrade.tar" ]; then
        cp "$tmpdir/sysupgrade.tar" "$outfile"