From 10a6847471b2a59a188f4eac4f9314f2b2dbfdf6 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 3 Jul 2024 15:56:43 +0200 Subject: [PATCH] discourse: fix update script after nix-universal-prefetch removal Replaces nix-universal-prefetch with nurl. --- pkgs/servers/web-apps/discourse/update.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pkgs/servers/web-apps/discourse/update.py b/pkgs/servers/web-apps/discourse/update.py index 5d17b9798b60..9d922de7c9cc 100755 --- a/pkgs/servers/web-apps/discourse/update.py +++ b/pkgs/servers/web-apps/discourse/update.py @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#! nix-shell -i python3 -p bundix bundler nix-update nix-universal-prefetch "python3.withPackages (ps: with ps; [ requests click click-log packaging ])" prefetch-yarn-deps +#! nix-shell -i python3 -p bundix bundler nix-update nurl "python3.withPackages (ps: with ps; [ requests click click-log packaging ])" prefetch-yarn-deps from __future__ import annotations import click @@ -301,6 +301,11 @@ def update_plugins(): name = plugin.get('name') repo_name = plugin.get('repo_name') or name + if fetcher == "fetchFromGitHub": + url = f"https://github.com/{owner}/{repo_name}" + else: + raise NotImplementedError(f"Missing URL pattern for {fetcher}") + repo = DiscourseRepo(owner=owner, repo=repo_name) # implement the plugin pinning algorithm laid out here: @@ -378,10 +383,11 @@ def update_plugins(): prev_hash = _nix_eval(f'discourse.plugins.{name}.src.outputHash') new_hash = subprocess.check_output([ - 'nix-universal-prefetch', fetcher, - '--owner', owner, - '--repo', repo_name, - '--rev', rev, + "nurl", + "--fetcher", fetcher, + "--hash", + url, + rev, ], text=True).strip("\n") click.echo(f"Update {name}, {prev_commit_sha} -> {rev} in {filename}")