From 741c61b7359c7861b8b4d1765fdeb0204fd7add3 Mon Sep 17 00:00:00 2001 From: Patrick Hilhorst Date: Mon, 24 May 2021 19:35:55 +0200 Subject: plexamp: 3.4.4 -> 3.4.6 (#121887) --- pkgs/applications/audio/plexamp/default.nix | 8 ++-- pkgs/applications/audio/plexamp/update-plexamp.sh | 54 +++++++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100755 pkgs/applications/audio/plexamp/update-plexamp.sh (limited to 'pkgs') diff --git a/pkgs/applications/audio/plexamp/default.nix b/pkgs/applications/audio/plexamp/default.nix index 47b74cc865b..5a266580cf7 100644 --- a/pkgs/applications/audio/plexamp/default.nix +++ b/pkgs/applications/audio/plexamp/default.nix @@ -2,13 +2,13 @@ let pname = "plexamp"; - version = "3.4.4"; + version = "3.4.6"; name = "${pname}-${version}"; src = fetchurl { url = "https://plexamp.plex.tv/plexamp.plex.tv/desktop/Plexamp-${version}.AppImage"; name="${pname}-${version}.AppImage"; - sha256 = "1iz6qi12ljafb49l73rba5rwi5sdbd8ck5h2r6jiy260lgr2iiyk"; + sha512 = "M2iLJxpufycxnUfdn9f85l47W8HCsi/K0SPVsxyyaeKloV3g6yTyOg1luMwHBLDeXEKwR9jtuvPlIMNyBCFm8w=="; }; appimageContents = appimageTools.extractType2 { @@ -29,10 +29,12 @@ in appimageTools.wrapType2 { --replace 'Exec=AppRun' 'Exec=${pname}' ''; + passthru.updateScript = ./update-plexamp.sh; + meta = with lib; { description = "A beautiful Plex music player for audiophiles, curators, and hipsters"; homepage = "https://plexamp.com/"; - changelog = "https://forums.plex.tv/t/plexamp-release-notes/221280/26"; + changelog = "https://forums.plex.tv/t/plexamp-release-notes/221280/28"; license = licenses.unfree; maintainers = with maintainers; [ killercup synthetica ]; platforms = [ "x86_64-linux" ]; diff --git a/pkgs/applications/audio/plexamp/update-plexamp.sh b/pkgs/applications/audio/plexamp/update-plexamp.sh new file mode 100755 index 00000000000..b6b8def1e31 --- /dev/null +++ b/pkgs/applications/audio/plexamp/update-plexamp.sh @@ -0,0 +1,54 @@ +#! /usr/bin/env nix-shell +#! nix-shell -p yq bash curl bc ripgrep +#! nix-shell -i bash + +set -Eeuxo pipefail + +cleanup() { + rm -rf "$TMPDIR" +} + +trap cleanup EXIT + +ROOT="$(dirname "$(readlink -f "$0")")" +if [ ! -f "$ROOT/default.nix" ]; then + echo "ERROR: cannot find default.nix in $ROOT" + exit 1 +fi + +if [ "$(basename "$ROOT")" != plexamp ]; then + echo "ERROR: folder not named plexamp" + exit 1 +fi + +TMPDIR="$(mktemp -d)" + +VERSION_FILE="$TMPDIR/version.yml" +VERSION_URL="https://plexamp.plex.tv/plexamp.plex.tv/desktop/latest-linux.yml" +curl "$VERSION_URL" -o "$VERSION_FILE" + +VERSION="$(yq -r .version "$VERSION_FILE")" +SHA512="$(yq -r .sha512 "$VERSION_FILE")" + +DEFAULT_NIX="$ROOT/default.nix" +WORKING_NIX="$TMPDIR/default.nix" +cp "$DEFAULT_NIX" "$WORKING_NIX" + +sed -i "s@version = .*;@version = \"$VERSION\";@g" "$WORKING_NIX" + +if diff "$DEFAULT_NIX" "$WORKING_NIX"; then + echo "WARNING: no changes" + exit 0 +fi + +# update sha hash (convenietly provided) +sed -i "s@sha.* = .*;@sha512 = \"$SHA512\";@g" "$WORKING_NIX" + +# update the changelog ("just" increment the number) +CHANGELOG_URL=$(rg --only-matching 'changelog = "(.+)";' --replace '$1' $WORKING_NIX) +CHANGELOG_NUMBER=$(rg --only-matching '.*/([0-9]+)' --replace '$1' <<< $CHANGELOG_URL) +NEXT_CHANGELOG=$(($CHANGELOG_NUMBER + 1)) +NEXT_URL=$(rg --only-matching '(.*)/[0-9]+' --replace "\$1/$NEXT_CHANGELOG" <<< $CHANGELOG_URL) +sed -i "s@changelog = \".*\";@changelog = \"$NEXT_URL\";@" $WORKING_NIX + +mv $WORKING_NIX $DEFAULT_NIX -- cgit 1.4.1