sourcehut: update.sh: bump `gqlgenVersion` on update too

This extends the current script to pull the gqlgen version from the
go.mod file in the repository root (which we check out already anyway)
and replace it as necessary.

Makes updating all packages _a lot_ less painful. And since this is now
automated, remove the default value we previously defined for
`gqlgenVersion`.

Signed-off-by: Christoph Heiss <christoph@c8h4.io>

+14 -6
+1 -1
pkgs/applications/version-management/sourcehut/fix-gqlgen-trimpath.nix
··· 1 { unzip 2 - , gqlgenVersion ? "0.17.42" 3 }: 4 { 5 overrideModAttrs = (_: {
··· 1 { unzip 2 + , gqlgenVersion 3 }: 4 { 5 overrideModAttrs = (_: {
+13 -5
pkgs/applications/version-management/sourcehut/update.sh
··· 1 #! /usr/bin/env nix-shell 2 - #! nix-shell -i bash -p git mercurial common-updater-scripts 3 set -eux -o pipefail 4 5 cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1 ··· 34 rm -rf "$tmp" 35 if [ "$1" = "hgsrht" ]; then 36 hg clone "$src" "$tmp" >/dev/null 37 - printf "%s" "$(cd "$tmp" && hg log --limit 1 --template '{latesttag}')" 38 else 39 git clone "$src" "$tmp" >/dev/null 40 - printf "%s" "$(cd "$tmp" && git describe "$(git rev-list --tags --max-count=1)")" 41 fi 42 } 43 44 update_version() { 45 default_nix="$(default "$1")" 46 oldVersion="$(version "$1")" 47 - version="$(get_latest_version "$1")" 48 local p="$(attr_path "$1")" 49 50 (cd "$root" && update-source-version "$p" "$version") 51 52 # Update vendorHash of Go modules 53 retry=true 54 while "$retry"; do ··· 63 done 64 done 65 66 - if [ "$oldVersion" != "$version" ]; then 67 git add "$default_nix" 68 git commit -m "sourcehut.$1: $oldVersion -> $version" 69 fi
··· 1 #! /usr/bin/env nix-shell 2 + #! nix-shell -i bash -p gnused git mercurial common-updater-scripts 3 set -eux -o pipefail 4 5 cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1 ··· 34 rm -rf "$tmp" 35 if [ "$1" = "hgsrht" ]; then 36 hg clone "$src" "$tmp" >/dev/null 37 + printf "%s %s\n" \ 38 + "$(cd "$tmp" && hg log --limit 1 --template '{latesttag}')" \ 39 + "$(cd "$tmp" && sed -ne 's/^\s*github\.com\/99designs\/gqlgen v\(.*\)$/\1/p' go.mod)" 40 else 41 git clone "$src" "$tmp" >/dev/null 42 + printf "%s %s\n" \ 43 + "$(cd "$tmp" && git describe "$(git rev-list --tags --max-count=1)")" \ 44 + "$(cd "$tmp" && sed -ne 's/^\s*github\.com\/99designs\/gqlgen v\(.*\)$/\1/p' go.mod)" 45 fi 46 } 47 48 update_version() { 49 default_nix="$(default "$1")" 50 oldVersion="$(version "$1")" 51 + read -r version gqlgen_ver < <(get_latest_version "$1") 52 local p="$(attr_path "$1")" 53 54 (cd "$root" && update-source-version "$p" "$version") 55 56 + # update `gqlgenVersion` if necessary 57 + old_gqlgen_ver="$(sed -ne 's/^.*gqlgenVersion = "\(.*\)".*$/\1/p' "$default_nix")" 58 + sed -ri "s|gqlgenVersion = \"$old_gqlgen_ver\";|gqlgenVersion = \"$gqlgen_ver\";|w /dev/stdout" "$default_nix" 59 + 60 # Update vendorHash of Go modules 61 retry=true 62 while "$retry"; do ··· 71 done 72 done 73 74 + if [ "$oldVersion" != "$version" ] || [ "$old_gqlgen_ver" != "$gqlgen_ver" ]; then 75 git add "$default_nix" 76 git commit -m "sourcehut.$1: $oldVersion -> $version" 77 fi