From be1187e30f67992c683487bf5ab74d10189c71d2 Mon Sep 17 00:00:00 2001 From: schnusch Date: Thu, 24 Nov 2022 00:25:36 +0100 Subject: [PATCH] nitter: use nix-update in update script --- pkgs/servers/nitter/update.sh | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/pkgs/servers/nitter/update.sh b/pkgs/servers/nitter/update.sh index e756eff5fb98..30405f34b22e 100755 --- a/pkgs/servers/nitter/update.sh +++ b/pkgs/servers/nitter/update.sh @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -i bash -p common-updater-scripts curl jq nix nix-prefetch-git patchutils +#!nix-shell -i bash -p curl jq nix nix-update patchutils set -euo pipefail info() { @@ -11,19 +11,9 @@ info() { printf "$@" >&2 } -nitter_old_version=$(nix-instantiate --eval --strict --json -A nitter.version . | jq -r .) nitter_old_rev=$(nix-instantiate --eval --strict --json -A nitter.src.rev . | jq -r .) -today=$(LANG=C date -u +'%Y-%m-%d') - -# use latest commit before today, we should not call the version *today* -# because there might still be commits coming -# use the day of the latest commit we picked as version -commit=$(curl -Sfs "https://api.github.com/repos/zedeus/nitter/compare/$nitter_old_rev~1...master" \ - | jq '.commits | map(select(.commit.committer.date < $today) | {sha, date: .commit.committer.date}) | .[-1]' --arg today "$today") -nitter_new_rev=$(jq -r '.sha' <<< "$commit") -nitter_new_version="unstable-$(jq -r '.date[0:10]' <<< "$commit")" -info "latest commit before $today: $nitter_new_rev ($(jq -r '.date' <<< "$commit"))" - +nix-update --version=branch --commit nitter +nitter_new_rev=$(nix-instantiate --eval --strict --json -A nitter.src.rev . | jq -r .) if [ "$nitter_new_rev" = "$nitter_old_rev" ]; then info "nitter is up-to-date." exit @@ -33,8 +23,3 @@ if curl -Sfs "https://github.com/zedeus/nitter/compare/$nitter_old_rev...$nitter | lsdiff | grep -Fxe 'a/nitter.nimble' -e 'b/nitter.nimble' > /dev/null; then info "nitter.nimble changed, some dependencies probably need updating." fi - -nitter_new_sha256=$(nix-prefetch-git --rev "$nitter_new_rev" "https://github.com/zedeus/nitter.git" | jq -r .sha256) -update-source-version nitter "$nitter_new_version" "$nitter_new_sha256" --rev="$nitter_new_rev" -git commit --all --verbose --message "nitter: $nitter_old_version -> $nitter_new_version" -info "Updated nitter to $nitter_new_version."