Skip to content

Commit 7da9e26

Browse files
authored
bazel/website: Prefer gtar over tar to fix macos build (#2552)
Signed-off-by: Ryan Northey <[email protected]>
1 parent 67e5954 commit 7da9e26

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

bazel/website/macros.bzl

+9-2
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,22 @@ def static_website(
9090
EXCLUDES="%s"
9191
%s
9292
93-
tar "$${DECOMPRESS_ARGS}" -xf $$SOURCE
93+
# prefer gtar over tar and unbreak macs
94+
if command -v gtar >/dev/null 2>&1; then
95+
TAR_COMMAND=$$(which gtar)
96+
else
97+
TAR_COMMAND=$$(which tar)
98+
fi
99+
100+
$$TAR_COMMAND -xf $$SOURCE "$${DECOMPRESS_ARGS}"
94101
95102
while IFS= read -r CMD; do
96103
$$CMD
97104
done <<< "$$MAPPING"
98105
99106
$$GENERATOR "$$CONTENT"
100107
101-
tar cfh $@ $$EXCLUDES -C "$$OUTPUT" .
108+
$$TAR_COMMAND cfh $@ $$EXCLUDES -C "$$OUTPUT" .
102109
""" % (name_sources, decompressor_args, generator, content_path, output_path, mapping_commands, exclude_args, url),
103110
outs = [name_website_tarball],
104111
srcs = extra_srcs,

0 commit comments

Comments
 (0)