Skip to content

Commit c41a3da

Browse files
committed
envoy: drop unused jdk blobs from deps tarball
1 parent c0ccbf9 commit c41a3da

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

pkgs/by-name/en/envoy/package.nix

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ let
4949
depsHash
5050
else
5151
{
52-
x86_64-linux = "sha256-AqXGk6IZ85TFNO7v8KFJOe8Caf1x4xQh/VuhaUq9rB4=";
53-
aarch64-linux = "sha256-l70j1UcVNHGrzzvcqdeLDJUuaLkoLNM2yWCHKY4EShs=";
52+
x86_64-linux = "sha256-cUpCkmJmFyd2mTImMKt5Cgi+A4bAWAXLYjJjMnV6haQ=";
53+
aarch64-linux = "sha256-f1FbdFDunlF7uhCpkb5AqmKN5uimuKnFYBzXjIcRabk=";
5454
}
5555
.${stdenv.system} or (throw "unsupported system ${stdenv.system}");
5656

@@ -173,6 +173,44 @@ buildBazelPackage rec {
173173
rm -r $bazelOut/external/local_jdk
174174
rm -r $bazelOut/external/bazel_gazelle_go_repository_tools/bin
175175
176+
# Drop prebuilt JDK toolchains and non-Linux java tool bundles; we force @local_jdk anyway.
177+
shopt -s nullglob
178+
rm -rf $bazelOut/external/remotejdk*
179+
for dir in $bazelOut/external/remote_java_tools*; do
180+
base=$(basename "$dir")
181+
if [[ "$base" != remote_java_tools_linux ]]; then
182+
rm -rf "$dir"
183+
fi
184+
done
185+
rm -rf $bazelOut/external/android_tools $bazelOut/external/android_gmaven_r8
186+
find $bazelOut/external/repository_cache -maxdepth 1 -type f \
187+
\( -iname '*remotejdk*' -o -iname '*remote_java_tools*' -o -iname '*android*' \) -delete
188+
189+
# Prune repository_cache entries for unused remote JDK/tool bundles.
190+
keep_patterns=()
191+
case ${stdenv.hostPlatform.system} in
192+
x86_64-linux)
193+
keep_patterns+=("remotejdk8_linux" "remotejdk11_linux" "remotejdk17_linux" "remotejdk21_linux" "remote_java_tools_linux")
194+
;;
195+
aarch64-linux)
196+
keep_patterns+=("remotejdk8_linux_aarch64" "remotejdk11_linux_aarch64" "remotejdk17_linux_aarch64" "remotejdk21_linux_aarch64" "remote_java_tools_linux")
197+
;;
198+
esac
199+
200+
find $bazelOut/external/repository_cache -type f \( -iname '*remotejdk*' -o -iname '*remote_java_tools*' -o -iname '*android*' \) | while read f; do
201+
keep=false
202+
for pat in $keep_patterns; do
203+
if [[ $(basename "$f") == *"$pat"* ]]; then
204+
keep=true
205+
break
206+
fi
207+
done
208+
if ! $keep; then
209+
rm -f "$f"
210+
fi
211+
done
212+
shopt -u nullglob
213+
176214
# CMake 4.1 drops compatibility with <3.5; bump libevent's floor to avoid configure failure.
177215
sed -i 's/cmake_minimum_required(VERSION 3\\.1.2 FATAL_ERROR)/cmake_minimum_required(VERSION 3.5 FATAL_ERROR)/' \
178216
$bazelOut/external/com_github_libevent_libevent/CMakeLists.txt

0 commit comments

Comments
 (0)