From 477fb8c931d455e2fa3d3e5f235c8414ee33c1d8 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:49:20 -0300 Subject: [PATCH] fluxcd: fix update script breakage caused by #341924 --- pkgs/by-name/fl/fluxcd/package.nix | 8 ++++---- pkgs/by-name/fl/fluxcd/update.sh | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkgs/by-name/fl/fluxcd/package.nix b/pkgs/by-name/fl/fluxcd/package.nix index 3e42a7c7763d3..89786cf45ea82 100644 --- a/pkgs/by-name/fl/fluxcd/package.nix +++ b/pkgs/by-name/fl/fluxcd/package.nix @@ -9,13 +9,13 @@ let version = "2.4.0"; - hash = "sha256-b4mu/iijfALBm+7OIdKgZs55fR6xWfPgL6OMOgIOi3w="; + srcHash = "sha256-b4mu/iijfALBm+7OIdKgZs55fR6xWfPgL6OMOgIOi3w="; vendorHash = "sha256-rVyirt6+D1qedbTvPZjLog16sMAq+zyFUmbjnJIieRg="; - manifestsSha256 = "sha256-85Ykc6B+DP9PVqwGbvqsQCUHpx/IzIP9TgOt3id7P5g="; + manifestsHash = "sha256-85Ykc6B+DP9PVqwGbvqsQCUHpx/IzIP9TgOt3id7P5g="; manifests = fetchzip { url = "https://github.com/fluxcd/flux2/releases/download/v${version}/manifests.tar.gz"; - hash = manifestsSha256; + hash = manifestsHash; stripRoot = false; }; in @@ -28,7 +28,7 @@ buildGoModule rec { owner = "fluxcd"; repo = "flux2"; rev = "v${version}"; - inherit hash; + hash = srcHash; }; postUnpack = '' diff --git a/pkgs/by-name/fl/fluxcd/update.sh b/pkgs/by-name/fl/fluxcd/update.sh index c8cc8901b9f10..bc229dd6c72eb 100755 --- a/pkgs/by-name/fl/fluxcd/update.sh +++ b/pkgs/by-name/fl/fluxcd/update.sh @@ -11,23 +11,23 @@ LATEST_TAG=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} --silent https://api LATEST_VERSION=$(echo "${LATEST_TAG}" | sed 's/^v//') if [ ! "$OLD_VERSION" = "$LATEST_VERSION" ]; then - SHA256=$(nix-prefetch-url --quiet --unpack "https://github.com/fluxcd/flux2/archive/refs/tags/${LATEST_TAG}.tar.gz") - SHA256=$(nix hash convert --hash-algo sha256 --to sri "$SHA256") - SPEC_SHA256=$(nix-prefetch-url --quiet --unpack "https://github.com/fluxcd/flux2/releases/download/${LATEST_TAG}/manifests.tar.gz") - SPEC_SHA256=$(nix hash convert --hash-algo sha256 --to sri "$SPEC_SHA256") + SRC_SHA256=$(nix-prefetch-url --quiet --unpack "https://github.com/fluxcd/flux2/archive/refs/tags/${LATEST_TAG}.tar.gz") + SRC_HASH=$(nix hash convert --hash-algo sha256 --to sri "$SRC_SHA256") + MANIFESTS_SHA256=$(nix-prefetch-url --quiet --unpack "https://github.com/fluxcd/flux2/releases/download/${LATEST_TAG}/manifests.tar.gz") + MANIFESTS_HASH=$(nix hash convert --hash-algo sha256 --to sri "$MANIFESTS_SHA256") setKV () { sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" "${FLUXCD_PATH}/package.nix" } setKV version "${LATEST_VERSION}" - setKV sha256 "${SHA256}" - setKV manifestsSha256 "${SPEC_SHA256}" + setKV srcHash "${SRC_HASH}" + setKV manifestsHash "${MANIFESTS_HASH}" setKV vendorHash "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" # The same as lib.fakeHash set +e - VENDOR_HASH=$(nix-build --no-out-link -A fluxcd "$NIXPKGS_PATH" 2>&1 >/dev/null | grep "got:" | cut -d':' -f2 | sed 's| ||g') - VENDOR_HASH=$(nix hash convert --hash-algo sha256 --to sri "$VENDOR_HASH") + VENDOR_SHA256=$(nix-build --no-out-link -A fluxcd "$NIXPKGS_PATH" 2>&1 >/dev/null | grep "got:" | cut -d':' -f2 | sed 's| ||g') + VENDOR_HASH=$(nix hash convert --hash-algo sha256 --to sri "$VENDOR_SHA256") set -e if [ -n "${VENDOR_HASH:-}" ]; then