summaryrefslogtreecommitdiff
path: root/src/librefetch/librefetch
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/librefetch/librefetch
parent9aa40b5189c5324e3d83cf78c78dca92dfda842d (diff)
librefetch: Make the order of files in a tarball deterministic
Diffstat (limited to 'src/librefetch/librefetch')
-rwxr-xr-xsrc/librefetch/librefetch6
1 files changed, 5 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
}