bazel_7/nix-hacks.patch: make it apply

(cherry picked from commit c499a0d6cd)
This commit is contained in:
Dmitry Ivankov 2024-11-17 12:10:36 +01:00 committed by github-actions[bot]
parent 7d71c28a89
commit f1bfce6034

View File

@ -1,10 +1,18 @@
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 4d8c46f8d5..ed311226f0 100644
index 53e6494656..22261cd268 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
@@ -178,18 +178,8 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
}
@@ -55,6 +55,7 @@ import com.google.devtools.build.skyframe.SkyFunctionException.Transience;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import java.io.IOException;
+import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
@@ -193,16 +194,11 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
}
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);
@ -12,35 +20,18 @@ index 4d8c46f8d5..ed311226f0 100644
- return null;
- }
- if (markerHash != null) { // repo exist & up-to-date
- return RepositoryDirectoryValue.builder()
- .setPath(repoRoot)
+ {
+ // Nix hack: Always consider cached dirs as up-to-date
return RepositoryDirectoryValue.builder()
.setPath(repoRoot)
- .setDigest(markerHash)
- .setExcludeFromVendoring(shouldExcludeRepoFromVendoring(handler, rule))
- .build();
- }
+ // Nix hack: Always consider cached dirs as up-to-date
+ return RepositoryDirectoryValue.builder().setPath(repoRoot).setDigest(digestWriter.writeMarkerFile()).build();
- .setExcludeFromVendoring(excludeRepoFromVendoring)
+ .setDigest(digestWriter.writeMarkerFile(Collections.emptyMap()))
.build();
}
}
/* At this point: This is a force fetch, a local repository, OR The repository cache is old or
@@ -610,11 +600,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