From 2d162dd1216047ea1904ac588b9eda8dd49bd831 Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Tue, 19 Mar 2019 12:32:25 +0100 Subject: [PATCH] Pass --sort=name to tar to make tarballs more reproducible and rsync-friendly --- live-build/auto/build | 8 ++++---- live-build/ubuntu-cpc/hooks.d/base/root-xz.binary | 2 +- live-build/ubuntu-cpc/hooks.d/base/vagrant.binary | 1 + live-build/ubuntu-cpc/hooks.d/base/vmdk-ova-image.binary | 1 + .../hooks/500-move-kernel-to-device-tar.binary | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/live-build/auto/build b/live-build/auto/build index 8f4cf05d..09447a1d 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -475,7 +475,7 @@ for ISO in binary.iso binary.hybrid.iso; do done if [ -e "binary/$INITFS/filesystem.dir" ]; then - (cd "binary/$INITFS/filesystem.dir/" && tar -c --xattrs *) | \ + (cd "binary/$INITFS/filesystem.dir/" && tar -c --sort=name --xattrs *) | \ gzip -9 --rsyncable > "$PREFIX.rootfs.tar.gz" chmod 644 "$PREFIX.rootfs.tar.gz" elif [ -e binary-tar.tar.gz ]; then @@ -512,7 +512,7 @@ EOF fi if [ "$PROJECT" = "ubuntu-touch" ] || [ "$PROJECT" = "ubuntu-touch-custom" ]; then - (cd "binary/$INITFS/custom.dir/" && tar -c --xattrs *) | \ + (cd "binary/$INITFS/custom.dir/" && tar -c --sort=name --xattrs *) | \ gzip -9 --rsyncable > "$PREFIX.custom.tar.gz" chmod 644 "$PREFIX.custom.tar.gz" fi @@ -649,7 +649,7 @@ case $PROJECT:${SUBPROJECT:-} in raspi2) # ubuntu-device-flash does not like subdirs here, we need to tar it up if [ -e $TMPDIR/assets/dtbs/overlays ]; then - tar -C $TMPDIR/assets/dtbs -f $TMPDIR/assets/dtbs/overlays.tgz -czv overlays + tar --sort=name -C $TMPDIR/assets/dtbs -f $TMPDIR/assets/dtbs/overlays.tgz -czv overlays rm -rf $TMPDIR/assets/dtbs/overlays fi ;; @@ -698,7 +698,7 @@ EOF manifestname="$devarch.$manifestname" fi # create tarfile - tar -c -z -f $HERE/$PREFIX.$tarname system assets hardware.yaml + tar -c --sort=name -z -f $HERE/$PREFIX.$tarname system assets hardware.yaml # create device specific manifest to track kernel dpkg version cp assets/dpkg.list $HERE/$PREFIX.$manifestname diff --git a/live-build/ubuntu-cpc/hooks.d/base/root-xz.binary b/live-build/ubuntu-cpc/hooks.d/base/root-xz.binary index 5695f96d..b23cd8d6 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/root-xz.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/root-xz.binary @@ -12,4 +12,4 @@ fi rootfs_dir=rootfs.dir cp $rootfs_dir.manifest livecd.ubuntu-cpc.rootfs.manifest -(cd $rootfs_dir/ && tar -c --xattrs *) | xz > livecd.ubuntu-cpc.rootfs.tar.xz +(cd $rootfs_dir/ && tar -c --sort=name --xattrs *) | xz > livecd.ubuntu-cpc.rootfs.tar.xz diff --git a/live-build/ubuntu-cpc/hooks.d/base/vagrant.binary b/live-build/ubuntu-cpc/hooks.d/base/vagrant.binary index d561d80f..b1b04553 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/vagrant.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/vagrant.binary @@ -227,6 +227,7 @@ OVA information: EOM tar -C ${box_d} \ + --sort=name \ -cf ${cur_d}/livecd.ubuntu-cpc.vagrant.box \ box.ovf \ Vagrantfile \ diff --git a/live-build/ubuntu-cpc/hooks.d/base/vmdk-ova-image.binary b/live-build/ubuntu-cpc/hooks.d/base/vmdk-ova-image.binary index f3414f71..f9bcfb18 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/vmdk-ova-image.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/vmdk-ova-image.binary @@ -104,6 +104,7 @@ OVA information: EOM tar -C ${scratch_d} \ + --sort=name \ -cf ${cur_d}/livecd.ubuntu-cpc.ova \ ${prefix}.ovf \ ${prefix}.mf \ diff --git a/live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary b/live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary index 33e70ab4..b32447de 100644 --- a/live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary +++ b/live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary @@ -62,7 +62,7 @@ fi # and tar it up ( cd $TMPDIR - tar -c -z -f $HERE/device.tar.gz system assets hardware.yaml + tar -c --sort=name -z -f $HERE/device.tar.gz system assets hardware.yaml ) rm -rf $TMPDIR