From b0b4a603d24d905d757df39ec2e90f46403cdd32 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 10 May 2014 21:57:34 -0400 Subject: librefetch: Make the order of files in a tarball deterministic --- src/librefetch/librefetch | 6 +++++- src/librefetch/librefetch.8.ronn | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 49159f5..d0bbf1b 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -259,7 +259,11 @@ makepkg_modify=' /create_package\(\) \{/,/^\}$/ { /pkg_file=/d # allow us to set pkg_file s/"?\$\{comp_files\[@\]\}"?// # do not include .{PKGINFO,INSTALL,CHANGELOG} - s/bsdtar /&--format=ustar / # ustar, not pax + # This is long/gross. What it does: + # - pass --format=ustar to bsdtar, to inhibit it using the pax format + # - take the files that would be included in the tarball, and use + # find/sort/xargs to order them before passing them to bsdtar + s/bsdtar(.*) - ([^|]*) \|/find \2 -print0 | LC_ALL=C sort --zero-terminated | xargs -0 bsdtar --format=ustar --no-recursion \1 - |/ s/create_signature .*/&; return $?/ # do not procede to create symlinks } diff --git a/src/librefetch/librefetch.8.ronn b/src/librefetch/librefetch.8.ronn index 7d2dfb3..3b51fb4 100644 --- a/src/librefetch/librefetch.8.ronn +++ b/src/librefetch/librefetch.8.ronn @@ -173,6 +173,9 @@ The following modifications are made to makepkg: * Timestamps in `$pkgdir` are reset to "1990-01-01 0:0:0 +0", so that the resulting tarball will be the same, regardless of when it was created. + * Sort the files included in the tarball; normally the order of files + in a tarball is essentially random (even if it tends to be the same + when re-created on the same machine). * append `-libre` to `$srcdir` * append `-libre` to `$pkgbasedir` (which becomes `$pkgdir`) * Don't check if the package has already been built. -- cgit v1.2.2