feat: add `debian_launcher`/`patchelf_unpack` rules
Use `patchelf_unpack` to unpack the downloaded packages and patch the ELF interpreter path:
```py
patchelf_unpack(
name = "patched",
# `rules_distroless#apt` extension is *highly* recommended
srcs = ["@debian-bookworm-qemu//:packages"],
filters = [
"usr/share/doc/**", # No need to unpack documentation
"lib64/ld-linux-*.so.?", # Remove dangling symlink
],
)
```
Use `patchelf_launcher` to launch a binary from the unpacked directory:
```py
patchelf_launcher(
name = "qemu-system-x86_64",
srcs = [
":patched",
"@rules_patchelf//patchelf/launcher/elf/interpreter/debian",
"@rules_patchelf//patchelf/launcher/library/path/debian",
],
env = {
"TMPDIR": "./tmp",
},
)
```
Run the binary:
```console
$ bazelisk run -- :qemu-system-x86_64 --version
QEMU emulator version 7.2.13 (Debian 1:7.2+dfsg-7+deb12u7)
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
```
Closes rfc#1
Loading
-
mentioned in commit b6ddfd2f
By GITLAB_TOKEN on 2025-02-12T09:13:58
Please register or sign in to comment