google-cloud-sdk: fix build determinism (#454750)

This commit is contained in:
Sandro
2025-10-23 15:38:28 +00:00
committed by GitHub
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -87,6 +87,9 @@ stdenv.mkDerivation rec {
./gsutil-disable-updates.patch
];
# Prevent Python from writing bytecode to ensure build determinism
PYTHONDONTWRITEBYTECODE = "1";
installPhase = ''
runHook preInstall
@@ -161,8 +164,6 @@ stdenv.mkDerivation rec {
installCheckPhase = ''
# Avoid trying to write logs to homeless-shelter
export HOME=$(mktemp -d)
# Prevent Python from writing bytecode to ensure build determinism
export PYTHONDONTWRITEBYTECODE=1
$out/bin/gcloud version --format json | jq '."Google Cloud SDK"' | grep "${version}"
$out/bin/gsutil version | grep -w "$(cat platform/gsutil/VERSION)"
'';
@@ -78,11 +78,12 @@ symlinkJoin {
]
++ comps;
# Prevent Python from writing bytecode to ensure build determinism
PYTHONDONTWRITEBYTECODE = "1";
postBuild = ''
sed -i ';' $out/google-cloud-sdk/bin/.gcloud-wrapped
sed -i -e "s#${google-cloud-sdk}#$out#" "$out/google-cloud-sdk/bin/gcloud"
# Prevent Python from writing bytecode to ensure build determinism
export PYTHONDONTWRITEBYTECODE=1
${installCheck}
'';
}