llvmPackages: Fix the update script

This commit is contained in:
Michael Weiss 2022-03-13 13:33:21 +01:00
parent e7eaee7da8
commit 90d9b7c8dc
No known key found for this signature in database
GPG key ID: 5BE487C4D4771D83
2 changed files with 9 additions and 2 deletions

View file

@ -209,6 +209,9 @@ in stdenv.mkDerivation (rec {
checkTarget = "check-all";
# For the update script:
passthru.monorepoSrc = monorepoSrc;
requiredSystemFeatures = [ "big-parallel" ];
meta = llvm_meta // {
homepage = "https://llvm.org/";

View file

@ -20,7 +20,11 @@ sed -Ei \
readonly ATTRSET="llvmPackages_$VERSION_MAJOR"
if [ "$VERSION_MAJOR" -ge "13" ]; then
if [ "$VERSION_MAJOR" -ge "14" ]; then
readonly SOURCES=(
"llvm.monorepoSrc"
)
elif [ "$VERSION_MAJOR" -eq "13" ]; then
readonly SOURCES=(
"llvm.src"
)
@ -43,7 +47,7 @@ fi
for SOURCE in "${SOURCES[@]}"; do
echo "Updating the hash of $SOURCE:"
declare ATTR="$ATTRSET.$SOURCE"
declare OLD_HASH="$(nix eval -f . $ATTR.outputHash)"
declare OLD_HASH="$(nix --extra-experimental-features nix-command eval -f . $ATTR.outputHash)"
declare NEW_HASH="\"$(nix-prefetch-url -A $ATTR)\""
find "$DIR" -type f -exec sed -i "s/$OLD_HASH/$NEW_HASH/" {} +
done