diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2024-06-09 19:46:03 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2024-06-09 20:33:23 +0200 |
commit | 0421c816badf8502a3abd6a82573b8d147690a44 (patch) | |
tree | e1286259aedb05a82fb170dbf955a9466960e957 /pkgs/applications | |
parent | 4627e4849e6df96d1b18b14144d39256e606387e (diff) |
treewide: Simplify use of update-source-version
- `--ignore-same-version` allows us to not call it twice. - with that, we can also omit version, to allow us updating e.g. `cargoDeps` hash
Diffstat (limited to 'pkgs/applications')
12 files changed, 17 insertions, 45 deletions
diff --git a/pkgs/applications/audio/reaper/updater.sh b/pkgs/applications/audio/reaper/updater.sh index 31832f7173c66..ef070c38aa229 100755 --- a/pkgs/applications/audio/reaper/updater.sh +++ b/pkgs/applications/audio/reaper/updater.sh @@ -9,18 +9,14 @@ function set_hash_for_linux() { local arch=$1 pkg_hash=$(nix-prefetch-url https://www.reaper.fm/files/${reaper_ver%.*}.x/reaper${reaper_ver/./}_linux_$arch.tar.xz) pkg_hash=$(nix hash to-sri "sha256:$pkg_hash") - # reset the version so the second architecture update doesn't get ignored - update-source-version reaper 0 "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" --system=$arch-linux - update-source-version reaper "${reaper_ver}" "$pkg_hash" --system=$arch-linux + update-source-version reaper "${reaper_ver}" "$pkg_hash" --system=$arch-linux --ignore-same-version } function set_hash_for_darwin() { local arch=$1 pkg_hash=$(nix-prefetch-url https://www.reaper.fm/files/${reaper_ver%.*}.x/reaper${reaper_ver/./}_universal.dmg) pkg_hash=$(nix hash to-sri "sha256:$pkg_hash") - # reset the version so the second architecture update doesn't get ignored - update-source-version reaper 0 "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" --system=$arch-darwin - update-source-version reaper "${reaper_ver}" "$pkg_hash" --system=$arch-darwin + update-source-version reaper "${reaper_ver}" "$pkg_hash" --system=$arch-darwin --ignore-same-version } set_hash_for_linux aarch64 diff --git a/pkgs/applications/blockchains/electrs/update.sh b/pkgs/applications/blockchains/electrs/update.sh index 14105d71a448a..db6a2fa5639f2 100755 --- a/pkgs/applications/blockchains/electrs/update.sh +++ b/pkgs/applications/blockchains/electrs/update.sh @@ -34,7 +34,6 @@ git -C $repo verify-tag v${version} rm -rf $repo/.git hash=$(nix hash path $repo) -(cd "$nixpkgs" && update-source-version electrs "$version" "$hash") -sed -i 's|cargoHash = .*|cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";|' "$scriptDir/default.nix" +(cd "$nixpkgs" && update-source-version electrs "$version" "$hash" && update-source-version electrs --ignore-same-version --source-key=cargoDeps) echo echo "electrs: $oldVersion -> $version" diff --git a/pkgs/applications/blockchains/teos/update.sh b/pkgs/applications/blockchains/teos/update.sh index b7e344cda8447..f27be08299b2c 100755 --- a/pkgs/applications/blockchains/teos/update.sh +++ b/pkgs/applications/blockchains/teos/update.sh @@ -25,7 +25,6 @@ git -C "$repo" checkout "tags/v${version}" rm -rf "${repo}/.git" hashcheck=$(nix hash path "$repo") -(cd "$nixpkgs" && update-source-version teos "$version" "$hashcheck") -sed -i 's|cargoHash = .*|cargoHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";|' "${scriptDir}/default.nix" +(cd "$nixpkgs" && update-source-version teos "$version" "$hashcheck" && update-source-version teos --ignore-same-version --source-key=cargoDeps) echo echo "rust-teos: $oldVersion -> $version" diff --git a/pkgs/applications/editors/sublime/4/common.nix b/pkgs/applications/editors/sublime/4/common.nix index f8083902fdde4..952194e0260c6 100644 --- a/pkgs/applications/editors/sublime/4/common.nix +++ b/pkgs/applications/editors/sublime/4/common.nix @@ -192,10 +192,7 @@ stdenv.mkDerivation (rec { fi for platform in ${lib.escapeShellArgs meta.platforms}; do - # The script will not perform an update when the version attribute is up to date from previous platform run - # We need to clear it before each run - update-source-version "${packageAttribute}.${primaryBinary}" 0 "${lib.fakeSha256}" --file="$versionFile" --version-key=buildVersion --source-key="sources.$platform" - update-source-version "${packageAttribute}.${primaryBinary}" "$latestVersion" --file="$versionFile" --version-key=buildVersion --source-key="sources.$platform" + update-source-version "${packageAttribute}.${primaryBinary}" "$latestVersion" --ignore-same-version --file="$versionFile" --version-key=buildVersion --source-key="sources.$platform" done ''; in diff --git a/pkgs/applications/misc/rescuetime/default.nix b/pkgs/applications/misc/rescuetime/default.nix index 22a1964e466df..615fa2c10faeb 100644 --- a/pkgs/applications/misc/rescuetime/default.nix +++ b/pkgs/applications/misc/rescuetime/default.nix @@ -42,10 +42,7 @@ in mkDerivation rec { latestVersion="$(curl -sS https://www.rescuetime.com/release-notes/linux | pup '.release:first-of-type h2 strong text{}' | tr -d '\n')" for platform in ${lib.concatStringsSep " " meta.platforms}; do - # The script will not perform an update when the version attribute is up to date from previous platform run - # We need to clear it before each run - update-source-version ${pname} 0 $(yes 0 | head -64 | tr -d "\n") --system=$platform - update-source-version ${pname} "$latestVersion" --system=$platform + update-source-version ${pname} "$latestVersion" --system=$platform --ignore-same-version done ''; diff --git a/pkgs/applications/networking/browsers/palemoon/bin.nix b/pkgs/applications/networking/browsers/palemoon/bin.nix index 4e648d00919f4..4637385613eb5 100644 --- a/pkgs/applications/networking/browsers/palemoon/bin.nix +++ b/pkgs/applications/networking/browsers/palemoon/bin.nix @@ -184,10 +184,7 @@ stdenv.mkDerivation (finalAttrs: { )" for variant in gtk3 gtk2; do - # The script will not perform an update when the version attribute is up to date from previous platform run - # We need to clear it before each run - update-source-version palemoon-bin 0 "${lib.fakeHash}" --source-key="sources.$variant" - update-source-version palemoon-bin "$version" --source-key="sources.$variant" + update-source-version palemoon-bin "$version" --ignore-same-version --source-key="sources.$variant" done ''; }; diff --git a/pkgs/applications/networking/browsers/tor-browser/update.nix b/pkgs/applications/networking/browsers/tor-browser/update.nix index 4edb644d59f91..04b69d8ce208c 100644 --- a/pkgs/applications/networking/browsers/tor-browser/update.nix +++ b/pkgs/applications/networking/browsers/tor-browser/update.nix @@ -59,7 +59,6 @@ in writeShellScript "update-${pname}" '' sha256=$(grep "${name}-$arch-$version.tar.xz" "$HOME/shasums" | cut -d" " -f1) hash=$(nix hash to-sri --type sha256 "$sha256") - update-source-version "${pname}" "0" "sha256-${lib.fakeSha256}" --source-key="sources.$platform" - update-source-version "${pname}" "$version" "$hash" --source-key="sources.$platform" + update-source-version "${pname}" "$version" "$hash" --ignore-same-version --source-key="sources.$platform" done '' diff --git a/pkgs/applications/networking/browsers/vivaldi/update-vivaldi.sh b/pkgs/applications/networking/browsers/vivaldi/update-vivaldi.sh index 6e1d68f13994b..994257889ee69 100755 --- a/pkgs/applications/networking/browsers/vivaldi/update-vivaldi.sh +++ b/pkgs/applications/networking/browsers/vivaldi/update-vivaldi.sh @@ -8,8 +8,7 @@ version=$(curl -sS https://vivaldi.com/download/ | sed -rne 's/.*vivaldi-stable_ update_hash() { url="https://downloads.vivaldi.com/stable/vivaldi-stable_$version-1_$2.deb" hash=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "$url")) - update-source-version vivaldi 0 sha256-BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB= --system=$1 - update-source-version vivaldi "$version" "$hash" --system=$1 + update-source-version vivaldi "$version" "$hash" --system=$1 --ignore-same-version } update_hash aarch64-linux arm64 diff --git a/pkgs/applications/networking/instant-messengers/feishu/default.nix b/pkgs/applications/networking/instant-messengers/feishu/default.nix index 48a6ba12d1826..def3a487d9b44 100644 --- a/pkgs/applications/networking/instant-messengers/feishu/default.nix +++ b/pkgs/applications/networking/instant-messengers/feishu/default.nix @@ -220,8 +220,7 @@ stdenv.mkDerivation { new_version=$(echo $package_info | jq -r '.data.version_number' | sed -n 's/.*@V//p') sha256_hash=$(nix-prefetch-url $update_link) sri_hash=$(nix hash to-sri --type sha256 $sha256_hash) - update-source-version feishu 0 ${lib.fakeSha256} --system=$platform --source-key="sources.$platform" - update-source-version feishu $new_version $sri_hash $update_link --system=$platform --source-key="sources.$platform" + update-source-version feishu $new_version $sri_hash $update_link --system=$platform --ignore-same-version --source-key="sources.$platform" done ''; }; diff --git a/pkgs/applications/office/libreoffice/darwin/default.nix b/pkgs/applications/office/libreoffice/darwin/default.nix index a8060a183d9cd..c81d08d31d98f 100644 --- a/pkgs/applications/office/libreoffice/darwin/default.nix +++ b/pkgs/applications/office/libreoffice/darwin/default.nix @@ -63,11 +63,8 @@ stdenvNoCC.mkDerivation { #!nix-shell -i bash --argstr aarch64Url ${aarch64Url} --argstr x86_64Url ${x86_64Url} --argstr version ${version} ${updateNix} set -eou pipefail - # reset version first so that both platforms are always updated and in sync - update-source-version libreoffice-bin 0 ${lib.fakeSha256} --file=${defaultNixFile} --system=aarch64-darwin - update-source-version libreoffice-bin $newVersion $newAarch64Sha256 --file=${defaultNixFile} --system=aarch64-darwin - update-source-version libreoffice-bin 0 ${lib.fakeSha256} --file=${defaultNixFile} --system=x86_64-darwin - update-source-version libreoffice-bin $newVersion $newX86_64Sha256 --file=${defaultNixFile} --system=x86_64-darwin + update-source-version libreoffice-bin $newVersion $newAarch64Sha256 --file=${defaultNixFile} --system=aarch64-darwin --ignore-same-version + update-source-version libreoffice-bin $newVersion $newX86_64Sha256 --file=${defaultNixFile} --system=x86_64-darwin --ignore-same-version ''; meta = with lib; { diff --git a/pkgs/applications/version-management/sublime-merge/common.nix b/pkgs/applications/version-management/sublime-merge/common.nix index 811bed7694c1e..df5e36228290f 100644 --- a/pkgs/applications/version-management/sublime-merge/common.nix +++ b/pkgs/applications/version-management/sublime-merge/common.nix @@ -196,10 +196,7 @@ stdenv.mkDerivation (rec { fi for platform in ${lib.escapeShellArgs meta.platforms}; do - # The script will not perform an update when the version attribute is up to date from previous platform run - # We need to clear it before each run - update-source-version "${packageAttribute}.${primaryBinary}" 0 "${lib.fakeSha256}" --file="$versionFile" --version-key=buildVersion --source-key="sources.$platform" - update-source-version "${packageAttribute}.${primaryBinary}" "$latestVersion" --file="$versionFile" --version-key=buildVersion --source-key="sources.$platform" + update-source-version "${packageAttribute}.${primaryBinary}" "$latestVersion" --ignore-same-version --file="$versionFile" --version-key=buildVersion --source-key="sources.$platform" done ''; in diff --git a/pkgs/applications/virtualization/lima/bin.nix b/pkgs/applications/virtualization/lima/bin.nix index 952ec6304e294..7f0f195e07ec0 100644 --- a/pkgs/applications/virtualization/lima/bin.nix +++ b/pkgs/applications/virtualization/lima/bin.nix @@ -92,14 +92,10 @@ stdenvNoCC.mkDerivation { X86_64_LINUX_SHA256=$(cat SHA256SUMS | awk '/Linux-x86_64/{print $1}') # reset version first so that all platforms are always updated and in sync - update-source-version lima-bin 0 ${lib.fakeSha256} --file=${lima-bin} --system=aarch64-darwin - update-source-version lima-bin $LATEST_VERSION $AARCH64_DARWIN_SHA256 --file=${lima-bin} --system=aarch64-darwin - update-source-version lima-bin 0 ${lib.fakeSha256} --file=${lima-bin} --system=x86_64-darwin - update-source-version lima-bin $LATEST_VERSION $X86_64_DARWIN_SHA256 --file=${lima-bin} --system=x86_64-darwin - update-source-version lima-bin 0 ${lib.fakeSha256} --file=${lima-bin} --system=aarch64-linux - update-source-version lima-bin $LATEST_VERSION $AARCH64_LINUX_SHA256 --file=${lima-bin} --system=aarch64-linux - update-source-version lima-bin 0 ${lib.fakeSha256} --file=${lima-bin} --system=x86_64-linux - update-source-version lima-bin $LATEST_VERSION $X86_64_LINUX_SHA256 --file=${lima-bin} --system=x86_64-linux + update-source-version lima-bin $LATEST_VERSION $AARCH64_DARWIN_SHA256 --file=${lima-bin} --ignore-same-version --system=aarch64-darwin + update-source-version lima-bin $LATEST_VERSION $X86_64_DARWIN_SHA256 --file=${lima-bin} --ignore-same-version --system=x86_64-darwin + update-source-version lima-bin $LATEST_VERSION $AARCH64_LINUX_SHA256 --file=${lima-bin} --ignore-same-version --system=aarch64-linux + update-source-version lima-bin $LATEST_VERSION $X86_64_LINUX_SHA256 --file=${lima-bin} --ignore-same-version --system=x86_64-linux rm SHA256SUMS ''; |