103.8. aardvark-dns-2.1.0
Authoritative DNS server for container networks (Rust)
| Version | 2.1.0, release 1 |
| Shelf | containers — Container runtimes, image tools, container networking and sandbox primitives |
| Phase | 41_system (System), 312 of 1047 in build order |
| Licence | Apache-2.0 |
| Homepage | https://github.com/containers/aardvark-dns |
| Build time | 2.1 SBU |
| Installed size | 3.1 MiB in 2 files |
| Recipe | ports/core/containers/aardvark-dns/kpkgbuild |
About
aardvark-dns is the DNS server of a podman network: netavark starts it for networks that have DNS enabled, and it answers containers’ queries for each other’s names (A and AAAA records, and PTR for the reverse lookup of their addresses) on the bridge’s own address, forwarding any other query to the configured resolvers. Podman finds it as a helper, at /usr/libexec/podman/aardvark-dns.
Sources
aardvark-dns-2.1.0.tar.gz(59.8 KiB)
sha256daf871488603e659b0501224cf0731ac317809b1d1701fc061cb4f6ae39a894f
upstream: https://github.com/containers/aardvark-dns/archive/refs/tags/v2.1.0.tar.gz
archive copy: sources-1/containers--aardvark-dns-2.1.0.tar.gzaardvark-dns-vendor-2.1.0.tar.xz(12.2 MiB)
sha256bbeb6dac42e0e82fd4937235bfe52a8f71e52e605057c2a34eb854f8c3d0683d
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-1/containers--aardvark-dns-vendor-2.1.0.tar.xz
Dependencies
Depends on: rust.
Required by (2): buildah, podman.
Patches
build.sh applies these; kpkg applies nothing by itself.
musl-close-range.patch— At start aardvark-dns closes every file descriptor it inherited above standard error withlibc::close_range(). On Linux the Rustlibccrate declares that function for glibc targets only, not for musl, so the patch makes the same call as a raw system call,libc::syscall(libc::SYS_close_range, …), which the crate does declare for musl.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install aardvark-dns'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/containers/aardvark-dns.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/containers/aardvark-dns
echo 'daf871488603e659b0501224cf0731ac317809b1d1701fc061cb4f6ae39a894f aardvark-dns-2.1.0.tar.gz' | sha256sum -c -
echo 'bbeb6dac42e0e82fd4937235bfe52a8f71e52e605057c2a34eb854f8c3d0683d aardvark-dns-vendor-2.1.0.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/aardvark-dns
SRC=$SRC_ROOT/aardvark-dns-2.1.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf aardvark-dns-2.1.0.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
patch -p1 -i "$PORT_SRC/musl-close-range.patch"
export CARGO_HOME="$SRC_ROOT/.cargo"
export RUSTFLAGS="-C target-feature=-crt-static"
export LIBCLANG_PATH=/usr/lib
cargo build --release --frozen --offline
install -Dm755 target/release/aardvark-dns "$PKG/usr/libexec/podman/aardvark-dns"
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/aardvark-dns, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf aardvark-dns-2.1.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/aardvark-dns, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/licenses/aardvark-dns.
Notes
aardvark-dns is built from a vendor bundle, aardvark-dns-vendor-<version>.tar.xz, made by ports/fetch with cargo vendor; see Vendoring. The patch touches only aardvark-dns’s own src/main.rs, not a vendored crate, so cargo’s checksums of the vendored files are unaffected.