nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 55 lines 1.9 kB view raw
1# Verify that the Xcode project has not changed unexpectedly. This is only useful for source releases that are 2# being built with other build systems (e.g., Meson) instead of xcbuild. 3 4verifyXcodeProjectHash() { 5 printHashInstructions() { 6 echo '1. Set xcodeHash to an empty string: `xcodeHash = "";`' 7 echo '2. Build the derivation and wait for it to fail with a hash mismatch' 8 echo '3. Copy the "got: sha256-..." value back into the xcodeHash field' 9 echo ' You should have: xcodeHash = "sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=";' 10 } 11 12 if [ -z "${xcodeHash-}" ]; then 13 echo "error: xcodeHash missing" 14 echo 15 echo "To fix the issue:" 16 printHashInstructions 17 exit 1 18 fi 19 20 if [ -z "${xcodeProject-}" ]; then 21 echo "error: xcodeProject missing" 22 echo 23 echo "To fix the issue: Set xcodeProject to the name of the project" 24 exit 1 25 fi 26 27 local xcodeHashArr 28 readarray -t -d - xcodeHashArr < <(printf "$xcodeHash") 29 30 local hashType=${xcodeHashArr[0]} 31 local expectedHash=${xcodeHashArr[1]} 32 33 if [ -z "$hashType" ] || [ -z "$expectedHash" ]; then 34 echo "error: xcodeHash is in invalid format" 35 echo 36 echo "To fix the issue:" 37 printHashInstructions 38 exit 1 39 fi 40 41 local hash 42 hash=$(openssl "$hashType" -binary "$sourceRoot/$xcodeProject/project.pbxproj" | base64) 43 44 if [ "$hash" != "$expectedHash" ]; then 45 echo "error: hash mismatch in $xcodeProject/project.pbxproj" 46 echo " specified: $xcodeHash" 47 echo " got: $hashType-$hash" 48 echo 49 echo 'Upstream Xcode project has changed. Update `meson.build` with any changes, then update `xcodeHash`.' 50 printHashInstructions 51 exit 1 52 fi 53} 54 55postUnpackHooks+=(verifyXcodeProjectHash)