audiobookshelf: 2.26.3 -> 2.27.0 (#430905)
This commit is contained in:
@@ -14,8 +14,12 @@
|
||||
}:
|
||||
|
||||
let
|
||||
source = builtins.fromJSON (builtins.readFile ./source.json);
|
||||
pname = "audiobookshelf";
|
||||
source = {
|
||||
version = "2.27.0";
|
||||
hash = "sha256-FKWK/yYMNBrGgfWtdUC9DpQ2y8mBn3/5G+buQNzzot4=";
|
||||
npmDepsHash = "sha256-FpRO7lhgQNZ5wHQwHFIxkrYfmivgTopXKFcrQ48B20w=";
|
||||
clientNpmDepsHash = "sha256-GHN49bo7m9pzvwNvkVtA0cwTv+rWSAKpBHG7jqXm/vo=";
|
||||
};
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "advplyr";
|
||||
@@ -37,7 +41,7 @@ let
|
||||
NODE_OPTIONS = "--openssl-legacy-provider";
|
||||
|
||||
npmBuildScript = "generate";
|
||||
npmDepsHash = source.clientDepsHash;
|
||||
npmDepsHash = source.clientNpmDepsHash;
|
||||
};
|
||||
|
||||
wrapper = import ./wrapper.nix {
|
||||
@@ -51,15 +55,16 @@ let
|
||||
|
||||
in
|
||||
buildNpmPackage {
|
||||
inherit pname src;
|
||||
inherit (source) version;
|
||||
pname = "audiobookshelf";
|
||||
|
||||
inherit src;
|
||||
inherit (source) npmDepsHash version;
|
||||
|
||||
buildInputs = [ util-linux ];
|
||||
nativeBuildInputs = [ python3 ];
|
||||
|
||||
dontNpmBuild = true;
|
||||
npmInstallFlags = [ "--only-production" ];
|
||||
npmDepsHash = source.depsHash;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/opt/client
|
||||
@@ -75,7 +80,7 @@ buildNpmPackage {
|
||||
|
||||
passthru = {
|
||||
tests.basic = nixosTests.audiobookshelf;
|
||||
updateScript = ./update.nu;
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"owner": "advplyr",
|
||||
"repo": "audiobookshelf",
|
||||
"rev": "a7a3a565098791a8157ed54b46b5258bb97c141d",
|
||||
"hash": "sha256-AnPHwb3ad6TvgQ9DJdOYwQ+RwE5+iMA7tDAPnviQ9YM=",
|
||||
"version": "2.26.3",
|
||||
"depsHash": "sha256-+UbOYtS0lumYajQklm0izgW6oNb0QcxvDKYtRSFICj8=",
|
||||
"clientDepsHash": "sha256-5BHutO2aCvVWvN/LySMtgPPl9HQLsu8Tjj/k7FIiAr8="
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i nu -p nushell common-updater-scripts prefetch-npm-deps nix-prefetch-github
|
||||
|
||||
def main [] {
|
||||
let sourceFile = $"(pwd)/pkgs/by-name/au/audiobookshelf/source.json"
|
||||
let tags = list-git-tags --url=https://github.com/advplyr/audiobookshelf | lines | sort --natural | str replace v ''
|
||||
|
||||
let latest_tag = $tags | last
|
||||
let current_version = open $sourceFile | get version
|
||||
|
||||
if $latest_tag != $current_version {
|
||||
let source = nix-prefetch-github advplyr audiobookshelf --rev $"v($latest_tag)" | from json | merge { version: $latest_tag, depsHash: "", clientDepsHash: ""}
|
||||
$source | save --force $sourceFile
|
||||
|
||||
let srcPath = nix-build $env.PWD -A audiobookshelf.src | complete | get stdout | lines | first
|
||||
|
||||
print $srcPath
|
||||
ls $srcPath
|
||||
|
||||
$source | merge {
|
||||
depsHash: (prefetch-npm-deps $"($srcPath)/package-lock.json"),
|
||||
clientDepsHash: (prefetch-npm-deps $"($srcPath)/client/package-lock.json")
|
||||
} | save --force $sourceFile
|
||||
|
||||
# appease the editorconfig CI check
|
||||
echo "\n" | save --append $sourceFile
|
||||
}
|
||||
|
||||
{before: $current_version, after: $latest_tag}
|
||||
}
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnused gawk nix-prefetch common-updater-scripts jq prefetch-npm-deps
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(dirname "$(readlink -f "$0")")"
|
||||
NIX_DRV="$ROOT/package.nix"
|
||||
if [ ! -f "$NIX_DRV" ]; then
|
||||
echo "ERROR: cannot find package.nix in $ROOT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO="advplyr/audiobookshelf"
|
||||
|
||||
NEW_VER=$(list-git-tags --url=https://github.com/$REPO | rg 'v[0-9\.]*$' | sed -e 's/^v//' | sort -V | tail -n 1)
|
||||
OLD_VER=$(nix-instantiate --eval -A audiobookshelf.version | jq --exit-status --raw-output)
|
||||
|
||||
if [ "$NEW_VER" == "$OLD_VER" ]; then
|
||||
echo "No update needed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
replace_hash() {
|
||||
sed -i "s#$1 = \"sha256-.\{44\}\"#$1 = \"$2\"#" "$NIX_DRV"
|
||||
}
|
||||
|
||||
get_npm_hash() {
|
||||
pushd "$(mktemp -d)" >/dev/null
|
||||
curl -s "https://raw.githubusercontent.com/$REPO/v$NEW_VER/$1" -o package-lock.json
|
||||
prefetch-npm-deps package-lock.json
|
||||
rm -f package-lock.json
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
src_hash() {
|
||||
nix-prefetch-git --url https://github.com/$REPO --rev "refs/tags/v${NEW_VER}" | jq --exit-status --raw-output .hash
|
||||
}
|
||||
|
||||
sed -i "s/version = \".*\"/version = \"$NEW_VER\"/" "$NIX_DRV"
|
||||
replace_hash "hash" "$(src_hash)"
|
||||
replace_hash "npmDepsHash" "$(get_npm_hash "package-lock.json")"
|
||||
replace_hash "clientNpmDepsHash" "$(get_npm_hash "client/package-lock.json")"
|
||||
Reference in New Issue
Block a user