Merge pull request #307655 from Mic92/pwndbg

pwngdb: make gdbinit.py self-contained

authored by Jörg Thalheim and committed by GitHub fe4d0e07 9170b4ba

+17 -5
+17 -5
pkgs/by-name/pw/pwndbg/package.nix
··· 18 python3.pkgs.ropgadget # ref: https://github.com/pwndbg/pwndbg/blob/2022.12.19/pwndbg/commands/rop.py#L32 19 ]); 20 in 21 - stdenv.mkDerivation rec { 22 pname = "pwndbg"; 23 version = lib.getVersion pwndbg-py; 24 format = "other"; ··· 31 runHook preInstall 32 33 mkdir -p $out/share/pwndbg 34 - cp gdbinit.py $out/share/pwndbg 35 chmod +x $out/share/pwndbg/gdbinit.py 36 37 # Don't require an in-package venv 38 touch $out/share/pwndbg/.skip-venv 39 40 makeWrapper ${gdb}/bin/gdb $out/bin/pwndbg \ 41 - --add-flags "-q -x $out/share/pwndbg/gdbinit.py" \ 42 - --prefix PATH : ${binPath} \ 43 - --set PYTHONPATH ${pythonPath} \ 44 45 runHook postInstall 46 ''; 47 48 meta = with lib; {
··· 18 python3.pkgs.ropgadget # ref: https://github.com/pwndbg/pwndbg/blob/2022.12.19/pwndbg/commands/rop.py#L32 19 ]); 20 in 21 + stdenv.mkDerivation { 22 pname = "pwndbg"; 23 version = lib.getVersion pwndbg-py; 24 format = "other"; ··· 31 runHook preInstall 32 33 mkdir -p $out/share/pwndbg 34 + cp gdbinit.py $out/share/pwndbg/gdbinit.py 35 chmod +x $out/share/pwndbg/gdbinit.py 36 + # First line is a import from future, so we need to append our imports after that 37 + sed '2 i import sys, os 38 + 3 i [sys.path.append(p) for p in "${pythonPath}".split(":")] 39 + 4 i os.environ["PATH"] += ":${binPath}"' -i $out/share/pwndbg/gdbinit.py 40 41 # Don't require an in-package venv 42 touch $out/share/pwndbg/.skip-venv 43 44 makeWrapper ${gdb}/bin/gdb $out/bin/pwndbg \ 45 + --add-flags "-q -x $out/share/pwndbg/gdbinit.py" 46 47 runHook postInstall 48 + ''; 49 + 50 + doInstallCheck = true; 51 + installCheckPhase = '' 52 + runHook preInstallCheck 53 + 54 + # Check if pwndbg is installed correctly 55 + HOME=$TMPDIR LC_CTYPE=C.UTF-8 $out/bin/pwndbg -ex exit 56 + 57 + runHook postInstallCheck 58 ''; 59 60 meta = with lib; {