From 11eb02484b372c871d75c28c0f96cea5e6e5b55a Mon Sep 17 00:00:00 2001 From: squalus Date: Thu, 11 Jul 2024 08:57:48 -0700 Subject: [PATCH] electron: fix update script The nix-universal-prefetch package was deleted in 578d7e717. Switch to nurl. Fixes #321490 (cherry picked from commit 3ff51e1bb2c86cf7c48b724c6e715097366eabd4) --- pkgs/development/tools/electron/update.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/development/tools/electron/update.py b/pkgs/development/tools/electron/update.py index bf0f7a3a4758f..d547bcdc5f6ce 100755 --- a/pkgs/development/tools/electron/update.py +++ b/pkgs/development/tools/electron/update.py @@ -1,5 +1,5 @@ #! /usr/bin/env nix-shell -#! nix-shell -i python -p python3.pkgs.joblib python3.pkgs.click python3.pkgs.click-log nix nix-prefetch-git nix-universal-prefetch prefetch-yarn-deps prefetch-npm-deps +#! nix-shell -i python -p python3.pkgs.joblib python3.pkgs.click python3.pkgs.click-log nix nix-prefetch-git nurl prefetch-yarn-deps prefetch-npm-deps """ electron updater @@ -83,6 +83,7 @@ logger = logging.getLogger(__name__) click_log.basic_config(logger) +nixpkgs_path = os.path.dirname(os.path.realpath(__file__)) + "/../../../.." class Repo: fetcher: str @@ -304,11 +305,11 @@ def supported_version_range() -> range: @memory.cache def get_repo_hash(fetcher: str, args: dict) -> str: - cmd = ["nix-universal-prefetch", fetcher] - for arg_name, arg in args.items(): - cmd.append(f"--{arg_name}") - cmd.append(arg) - + expr = f'with import {nixpkgs_path} {{}};{fetcher}{{' + for key, val in args.items(): + expr += f'{key}="{val}";' + expr += '}' + cmd = ["nurl", "-H", "--expr", expr] print(" ".join(cmd), file=sys.stderr) out = subprocess.check_output(cmd) return out.decode("utf-8").strip()