vagd.patch

Functions

_run_patchelf(→ subprocess.CompletedProcess)

_executable(→ None)

Make an ELF artifact readable and executable without removing existing modes.

_library_name(→ str)

Use the SONAME when available so DT_NEEDED can find renamed libraries.

_same_file(→ bool)

patch_binary(→ Tuple[List[str], Optional[str]])

Patch binary to use local ELF artifacts and return their staged paths.

Module Contents

vagd.patch._run_patchelf(patchelf: str, *args: str) → subprocess.CompletedProcess
vagd.patch._executable(path: str) → None

Make an ELF artifact readable and executable without removing existing modes.

vagd.patch._library_name(patchelf: str, library: str) → str

Use the SONAME when available so DT_NEEDED can find renamed libraries.

vagd.patch._same_file(first: str, second: str) → bool
vagd.patch.patch_binary(binary: str, libraries: Sequence[str] | None = None, interpreter: str | None = None) → Tuple[List[str], str | None]

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 ./<name> so the exact same executable works locally and after upload. The first invocation preserves the unmodified executable as <binary>.bak.