Austin Schuh | 8f99c82 | 2024-05-05 22:43:40 -0700 | [diff] [blame] | 1 | diff --git a/npm/private/npm_package_store.bzl b/npm/private/npm_package_store.bzl |
| 2 | index 9ab33e56..46446bd9 100644 |
| 3 | --- a/npm/private/npm_package_store.bzl |
| 4 | +++ b/npm/private/npm_package_store.bzl |
| 5 | @@ -198,23 +198,14 @@ def _npm_package_store_impl(ctx): |
| 6 | if utils.is_tarball_extension(src_directory.extension): |
| 7 | # npm packages are always published with one top-level directory inside the tarball, tho the name is not predictable |
| 8 | # we can use the --strip-components 1 argument with tar to strip one directory level |
| 9 | - args = ctx.actions.args() |
| 10 | - args.add("--extract") |
| 11 | - args.add("--no-same-owner") |
| 12 | - args.add("--no-same-permissions") |
| 13 | - args.add("--strip-components") |
| 14 | - args.add(str(1)) |
| 15 | - args.add("--file") |
| 16 | - args.add(src_directory.path) |
| 17 | - args.add("--directory") |
| 18 | - args.add(virtual_store_directory.path) |
| 19 | - |
| 20 | bsdtar = ctx.toolchains["@aspect_bazel_lib//lib:tar_toolchain_type"] |
| 21 | - ctx.actions.run( |
| 22 | - executable = bsdtar.tarinfo.binary, |
| 23 | + ctx.actions.run_shell( |
| 24 | + tools = [bsdtar.tarinfo.binary], |
| 25 | inputs = depset(direct = [src_directory], transitive = [bsdtar.default.files]), |
| 26 | outputs = [virtual_store_directory], |
| 27 | - arguments = [args], |
| 28 | + command = bsdtar.tarinfo.binary.path + " --extract --no-same-owner --no-same-permissions --strip-components 1 --file " + |
| 29 | + src_directory.path + " --directory " + |
| 30 | + virtual_store_directory.path + " && find " + virtual_store_directory.path + " -type d -exec chmod 755 {} \\;", |
| 31 | mnemonic = "NpmPackageExtract", |
| 32 | progress_message = "Extracting npm package {}@{}".format(package, version), |
| 33 | ) |