sourcehut: make script work with non-python modules

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

+15 -4
+15 -4
pkgs/applications/version-management/sourcehut/update.sh
··· 7 tmp=$(mktemp -d) 8 trap 'rm -rf "$tmp"' EXIT 9 10 default() { 11 - (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/') 12 } 13 14 version() { 15 - (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.version" | tr -d '"') 16 } 17 18 src_url() { 19 - nix-instantiate --eval --strict --expr " with import $root {}; let src = sourcehut.python.pkgs.$1.drvAttrs.src; in src.meta.homepage" | tr -d '"' 20 } 21 22 get_latest_version() { ··· 35 default_nix="$(default "$1")" 36 oldVersion="$(version "$1")" 37 version="$(get_latest_version "$1")" 38 39 - (cd "$root" && update-source-version "sourcehut.python.pkgs.$1" "$version") 40 41 # Update vendorHash of Go modules 42 retry=true
··· 7 tmp=$(mktemp -d) 8 trap 'rm -rf "$tmp"' EXIT 9 10 + attr_path() { 11 + case "$1" in 12 + pagessrht) printf "sourcehut.$1";; 13 + *) printf "sourcehut.python.pkgs.$1";; 14 + esac 15 + } 16 + 17 default() { 18 + local p="$(attr_path "$1")" 19 + (cd "$root" && nix-instantiate --eval --strict -A $p.meta.position | sed -re 's/^"(.*):[0-9]+"$/\1/') 20 } 21 22 version() { 23 + local p="$(attr_path "$1")" 24 + (cd "$root" && nix-instantiate --eval --strict -A $p.version | tr -d '"') 25 } 26 27 src_url() { 28 + local p="$(attr_path "$1")" 29 + nix-instantiate --eval --strict --expr " with import $root {}; let src = $p.drvAttrs.src; in src.meta.homepage" | tr -d '"' 30 } 31 32 get_latest_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