vagd.patch ========== .. py:module:: vagd.patch Functions --------- .. autoapisummary:: vagd.patch._run_patchelf vagd.patch._executable vagd.patch._library_name vagd.patch._same_file vagd.patch.patch_binary Module Contents --------------- .. py:function:: _run_patchelf(patchelf: str, *args: str) -> subprocess.CompletedProcess .. py:function:: _executable(path: str) -> None Make an ELF artifact readable and executable without removing existing modes. .. py:function:: _library_name(patchelf: str, library: str) -> str Use the SONAME when available so DT_NEEDED can find renamed libraries. .. py:function:: _same_file(first: str, second: str) -> bool .. py:function:: patch_binary(binary: str, libraries: Optional[Sequence[str]] = None, interpreter: Optional[str] = None) -> Tuple[List[str], Optional[str]] Patch *binary* to use local ELF artifacts and return their staged paths. Libraries are copied beside the binary under their SONAME and found through ``$ORIGIN``. The interpreter is encoded as ``./`` so the exact same executable works locally and after upload. The first invocation preserves the unmodified executable as ``.bak``.