about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/build-managers/bazel/bazel_7/nix-hacks.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/build-managers/bazel/bazel_7/nix-hacks.patch')
-rw-r--r--nixpkgs/pkgs/development/tools/build-managers/bazel/bazel_7/nix-hacks.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/build-managers/bazel/bazel_7/nix-hacks.patch b/nixpkgs/pkgs/development/tools/build-managers/bazel/bazel_7/nix-hacks.patch
new file mode 100644
index 000000000000..3c3fc57e0fc0
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/build-managers/bazel/bazel_7/nix-hacks.patch
@@ -0,0 +1,51 @@
+diff --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
+index 845c8b6aa3..6f07298bd0 100644
+--- 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
+@@ -171,14 +171,8 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
+ 
+     DigestWriter digestWriter = new DigestWriter(directories, repositoryName, rule);
+     if (shouldUseCachedRepos(env, handler, repoRoot, rule)) {
+-      // Make sure marker file is up-to-date; correctly describes the current repository state
+-      byte[] markerHash = digestWriter.areRepositoryAndMarkerFileConsistent(handler, env);
+-      if (env.valuesMissing()) {
+-        return null;
+-      }
+-      if (markerHash != null) {
+-        return RepositoryDirectoryValue.builder().setPath(repoRoot).setDigest(markerHash).build();
+-      }
++      // Nix hack: Always consider cached dirs as up-to-date
++      return RepositoryDirectoryValue.builder().setPath(repoRoot).setDigest(digestWriter.writeMarkerFile()).build();
+     }
+ 
+     /* At this point: This is a force fetch, a local repository, OR The repository cache is old or
+@@ -512,11 +506,12 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
+         builder.append(escape(key)).append(" ").append(escape(value)).append("\n");
+       }
+       String content = builder.toString();
+-      try {
+-        FileSystemUtils.writeContent(markerPath, UTF_8, content);
+-      } catch (IOException e) {
+-        throw new RepositoryFunctionException(e, Transience.TRANSIENT);
+-      }
++      // Nix hack: Do not write these pesky marker files
++      //try {
++      //  FileSystemUtils.writeContent(markerPath, UTF_8, content);
++      //} catch (IOException e) {
++      //  throw new RepositoryFunctionException(e, Transience.TRANSIENT);
++      //}
+       return new Fingerprint().addString(content).digestAndReset();
+     }
+ 
+diff --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
+index 649647c5f2..64d05b530c 100644
+--- a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
++++ b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
+@@ -165,7 +165,6 @@ public class JavaSubprocessFactory implements SubprocessFactory {
+     }
+     builder.command(argv);
+     if (params.getEnv() != null) {
+-      builder.environment().clear();
+       builder.environment().putAll(params.getEnv());
+     }
+