summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-science/packages/bazel.scm5
-rw-r--r--patches/bazel-recreate-markers.patch45
2 files changed, 48 insertions, 2 deletions
diff --git a/guix-science/packages/bazel.scm b/guix-science/packages/bazel.scm
index 7fb13b2..e7c3a96 100644
--- a/guix-science/packages/bazel.scm
+++ b/guix-science/packages/bazel.scm
@@ -1,4 +1,4 @@
1;;; Copyright © 2023 Ricardo Wurmus <rekado@elephly.net> 1;;; Copyright © 2023, 2024 Ricardo Wurmus <rekado@elephly.net>
2;;; 2;;;
3;;; This program is free software; you can redistribute it and/or modify it 3;;; This program is free software; you can redistribute it and/or modify it
4;;; under the terms of the GNU General Public License as published by 4;;; under the terms of the GNU General Public License as published by
@@ -88,7 +88,8 @@
88 "0j190j7vjknlw1cgynb3r8vlv0j6i9lac6s5payf4fqrb2ngxmwc")) 88 "0j190j7vjknlw1cgynb3r8vlv0j6i9lac6s5payf4fqrb2ngxmwc"))
89 (patches 89 (patches
90 (search-patches "patches/bazel-mock-repos.patch" 90 (search-patches "patches/bazel-mock-repos.patch"
91 "patches/bazel-workspace.patch")) 91 "patches/bazel-workspace.patch"
92 "patches/bazel-recreate-markers.patch"))
92 ;; This is just a start. There are so many more jars. 93 ;; This is just a start. There are so many more jars.
93 (snippet 94 (snippet
94 '(for-each delete-file 95 '(for-each delete-file
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