summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-05-10 21:57:34 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-05-11 01:41:49 -0400
commitb0b4a603d24d905d757df39ec2e90f46403cdd32 (patch)
treeaef132d756f401047c45e663c9541052e9e7c5fc /src
parent9aa40b5189c5324e3d83cf78c78dca92dfda842d (diff)
librefetch: Make the order of files in a tarball deterministic
Diffstat (limited to 'src')
-rwxr-xr-xsrc/librefetch/librefetch6
-rw-r--r--src/librefetch/librefetch.8.ronn3
2 files changed, 8 insertions, 1 deletions
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.