-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistent PATH between ctx.actions.run and ctx.actions.run_shell #146389
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0cff50f
bazel_4: add default PATH for local actions if it is not set.
ylecornec be9385c
bazel_4: remove customBash script
ylecornec 2aea3eb
bazel_4: add which binary to test buildInputs
ylecornec b147f21
bazel_4: add default PATH for local actions if it is not set (darwin)
ylecornec b55758e
bazel_4: make some tests more verbose to help debugging
ylecornec ee62812
bazel_4: add default tools to buildInputs (to be accessible from repo…
ylecornec cd842a9
bazel_4: remove duplicated python paths from the nix-support/depends …
ylecornec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
pkgs/development/tools/build-managers/bazel/bazel_4/actions_path.patch
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
diff --git a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java | ||
index 6fff2af..7e2877e 100644 | ||
--- a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java | ||
+++ b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java | ||
@@ -47,6 +47,16 @@ public final class PosixLocalEnvProvider implements LocalEnvProvider { | ||
Map<String, String> env, BinTools binTools, String fallbackTmpDir) { | ||
ImmutableMap.Builder<String, String> result = ImmutableMap.builder(); | ||
result.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR"))); | ||
+ | ||
+ // In case we are running on NixOS. | ||
+ // If bash is called with an unset PATH on this platform, | ||
+ // it will set it to /no-such-path and default tools will be missings. | ||
+ // See, https://github.com/NixOS/nixpkgs/issues/94222 | ||
+ // So we ensure that minimal dependencies are present. | ||
+ if (!env.containsKey("PATH")){ | ||
+ result.put("PATH", "@actionsPathPatch@"); | ||
+ } | ||
+ | ||
String p = clientEnv.get("TMPDIR"); | ||
if (Strings.isNullOrEmpty(p)) { | ||
// Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR | ||
index 95642767c6..39d3c62461 100644 | ||
--- a/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java | ||
+++ b/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java | ||
@@ -74,6 +74,16 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider { | ||
|
||
ImmutableMap.Builder<String, String> newEnvBuilder = ImmutableMap.builder(); | ||
newEnvBuilder.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR"))); | ||
+ | ||
+ // In case we are running on NixOS. | ||
+ // If bash is called with an unset PATH on this platform, | ||
+ // it will set it to /no-such-path and default tools will be missings. | ||
+ // See, https://github.com/NixOS/nixpkgs/issues/94222 | ||
+ // So we ensure that minimal dependencies are present. | ||
+ if (!env.containsKey("PATH")){ | ||
+ newEnvBuilder.put("PATH", "@actionsPathPatch@"); | ||
+ } | ||
+ | ||
String p = clientEnv.get("TMPDIR"); | ||
if (Strings.isNullOrEmpty(p)) { | ||
// Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifying
python27
andpython3
isn't necessary anymore since they're part ofdefaultShellPath
.