about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-10-16 14:01:08 -0500
committerWill Dietz <w@wdtz.org>2018-10-16 14:05:01 -0500
commit26dfc0c533a226de7bc2b0e93f6cac6009247e6e (patch)
tree7c4f613029b5d89db9c6812024963809c33de345 /pkgs/development
parent6fdc1655649076262a93cddd4cb389457a0287e4 (diff)
downloadnixlib-26dfc0c533a226de7bc2b0e93f6cac6009247e6e.tar
nixlib-26dfc0c533a226de7bc2b0e93f6cac6009247e6e.tar.gz
nixlib-26dfc0c533a226de7bc2b0e93f6cac6009247e6e.tar.bz2
nixlib-26dfc0c533a226de7bc2b0e93f6cac6009247e6e.tar.lz
nixlib-26dfc0c533a226de7bc2b0e93f6cac6009247e6e.tar.xz
nixlib-26dfc0c533a226de7bc2b0e93f6cac6009247e6e.tar.zst
nixlib-26dfc0c533a226de7bc2b0e93f6cac6009247e6e.zip
radare2: fix update script to handle invocation from elsewhere
It looks like `with Path:` is supposed to be a context-manager
for changing directory but it doesn't seem to work and the only
way I've found to make that work is if we made our own and annotated it.

Instead just use nix search path to tell the expression where
to find the file it looks for.

Also re-use SCRIPT_DIR elsewhere instead of re-"computing" it.
Diffstat (limited to 'pkgs/development')
-rwxr-xr-xpkgs/development/tools/analysis/radare2/update.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/pkgs/development/tools/analysis/radare2/update.py b/pkgs/development/tools/analysis/radare2/update.py
index 45920fd1e4bf..684d70bc0bc4 100755
--- a/pkgs/development/tools/analysis/radare2/update.py
+++ b/pkgs/development/tools/analysis/radare2/update.py
@@ -38,10 +38,9 @@ def get_radare2_rev() -> str:
 
 def get_cutter_version() -> str:
     version_expr = """
-(with import <nixpkgs> {}; (builtins.parseDrvName (qt5.callPackage ./cutter.nix {}).name).version)
+(with import <nixpkgs> {}; (builtins.parseDrvName (qt5.callPackage <radare2/cutter.nix> {}).name).version)
 """
-    with SCRIPT_DIR:
-        return sh("nix", "eval", "--raw", version_expr.strip())
+    return sh("nix", "eval", "--raw", version_expr.strip(), "-I", "radare2={0}".format(SCRIPT_DIR))
 
 
 def get_r2_cutter_rev() -> str:
@@ -109,7 +108,7 @@ def main() -> None:
             "https://github.com/radare/radare2",
             ".",
         )
-        nix_file = str(Path(__file__).parent.joinpath("default.nix"))
+        nix_file = str(SCRIPT_DIR.joinpath("default.nix"))
 
         radare2_info = get_repo_info(dirname, radare2_rev)