tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
bazel_7: cleanup changes made to common patches
Guillaume Maudoux
2 years ago
90bfff13
5151e14e
+28
-28
1 changed file
expand all
collapse all
unified
split
pkgs
development
tools
build-managers
bazel
nix-hacks.patch
+28
-28
pkgs/development/tools/build-managers/bazel/nix-hacks.patch
···
1
1
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
2
2
-
index 845c8b6aa3..3a46235fcd 100644
2
2
+
index 8e772005cd..6ffa1c919c 100644
3
3
--- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
4
4
+++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
5
5
-
@@ -171,14 +171,8 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
6
6
-
7
7
-
DigestWriter digestWriter = new DigestWriter(directories, repositoryName, rule);
8
8
-
if (shouldUseCachedRepos(env, handler, repoRoot, rule)) {
9
9
-
- // Make sure marker file is up-to-date; correctly describes the current repository state
10
10
-
- byte[] markerHash = digestWriter.areRepositoryAndMarkerFileConsistent(handler, env);
11
11
-
- if (env.valuesMissing()) {
12
12
-
- return null;
13
13
-
- }
14
14
-
- if (markerHash != null) {
15
15
-
- return RepositoryDirectoryValue.builder().setPath(repoRoot).setDigest(markerHash).build();
16
16
-
- }
17
17
-
+ // Nix hack: Always consider cached dirs up-to-date
18
18
-
+ return RepositoryDirectoryValue.builder().setPath(repoRoot).setDigest(digestWriter.writeMarkerFile()).build();
19
19
-
}
20
20
-
21
21
-
/* At this point: This is a force fetch, a local repository, OR The repository cache is old or
22
22
-
@@ -513,7 +507,8 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
23
23
-
}
24
24
-
String content = builder.toString();
5
5
+
@@ -432,25 +432,7 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
6
6
+
String content;
25
7
try {
26
26
-
- FileSystemUtils.writeContent(markerPath, UTF_8, content);
27
27
-
+ // Nix hack: Do not write these pesky marker files
28
28
-
+ // FileSystemUtils.writeContent(markerPath, UTF_8, content);
8
8
+
content = FileSystemUtils.readContent(markerPath, StandardCharsets.UTF_8);
9
9
+
- String markerRuleKey = readMarkerFile(content, markerData);
10
10
+
- boolean verified = false;
11
11
+
- if (Preconditions.checkNotNull(ruleKey).equals(markerRuleKey)
12
12
+
- && Objects.equals(
13
13
+
- markerData.get(MANAGED_DIRECTORIES_MARKER),
14
14
+
- this.markerData.get(MANAGED_DIRECTORIES_MARKER))) {
15
15
+
- verified = handler.verifyMarkerData(rule, markerData, env);
16
16
+
- if (env.valuesMissing()) {
17
17
+
- return null;
18
18
+
- }
19
19
+
- }
20
20
+
-
21
21
+
- if (verified) {
22
22
+
- return new Fingerprint().addString(content).digestAndReset();
23
23
+
- } else {
24
24
+
- // So that we are in a consistent state if something happens while fetching the repository
25
25
+
- markerPath.delete();
26
26
+
- return null;
27
27
+
- }
28
28
+
+ return new Fingerprint().addString(content).digestAndReset();
29
29
} catch (IOException e) {
30
30
throw new RepositoryFunctionException(e, Transience.TRANSIENT);
31
31
}
32
32
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
33
33
-
index 649647c5f2..64d05b530c 100644
33
33
+
index c282d57ab6..f9b0c08627 100644
34
34
--- a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
35
35
+++ b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
36
36
-
@@ -165,7 +165,6 @@ public class JavaSubprocessFactory implements SubprocessFactory {
37
37
-
}
38
38
-
builder.command(argv);
36
36
+
@@ -146,7 +146,6 @@ public class JavaSubprocessFactory implements SubprocessFactory {
37
37
+
ProcessBuilder builder = new ProcessBuilder();
38
38
+
builder.command(params.getArgv());
39
39
if (params.getEnv() != null) {
40
40
- builder.environment().clear();
41
41
builder.environment().putAll(params.getEnv());