From 8b0ab6f48364e18ba1af9ac75aaa1aa7b1cc7fc9 Mon Sep 17 00:00:00 2001 From: aleksana Date: Sun, 24 Nov 2024 16:52:51 +0800 Subject: [PATCH] treewide: fix update script in by-name --- pkgs/by-name/_1/_1password-cli/update.sh | 2 +- pkgs/by-name/ap/apache-airflow/update-providers.py | 2 +- pkgs/by-name/ca/castopod/update.sh | 2 +- pkgs/by-name/co/coursier/package.nix | 2 -- pkgs/by-name/gn/gnucash/update.sh | 6 +++--- pkgs/by-name/i-/i-dot-ming/package.nix | 7 ++----- pkgs/by-name/je/jenkins/package.nix | 3 --- pkgs/by-name/li/libhsts/update.sh | 2 +- pkgs/by-name/na/nanorc/package.nix | 2 -- pkgs/by-name/oh/oh-my-zsh/package.nix | 3 --- pkgs/by-name/ps/psst/update.sh | 6 +++--- pkgs/by-name/sb/sbt-extras/package.nix | 6 +----- .../up/update-python-libraries/update-python-libraries.py | 2 +- pkgs/by-name/we/webex/package.nix | 2 +- 14 files changed, 15 insertions(+), 32 deletions(-) diff --git a/pkgs/by-name/_1/_1password-cli/update.sh b/pkgs/by-name/_1/_1password-cli/update.sh index 4f04279fcea60..ffa1584044564 100755 --- a/pkgs/by-name/_1/_1password-cli/update.sh +++ b/pkgs/by-name/_1/_1password-cli/update.sh @@ -6,7 +6,7 @@ set -eu ROOT="$(dirname "$(readlink -f "$0")")" NIX_DRV="$ROOT/package.nix" if [ ! -f "$NIX_DRV" ]; then - echo "ERROR: cannot find default.nix in $ROOT" + echo "ERROR: cannot find package.nix in $ROOT" exit 1 fi diff --git a/pkgs/by-name/ap/apache-airflow/update-providers.py b/pkgs/by-name/ap/apache-airflow/update-providers.py index 207c381192586..06771eb3244ac 100755 --- a/pkgs/by-name/ap/apache-airflow/update-providers.py +++ b/pkgs/by-name/ap/apache-airflow/update-providers.py @@ -33,7 +33,7 @@ def get_version(): - with open(os.path.dirname(sys.argv[0]) + "/default.nix") as fh: + with open(os.path.dirname(sys.argv[0]) + "/package.nix") as fh: # A version consists of digits, dots, and possibly a "b" (for beta) m = re.search('version = "([\\d\\.b]+)";', fh.read()) return m.group(1) diff --git a/pkgs/by-name/ca/castopod/update.sh b/pkgs/by-name/ca/castopod/update.sh index 742788dc8ddfd..343cf1579059e 100755 --- a/pkgs/by-name/ca/castopod/update.sh +++ b/pkgs/by-name/ca/castopod/update.sh @@ -3,7 +3,7 @@ set -euo pipefail nixpkgs="$(git rev-parse --show-toplevel)" -castopod_nix="$nixpkgs/pkgs/applications/audio/castopod/default.nix" +castopod_nix="$(dirname "$0")/package.nix" # https://www.meetup.com/api/guide/#p02-querying-section query=' diff --git a/pkgs/by-name/co/coursier/package.nix b/pkgs/by-name/co/coursier/package.nix index 3f3cbad38827d..9b2a6c61fafff 100644 --- a/pkgs/by-name/co/coursier/package.nix +++ b/pkgs/by-name/co/coursier/package.nix @@ -38,8 +38,6 @@ stdenv.mkDerivation rec { oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')" latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/coursier/coursier.git 'v*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')" if [ "$oldVersion" != "$latestTag" ]; then - nixpkgs="$(git rev-parse --show-toplevel)" - default_nix="$nixpkgs/pkgs/development/tools/coursier/default.nix" update-source-version ${pname} "$latestTag" --version-key=version --print-changes else echo "${pname} is already up-to-date" diff --git a/pkgs/by-name/gn/gnucash/update.sh b/pkgs/by-name/gn/gnucash/update.sh index b339fd4a7c7c1..75621a04d8dde 100755 --- a/pkgs/by-name/gn/gnucash/update.sh +++ b/pkgs/by-name/gn/gnucash/update.sh @@ -19,6 +19,6 @@ src_doc_hash=$(nix-prefetch-github Gnucash gnucash-docs --rev "$latest_version" src_doc_hash=$(nix-hash --to-sri --type sha256 "$src_doc_hash") cd "$(dirname "${BASH_SOURCE[0]}")" -sed -i default.nix -e "s|$old_src_hash|$src_hash|" -sed -i default.nix -e "s|$old_src_doc_hash|$src_doc_hash|" -sed -i default.nix -e "/ version =/s|\"${UPDATE_NIX_OLD_VERSION}\"|\"${latest_version}\"|" +sed -i package.nix -e "s|$old_src_hash|$src_hash|" +sed -i package.nix -e "s|$old_src_doc_hash|$src_doc_hash|" +sed -i package.nix -e "/ version =/s|\"${UPDATE_NIX_OLD_VERSION}\"|\"${latest_version}\"|" diff --git a/pkgs/by-name/i-/i-dot-ming/package.nix b/pkgs/by-name/i-/i-dot-ming/package.nix index 2941a0030c533..45aabe446f794 100644 --- a/pkgs/by-name/i-/i-dot-ming/package.nix +++ b/pkgs/by-name/i-/i-dot-ming/package.nix @@ -22,7 +22,7 @@ stdenvNoCC.mkDerivation rec { passthru = { updateScript = writeScript "updater" '' #!/usr/bin/env nix-shell - #!nix-shell -i bash -p curl gnused + #!nix-shell -i bash -p curl gnused common-updater-scripts set -e version=$(curl -i -s https://github.com/ichitenfont/I.Ming/releases/latest | sed -n -E 's|^location.*releases/tag/([0-9.]+).*$|\1|p') if [[ $version != ${version} ]]; then @@ -31,10 +31,7 @@ stdenvNoCC.mkDerivation rec { install -DT -m444 $tmp/I.Ming.ttf $tmp/share/fonts/truetype/I.Ming/I.Ming.ttf rm $tmp/I.Ming.ttf hash=$(nix hash path --type sha256 --base32 --sri $tmp) - sed -i -E \ - -e "s/version = \"[0-9.]+\"/version = \"$version\"/" \ - -e "s|hash = \".*\"|hash = \"$hash\"|" \ - pkgs/data/fonts/i-dot-ming/default.nix + update-source-version i-dot-ming ${version} $hash fi ''; }; diff --git a/pkgs/by-name/je/jenkins/package.nix b/pkgs/by-name/je/jenkins/package.nix index e9cf1a7d1f11e..b41300892da56 100644 --- a/pkgs/by-name/je/jenkins/package.nix +++ b/pkgs/by-name/je/jenkins/package.nix @@ -55,9 +55,6 @@ stdenv.mkDerivation rec { if [ ! "$oldVersion" = "$version" ]; then update-source-version jenkins "$version" "$hash" - nixpkgs="$(git rev-parse --show-toplevel)" - default_nix="$nixpkgs/pkgs/development/tools/continuous-integration/jenkins/default.nix" - nixfmt "$default_nix" else echo "jenkins is already up-to-date" fi diff --git a/pkgs/by-name/li/libhsts/update.sh b/pkgs/by-name/li/libhsts/update.sh index f80966e08c9aa..7ab5f7ef7b51d 100755 --- a/pkgs/by-name/li/libhsts/update.sh +++ b/pkgs/by-name/li/libhsts/update.sh @@ -10,4 +10,4 @@ sha256=$(nix-prefetch-url "https://raw.github.com/chromium/chromium/$chromium_ve sed -e "0,/chromium_version/s/chromium_version = \".*\"/chromium_version = \"$chromium_version\"/" \ -e "0,/sha256/s/sha256 = \".*\"/sha256 = \"$sha256\"/" \ - --in-place ./default.nix + --in-place ./package.nix diff --git a/pkgs/by-name/na/nanorc/package.nix b/pkgs/by-name/na/nanorc/package.nix index 5587c2c0243c3..9c6efde6b6dbd 100644 --- a/pkgs/by-name/na/nanorc/package.nix +++ b/pkgs/by-name/na/nanorc/package.nix @@ -37,8 +37,6 @@ in stdenv.mkDerivation rec { oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"' | sed 's|\\.|-|g')" latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags git@github.com:${owner}/${repo} '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3)" if [ "$oldVersion" != "$latestTag" ]; then - nixpkgs="$(git rev-parse --show-toplevel)" - default_nix="$nixpkgs/pkgs/applications/editors/nano/nanorc/default.nix" newTag=$(echo $latestTag | sed 's|\.|-|g') update-source-version ${pname} "$newTag" --version-key=version --print-changes else diff --git a/pkgs/by-name/oh/oh-my-zsh/package.nix b/pkgs/by-name/oh/oh-my-zsh/package.nix index de025a584af34..9cdd7da515f4a 100644 --- a/pkgs/by-name/oh/oh-my-zsh/package.nix +++ b/pkgs/by-name/oh/oh-my-zsh/package.nix @@ -96,11 +96,8 @@ stdenv.mkDerivation rec { latestSha="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits\?sha\=master\&since\=$oldVersion | jq -r '.[0].sha')" if [ ! "null" = "$latestSha" ]; then - nixpkgs="$(git rev-parse --show-toplevel)" - default_nix="$nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix" latestDate="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits/$latestSha | jq '.commit.committer.date' | sed 's|"\(.*\)T.*|\1|g')" update-source-version oh-my-zsh "$latestDate" --rev="$latestSha" - nixfmt "$default_nix" else echo "${pname} is already up-to-date" fi diff --git a/pkgs/by-name/ps/psst/update.sh b/pkgs/by-name/ps/psst/update.sh index 4ffa9417f0401..8952132022ef4 100755 --- a/pkgs/by-name/ps/psst/update.sh +++ b/pkgs/by-name/ps/psst/update.sh @@ -35,9 +35,9 @@ src_hash=$(nix-prefetch-github jpochyla psst --rev "$rev" | jq -r .hash) src="https://raw.githubusercontent.com/jpochyla/psst/$rev" wget "${TOKEN_ARGS[@]}" "$src/Cargo.lock" -O Cargo.lock -sed -i -E -e "s#version = \".*\"#version = \"$version\"#" default.nix -sed -i -E -e "s#rev = \".*\"#rev = \"$rev\"#" default.nix -sed -i -E -e "s#hash = \".*\"#hash = \"$src_hash\"#" default.nix +sed -i -E -e "s#version = \".*\"#version = \"$version\"#" package.nix +sed -i -E -e "s#rev = \".*\"#rev = \"$rev\"#" package.nix +sed -i -E -e "s#hash = \".*\"#hash = \"$src_hash\"#" package.nix # Also update the git hash shown in the UI sed -i -E -e "s#GIT_VERSION: \&str = \".*\"#GIT_VERSION: \&str = \"$rev\"#" make-build-reproducible.patch diff --git a/pkgs/by-name/sb/sbt-extras/package.nix b/pkgs/by-name/sb/sbt-extras/package.nix index 385cfc5c087ae..8b2deea62e498 100644 --- a/pkgs/by-name/sb/sbt-extras/package.nix +++ b/pkgs/by-name/sb/sbt-extras/package.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchFromGitHub, which, curl, makeWrapper, jdk, writeScript -, common-updater-scripts, cacert, git, nixfmt-classic, nix, jq, coreutils +, common-updater-scripts, cacert, git, nix, jq, coreutils , gnused }: stdenv.mkDerivation rec { @@ -46,7 +46,6 @@ stdenv.mkDerivation rec { curl cacert git - nixfmt-classic nix jq coreutils @@ -56,12 +55,9 @@ stdenv.mkDerivation rec { oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')" latestSha="$(curl -L -s https://api.github.com/repos/paulp/sbt-extras/commits\?sha\=master\&since\=$oldVersion | jq -r '.[0].sha')" if [ ! "null" = "$latestSha" ]; then - nixpkgs="$(git rev-parse --show-toplevel)" - default_nix="$nixpkgs/pkgs/development/tools/build-managers/sbt-extras/default.nix" latestDate="$(curl -L -s https://api.github.com/repos/paulp/sbt-extras/commits/$latestSha | jq '.commit.committer.date' | sed 's|"\(.*\)T.*|\1|g')" update-source-version ${pname} "$latestSha" --version-key=rev update-source-version ${pname} "$latestDate" --ignore-same-hash - nixfmt "$default_nix" else echo "${pname} is already up-to-date" fi diff --git a/pkgs/by-name/up/update-python-libraries/update-python-libraries.py b/pkgs/by-name/up/update-python-libraries/update-python-libraries.py index dd6dcb2c70ad7..b261f7fe00ec9 100755 --- a/pkgs/by-name/up/update-python-libraries/update-python-libraries.py +++ b/pkgs/by-name/up/update-python-libraries/update-python-libraries.py @@ -6,7 +6,7 @@ You'll likely want to use `` - $ ./update-python-libraries ../../pkgs/development/python-modules/**/default.nix + $ ./update-python-libraries ../../development/python-modules/**/default.nix `` to update all non-pinned libraries in that folder. """ diff --git a/pkgs/by-name/we/webex/package.nix b/pkgs/by-name/we/webex/package.nix index 3a03bef180a9a..2ef916053868c 100644 --- a/pkgs/by-name/we/webex/package.nix +++ b/pkgs/by-name/we/webex/package.nix @@ -168,7 +168,7 @@ stdenv.mkDerivation rec { version=$(jq -r '.version' <<< "$manifest") hash=$(jq -r '.checksum' <<< "$manifest") - update-source-version ${pname} "$version" "$hash" "$url" --file=./pkgs/applications/networking/instant-messengers/webex/default.nix + update-source-version ${pname} "$version" "$hash" "$url" ''; meta = with lib; {