summary refs log tree commit diff
path: root/pkgs/development/tools/analysis/radare2/update.py
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/analysis/radare2/update.py')
-rwxr-xr-xpkgs/development/tools/analysis/radare2/update.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/development/tools/analysis/radare2/update.py b/pkgs/development/tools/analysis/radare2/update.py
index fae6a52a3920..45920fd1e4bf 100755
--- a/pkgs/development/tools/analysis/radare2/update.py
+++ b/pkgs/development/tools/analysis/radare2/update.py
@@ -13,6 +13,8 @@ from datetime import datetime
 from pathlib import Path
 from typing import Dict
 
+SCRIPT_DIR = Path(__file__).parent.resolve()
+
 
 def sh(*args: str) -> str:
     out = subprocess.check_output(list(args))
@@ -34,8 +36,17 @@ def get_radare2_rev() -> str:
     return release["tag_name"]
 
 
+def get_cutter_version() -> str:
+    version_expr = """
+(with import <nixpkgs> {}; (builtins.parseDrvName (qt5.callPackage ./cutter.nix {}).name).version)
+"""
+    with SCRIPT_DIR:
+        return sh("nix", "eval", "--raw", version_expr.strip())
+
+
 def get_r2_cutter_rev() -> str:
-    url = "https://api.github.com/repos/radareorg/cutter/contents/"
+    version = get_cutter_version()
+    url = f"https://api.github.com/repos/radareorg/cutter/contents?ref=v{version}"
     with urllib.request.urlopen(url) as response:
         data = json.load(response)  # type: ignore
     for entry in data: