Portable build changes (#3290)

* fix pwnlib

* fix pwnlib

* change bundle

* fixy
pull/3292/head
patryk4815 3 months ago committed by GitHub
parent 2195afbc33
commit 4443a0db80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -377,18 +377,6 @@ def bundle_python_venv(src_lib_dir: Path, out_lib_dir: Path, root_dst: Path):
'.dylib',
))
is_good_ext = src_file_path.suffix in (
'.py', # python script file
'.pyi', '.typed', # python types
'.asm', # pwntools asm templates
)
is_good_name = src_file_path.name in (
'__doc__', # pwntools asm templates
)
if not (is_so or is_good_ext or is_good_name):
continue
real_file = copy_with_symlink_normal(src_file_path, src_lib_dir, out_lib_dir, is_so=is_so)
if is_so and real_file:
bundle_binaries.add(real_file)

@ -187,20 +187,25 @@ let
# writable out
chmod -R +w $out
# remove unneeded dirs
rm -rf $out/pwndbg/lib/pkgconfig
find $out/pwndbg/lib/${python3.libPrefix}/ -type d -name "__pycache__" -exec rm -rf {} +
find $out/pwndbg/lib/${python3.libPrefix}/ -type d -name "*.dist-info" -exec rm -rf {} +
find $out/pwndbg/lib/${python3.libPrefix}/ -maxdepth 1 -type d -name "config-*" -exec rm -rf {} +
# EXTERNALLY-MANAGED info
echo -e "[externally-managed]\nError=This is a pwndbg-portable installation.\n Installing additional dependencies is not supported." > $out/pwndbg/lib/${python3.libPrefix}/EXTERNALLY-MANAGED
# copy extra files
mkdir -p $out/pwndbg/share/
cp -rf ${lib.getLib pkgs.ncurses}/share/terminfo/ $out/pwndbg/share/
# fix ipython autocomplete
cp -rf ${pwndbgVenv}/lib/${python3.libPrefix}/site-packages/parso/python/*.txt $out/pwndbg/lib/${python3.libPrefix}/site-packages/parso/python/
# fix ziglang
cp -rf ${pwndbgVenv}/lib/${python3.libPrefix}/site-packages/ziglang/zig $out/pwndbg/lib/${python3.libPrefix}/site-packages/ziglang/
cp -rf ${pwndbgVenv}/lib/${python3.libPrefix}/site-packages/ziglang/lib $out/pwndbg/lib/${python3.libPrefix}/site-packages/ziglang/
# fix python "subprocess.py" to use "/bin/sh" and not the nix'ed version, otherwise "gdb-pt-dump" is broken
sed -i 's@/nix/store/.*/bin/sh@/bin/sh@' $out/pwndbg/lib/${python3.libPrefix}/subprocess.py
# remove /nix/store references in all files
find $out/pwndbg/ -type f -exec ${pkgsNative.nukeReferences}/bin/nuke-refs {} +
# build pycache
SOURCE_DATE_EPOCH=0 ${pkgsNative.python3}/bin/python3 -c "import compileall; compileall.compile_dir('$out', stripdir='$out', force=True);"
'';

Loading…
Cancel
Save