shadershark: simplify update script (#342342)

This commit is contained in:
Thiago Kenji Okada 2024-11-29 15:20:00 +00:00 committed by GitHub
commit 7f6123b2ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 15 deletions

View File

@ -9,6 +9,8 @@
, imagemagick , imagemagick
, makeWrapper , makeWrapper
, installShellFiles , installShellFiles
, genericUpdater
, writeShellScript
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -50,7 +52,13 @@ stdenv.mkDerivation (finalAttrs: {
runHook postInstall runHook postInstall
''; '';
passthru.updateScript = [ ./update.sh finalAttrs.src.url ]; passthru.updateScript = genericUpdater {
inherit (finalAttrs) pname version;
versionLister = writeShellScript "shadershark-tags" ''
repo_url=${finalAttrs.src.url}
curl "$repo_url/tags" | grep '/rev/v' | sed 's;.*/rev/v\([^"]*\)[^$]*;\1; #'
'';
};
meta = with lib; { meta = with lib; {
mainProgram = "shader-shark"; mainProgram = "shader-shark";

View File

@ -1,14 +0,0 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl common-updater-scripts
set -e
repo_url="$1"; shift
data="$(curl "$repo_url/tags")"
rev="$(echo "$data" | grep '/rev/v' | sed 's;.*/rev/v\([^"]*\)[^$]*;\1;' | head -n 1)"
echo "new rev: $rev"
update-source-version shadershark "$rev" \
--print-changes