plexamp: 3.4.4 -> 3.4.6 (#121887)

This commit is contained in:
Patrick Hilhorst 2021-05-24 19:35:55 +02:00 committed by GitHub
parent 17f0612267
commit 741c61b735
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 3 deletions

View file

@ -2,13 +2,13 @@
let let
pname = "plexamp"; pname = "plexamp";
version = "3.4.4"; version = "3.4.6";
name = "${pname}-${version}"; name = "${pname}-${version}";
src = fetchurl { src = fetchurl {
url = "https://plexamp.plex.tv/plexamp.plex.tv/desktop/Plexamp-${version}.AppImage"; url = "https://plexamp.plex.tv/plexamp.plex.tv/desktop/Plexamp-${version}.AppImage";
name="${pname}-${version}.AppImage"; name="${pname}-${version}.AppImage";
sha256 = "1iz6qi12ljafb49l73rba5rwi5sdbd8ck5h2r6jiy260lgr2iiyk"; sha512 = "M2iLJxpufycxnUfdn9f85l47W8HCsi/K0SPVsxyyaeKloV3g6yTyOg1luMwHBLDeXEKwR9jtuvPlIMNyBCFm8w==";
}; };
appimageContents = appimageTools.extractType2 { appimageContents = appimageTools.extractType2 {
@ -29,10 +29,12 @@ in appimageTools.wrapType2 {
--replace 'Exec=AppRun' 'Exec=${pname}' --replace 'Exec=AppRun' 'Exec=${pname}'
''; '';
passthru.updateScript = ./update-plexamp.sh;
meta = with lib; { meta = with lib; {
description = "A beautiful Plex music player for audiophiles, curators, and hipsters"; description = "A beautiful Plex music player for audiophiles, curators, and hipsters";
homepage = "https://plexamp.com/"; 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; license = licenses.unfree;
maintainers = with maintainers; [ killercup synthetica ]; maintainers = with maintainers; [ killercup synthetica ];
platforms = [ "x86_64-linux" ]; platforms = [ "x86_64-linux" ];

View file

@ -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