Skip to content

Commit

Permalink
treewide: fix update script in by-name
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksanaa committed Nov 24, 2024
1 parent 041855a commit 8b0ab6f
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 32 deletions.
2 changes: 1 addition & 1 deletion pkgs/by-name/_1/_1password-cli/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ap/apache-airflow/update-providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ca/castopod/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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='
Expand Down
2 changes: 0 additions & 2 deletions pkgs/by-name/co/coursier/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions pkgs/by-name/gn/gnucash/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"|"
7 changes: 2 additions & 5 deletions pkgs/by-name/i-/i-dot-ming/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
'';
};
Expand Down
3 changes: 0 additions & 3 deletions pkgs/by-name/je/jenkins/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/li/libhsts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions pkgs/by-name/na/nanorc/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]:${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
Expand Down
3 changes: 0 additions & 3 deletions pkgs/by-name/oh/oh-my-zsh/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkgs/by-name/ps/psst/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 1 addition & 5 deletions pkgs/by-name/sb/sbt-extras/package.nix
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -46,7 +46,6 @@ stdenv.mkDerivation rec {
curl
cacert
git
nixfmt-classic
nix
jq
coreutils
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/we/webex/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; {
Expand Down

0 comments on commit 8b0ab6f

Please sign in to comment.