bazel: squash timestamps with find -exec touch.

This should work on OSX too. Use `tar -h` for creating the tarball, so
we don't try to touch the read-only filesystem on sandboxed linux.

Change-Id: Idab829112cfdb1a5378bc7cfe614cadfe7b723fc
This commit is contained in:
Han-Wen Nienhuys
2016-11-12 16:36:36 -08:00
parent 559fb084b3
commit d9f9490825

View File

@@ -87,9 +87,10 @@ genrule2(
outs = [ "pg_code.zip", ], outs = [ "pg_code.zip", ],
srcs = [ ":pg_code" ], srcs = [ ":pg_code" ],
cmd = " && ".join([ cmd = " && ".join([
("tar -cf- --mtime=1980-01-01\\ 00:00 $(locations :pg_code) |" ("tar -hcf- $(locations :pg_code) |"
+ " tar --strip-components=2 -C $$TMP/ -xf-"), + " tar --strip-components=2 -C $$TMP/ -xf-"),
"cd $$TMP", "cd $$TMP",
"find . -exec touch -t 198001010000 '{}' ';'",
"zip -rq $$ROOT/$@ *"]) "zip -rq $$ROOT/$@ *"])
) )