Merge pull request #217306 from mweinelt/prowlarr-1.2.2.2699

prowlarr: 1.2.0.2583 -> 1.2.2.2699
This commit is contained in:
Martin Weinelt 2023-02-21 20:07:31 +00:00 committed by GitHub
commit 7483b1f32b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 30 deletions

View file

@ -1,33 +1,39 @@
{ lib, stdenv, fetchurl, mono, libmediainfo, sqlite, curl, makeWrapper, icu, dotnet-runtime, openssl, nixosTests, zlib }:
let
pname = "prowlarr";
unsupported = throw "Unsupported system ${stdenv.hostPlatform.system} for ${pname}";
os =
if stdenv.isDarwin then
"osx"
else if stdenv.isLinux then
"linux"
else
throw "Not supported on ${stdenv.hostPlatform.system}.";
unsupported;
arch = {
x86_64-linux = "x64";
aarch64-darwin = "arm64";
aarch64-linux = "arm64";
x86_64-darwin = "x64";
}."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
x86_64-linux = "x64";
}.${stdenv.hostPlatform.system} or unsupported;
hash = {
x64-linux_hash = "sha256-Xx2z5aiIKRNbBxBMXCTfm1VacQOLyruC6sXB/+C7knk=";
arm64-linux_hash = "sha256-r6WuQhydSRZmsH1hp51gGcQ/7ZruxbEMrbrFps2nmcw=";
x64-osx_hash = "sha256-F8bE4lXcqyBVZhgYcQKPrza9cphCuC5j7968jL6qgxM=";
}."${arch}-${os}_hash";
aarch64-darwin = "sha256-S9CrYDCwIssAtcP4pI1csbOOFKaZgM6UKEDNBp2VwVo=";
aarch64-linux = "sha256-UkoTWD4ljSfx/FzH5kQBpp/Bg+xwvc7n9KLBrqNNSR0=";
x86_64-darwin = "sha256-Wru+pwISVgjnSVe8HbiwU4M1aIIK5AGzml/2yqMGIlo=";
x86_64-linux = "sha256-eJRJ1LvQsmlMeWoUmGrAyLfoebG8g/Kl2lBQxMjIyTY=";
}.${stdenv.hostPlatform.system} or unsupported;
in stdenv.mkDerivation rec {
pname = "prowlarr";
version = "1.2.0.2583";
inherit pname;
version = "1.2.2.2699";
src = fetchurl {
url = "https://github.com/Prowlarr/Prowlarr/releases/download/v${version}/Prowlarr.develop.${version}.${os}-core-${arch}.tar.gz";
sha256 = hash;
url = "https://github.com/Prowlarr/Prowlarr/releases/download/v${version}/Prowlarr.master.${version}.${os}-core-${arch}.tar.gz";
inherit hash;
};
nativeBuildInputs = [ makeWrapper ];
@ -54,8 +60,14 @@ in stdenv.mkDerivation rec {
meta = with lib; {
description = "An indexer manager/proxy built on the popular arr .net/reactjs base stack";
homepage = "https://wiki.servarr.com/prowlarr";
changelog = "https://github.com/Prowlarr/Prowlarr/releases/tag/v${version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [ jdreaver ];
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
platforms = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
};
}

View file

@ -7,17 +7,19 @@ dirname="$(dirname "$0")"
updateHash()
{
# nixos
version=$1
arch=$2
os=$3
system=$2
hashKey="${arch}-${os}_hash"
# prowlarr
arch=$3
os=$4
url="https://github.com/Prowlarr/Prowlarr/releases/download/v$version/Prowlarr.develop.$version.$os-core-$arch.tar.gz"
url="https://github.com/Prowlarr/Prowlarr/releases/download/v$version/Prowlarr.master.$version.$os-core-$arch.tar.gz"
hash=$(nix-prefetch-url --type sha256 $url)
sriHash="$(nix hash to-sri --type sha256 $hash)"
sed -i "s|$hashKey = \"[a-zA-Z0-9\/+-=]*\";|$hashKey = \"$sriHash\";|g" "$dirname/default.nix"
sed -i "s|$system = \"sha256-[a-zA-Z0-9\/+-=]*\";|$system = \"$sriHash\";|g" "$dirname/default.nix"
}
updateVersion()
@ -27,16 +29,8 @@ updateVersion()
currentVersion=$(cd $dirname && nix eval --raw -f ../../.. prowlarr.version)
# N.B. Prowlarr is still in development, so
# https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest
# returns nothing. Once this endpoint returns something, we should use
# it. Until then, we use jq to sort releases (N.B. the "sort_by(. |
# split(".") | map(tonumber))" incantation is to sort the version
# number properly and not as a string).
# latestTag=$(curl https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest | jq -r ".tag_name")
# latestVersion="$(expr $latestTag : 'v\(.*\)')"
latestVersion=$(curl https://api.github.com/repos/Prowlarr/Prowlarr/git/refs/tags | jq '. | map(.ref | sub("refs/tags/v";"")) | sort_by(. | split(".") | map(tonumber)) | .[-1]' -r)
latestTag=$(curl https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest | jq -r ".tag_name")
latestVersion="$(expr $latestTag : 'v\(.*\)')"
if [[ "$currentVersion" == "$latestVersion" ]]; then
echo "Prowlarr is up-to-date: ${currentVersion}"
@ -45,6 +39,7 @@ fi
updateVersion $latestVersion
updateHash $latestVersion x64 linux
updateHash $latestVersion arm64 linux
updateHash $latestVersion x64 osx
updateHash $latestVersion aarch64-darwin arm64 osx
updateHash $latestVersion aarch64-linux arm64 linux
updateHash $latestVersion x86_64-darwin x64 osx
updateHash $latestVersion x86_64-linux x64 linux