Files
nixpkgs/pkgs/os-specific/darwin/xcode-project-check-hook/setup-hook.sh
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

56 lines
1.8 KiB
Bash

# Verify that the Xcode project has not changed unexpectedly. This is only useful for source releases that are
# being built with other build systems (e.g., Meson) instead of xcbuild.
verifyXcodeProjectHash() {
printHashInstructions() {
echo '1. Set xcodeHash to an empty string: `xcodeHash = "";`'
echo '2. Build the derivation and wait for it to fail with a hash mismatch'
echo '3. Copy the "got: sha256-..." value back into the xcodeHash field'
echo ' You should have: xcodeHash = "sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=";'
}
if [ -z "${xcodeHash-}" ]; then
echo "error: xcodeHash missing"
echo
echo "To fix the issue:"
printHashInstructions
exit 1
fi
if [ -z "${xcodeProject-}" ]; then
echo "error: xcodeProject missing"
echo
echo "To fix the issue: Set xcodeProject to the name of the project"
exit 1
fi
local xcodeHashArr
readarray -t -d - xcodeHashArr < <(printf "$xcodeHash")
local hashType=${xcodeHashArr[0]}
local expectedHash=${xcodeHashArr[1]}
if [ -z "$hashType" ] || [ -z "$expectedHash" ]; then
echo "error: xcodeHash is in invalid format"
echo
echo "To fix the issue:"
printHashInstructions
exit 1
fi
local hash
hash=$(openssl "$hashType" -binary "$sourceRoot/$xcodeProject/project.pbxproj" | base64)
if [ "$hash" != "$expectedHash" ]; then
echo "error: hash mismatch in $xcodeProject/project.pbxproj"
echo " specified: $xcodeHash"
echo " got: $hashType-$hash"
echo
echo 'Upstream Xcode project has changed. Update `meson.build` with any changes, then update `xcodeHash`.'
printHashInstructions
exit 1
fi
}
postUnpackHooks+=(verifyXcodeProjectHash)