summaryrefslogtreecommitdiff
path: root/patches/bazel-recreate-markers.patch
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2024-01-12 23:01:40 +0100
committerRicardo Wurmus <rekado@elephly.net>2024-01-12 23:01:40 +0100
commite11e283cc76bd62587b1ebef73317413ead699a0 (patch)
tree0972dc7f2cb9786bf0d5591b7c671c3eca7ac907 /patches/bazel-recreate-markers.patch
parent792477d8539a058ee919791c3b9c8d12e3f9a2b3 (diff)
bazel: bazel-6: Add patch.
* patches/bazel-recreate-markers.patch: New file. * guix-science/packages/bazel.scm (bazel-6)[source]: Add patch.
Diffstat (limited to 'patches/bazel-recreate-markers.patch')
-rw-r--r--patches/bazel-recreate-markers.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/patches/bazel-recreate-markers.patch b/patches/bazel-recreate-markers.patch
new file mode 100644
index 0000000..8c64d8f
--- /dev/null
+++ b/patches/bazel-recreate-markers.patch
@@ -0,0 +1,45 @@
1This patch was taken from Nixpkgs. It forces Bazel to recreate a
2repository marker's hash instead of aborting. This allows us to
3bundle all inputs in advance and modify them as needed without having
4to worry about Bazel rejecting the bundled repositories.
5
6diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
7index 25fbdcac9d..49616d37df 100644
8--- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
9+++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
10@@ -568,22 +568,7 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
11 String content;
12 try {
13 content = FileSystemUtils.readContent(markerPath, StandardCharsets.UTF_8);
14- String markerRuleKey = readMarkerFile(content, markerData);
15- boolean verified = false;
16- if (Preconditions.checkNotNull(ruleKey).equals(markerRuleKey)) {
17- verified = handler.verifyMarkerData(rule, markerData, env);
18- if (env.valuesMissing()) {
19- return null;
20- }
21- }
22-
23- if (verified) {
24- return new Fingerprint().addString(content).digestAndReset();
25- } else {
26- // So that we are in a consistent state if something happens while fetching the repository
27- markerPath.delete();
28- return null;
29- }
30+ return new Fingerprint().addString(content).digestAndReset();
31 } catch (IOException e) {
32 throw new RepositoryFunctionException(e, Transience.TRANSIENT);
33 }
34diff --git a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
35index 1a45b8a3a2..a6b73213f6 100644
36--- a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
37+++ b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
38@@ -152,7 +152,6 @@ public class JavaSubprocessFactory implements SubprocessFactory {
39 ProcessBuilder builder = new ProcessBuilder();
40 builder.command(params.getArgv());
41 if (params.getEnv() != null) {
42- builder.environment().clear();
43 builder.environment().putAll(params.getEnv());
44 }
45