-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: override the locale when running bsdtar actions (#2044)
* fix: honor shell env on tar extract Allows users to override the locale, needed for tarballs with filenames not supported by the system locale * use lc_ctype * wip: add snowman test * fixup! use lc_ctype * chore: update generated file * update workspace snapshots * revert short->long form flag --------- Co-authored-by: Jason Bedard <[email protected]>
- Loading branch information
Showing
8 changed files
with
4,007 additions
and
3,664 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,7 @@ If set, takes precendance over the package version in the NpmPackageInfo src. | |
"verbose": attr.bool( | ||
doc = """If true, prints out verbose logs to stdout""", | ||
), | ||
"_macos_constraint": attr.label(default = "@platforms//os:macos"), | ||
} | ||
|
||
def _npm_package_store_impl(ctx): | ||
|
@@ -223,6 +224,7 @@ def _npm_package_store_impl(ctx): | |
# tar to strip one directory level. Some packages have directory permissions missing | ||
# executable which make the directories not listable ([email protected] for example). | ||
bsdtar = ctx.toolchains["@aspect_bazel_lib//lib:tar_toolchain_type"] | ||
is_macos = ctx.target_platform_has_constraint(ctx.attr._macos_constraint[platform_common.ConstraintValueInfo]) | ||
ctx.actions.run( | ||
executable = bsdtar.tarinfo.binary, | ||
inputs = depset(direct = [src], transitive = [bsdtar.default.files]), | ||
|
@@ -240,6 +242,16 @@ def _npm_package_store_impl(ctx): | |
], | ||
mnemonic = "NpmPackageExtract", | ||
progress_message = "Extracting npm package {}@{}".format(package, version), | ||
# Workaround https://github.com/bazelbuild/bazel-central-registry/issues/2256 | ||
# Always override the locale to give better hermeticity. | ||
# See https://github.com/bazelbuild/rules_java/blob/767e4410850453a10ccf89aa1cededf9de05c72e/toolchains/utf8_environment.bzl | ||
env = { | ||
"LC_CTYPE": | ||
# # macOS doesn't have the C.UTF-8 locale, but en_US.UTF-8 is available and works the same way. | ||
"en_US.UTF-8" if is_macos else | ||
# The default UTF-8 locale on all recent Linux distributions. It is also available in Cygwin and MSYS2. | ||
"C.UTF-8", | ||
}, | ||
) | ||
else: | ||
copy_directory_bin_action( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,9 @@ build_test( | |
# puppeteer: has a bin entry in the transitive closure with two segments: @puppeteer/browsers in https://unpkg.com/@puppeteer/[email protected]/package.json | ||
# segfault-handler: has a node-gyp install step | ||
":node_modules", | ||
|
||
# @fastify/send (@3.3.0) contains spaces and a ☃ character in paths | ||
":node_modules/@fastify/send", | ||
], | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3,689 changes: 1,858 additions & 1,831 deletions
3,689
npm/private/test/snapshots/bzlmod/npm_defs.bzl
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.