104.12. nbdkit-1.48.1
NBD server toolkit with pluggable plugins and filters; serves disks to libvirt and QEMU
| Version | 1.48.1, release 1 |
| Shelf | virt — Virtual machines, their tooling, and remote-desktop and VNC protocols |
| Phase | 41_system (System), 1011 of 1047 in build order |
| Licence | BSD-3-Clause |
| Homepage | https://gitlab.com/nbdkit/nbdkit |
| Build time | 1.6 SBU |
| Installed size | 4.1 MiB in 251 files |
| Recipe | ports/core/virt/nbdkit/kpkgbuild |
About
nbdkit is a Network Block Device server built from plugins, each a source of disk data (a file, memory, a URL, an SSH or NFS path, a disk image built on the fly), and filters stacked over them. In KDOS libvirt runs it to serve network disks to guests. configure builds most plugins and filters whenever it finds their library, and only warns when it does not, even for a switch given as --with. build.sh names nearly every switch: those turned off stay off whatever the build root holds, and the libraries of those turned on are in depends.
Sources
nbdkit-1.48.1.tar.gz(2.7 MiB)
sha25621ddcdd0bb3cd49ec47aa2d7ca3e69941426e991932b44dc34a856d063f41ead
upstream: https://download.libguestfs.org/nbdkit/1.48-stable/nbdkit-1.48.1.tar.gz
archive copy: sources-4/virt--nbdkit-1.48.1.tar.gz
Dependencies
Depends on: pkgconf, perl, gnutls, libnbd, libnfs, curl, libssh, zlib, xz, zstd, bzip2, e2fsprogs, libisoburn, bash-completion, libbsd.
Required by (1): libvirt.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
--disable-perl, line 18: perl (explained with the switches below)--disable-python, line 19: python3--disable-ocaml, line 20: ocaml--disable-rust, line 21: rust--disable-tcl, line 22: tcl--disable-lua, line 23: lua--without-zlib-ng, line 35: zlib-ng (explained with the switches below)--without-libvirt, line 42: libvirt (explained with the switches below)
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 nbdkit'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/virt/nbdkit.
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/virt/nbdkit
echo '21ddcdd0bb3cd49ec47aa2d7ca3e69941426e991932b44dc34a856d063f41ead nbdkit-1.48.1.tar.gz' | 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/nbdkit
SRC=$SRC_ROOT/nbdkit-1.48.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf nbdkit-1.48.1.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 recipe’s helpers _series and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--libdir=/usr/lib \
--disable-valgrind \
--disable-probes \
--disable-perl \
--disable-python \
--disable-ocaml \
--disable-rust \
--disable-tcl \
--disable-lua \
--disable-golang \
--disable-torrent \
--disable-vram \
--disable-vddk \
--disable-libguestfs-tests \
--enable-linuxdisk \
--with-gnutls \
--with-iconv \
--with-curl \
--with-ssh \
--with-zlib \
--without-zlib-ng \
--with-bzip2 \
--with-liblzma \
--with-libzstd \
--with-libnbd \
--with-ext2 \
--with-manpages \
--without-libvirt \
--with-nfs \
--with-iso \
--without-libblkio \
--without-libguestfs \
--without-selinux \
--with-bash-completions \
--disable-static
make
make DESTDIR=$PKG install
The switches, and why each is set:
--disable-valgrind— Do not compile in Valgrind’s client request, with which the server checks whether it runs under Valgrind and then keeps plugins loaded at exit so Valgrind’s reports can name their functions.--disable-probes— No USDT tracing probes. They needsys/sdt.hfrom systemtap, which is not a port; configure turns them on by default on Linux.--disable-perl,--disable-python,--disable-ocaml,--disable-rust,--disable-tcl,--disable-lua,--disable-golang— The language plugins, each of which embeds an interpreter or a runtime so that plugins can be written in that language. All of them are left out.--disable-torrent— The BitTorrent plugin, which links libtorrent-rasterbar. Off, so that library does not end up beneath libvirt.--disable-vram— The plugin that serves a disk from a graphics card’s memory through OpenCL.--disable-vddk— The VMware VDDK plugin, which loads VMware’s proprietary library at run time.--disable-libguestfs-tests,--without-libguestfs— libguestfs, which is not a port, for the test suite and for the guestfs plugin.--enable-linuxdisk— The plugin that builds an ext2 disk image from a directory, runningmke2fs -dfrom e2fsprogs.--with-gnutls— TLS through GnuTLS.--with-iconv— Use iconv, which on musl is part of the C library. Thefloppyplugin converts file names with it when it writes the long names of a FAT image.--with-curl,--with-ssh,--with-nfs,--with-iso— The plugins that serve a disk from a URL that curl can fetch, an SSH server (libssh), an NFS export (libnfs), and an ISO image made from a directory, which runsxorrisofrom libisoburn.--with-zlib,--with-bzip2,--with-liblzma— The filters that serve a gzip-, bzip2-, xz- or lzip-compressed image, and zlib for the deflate clusters of theqcow2decfilter.--with-libzstd—allocator=zstd, with which thememoryanddataplugins keep their disk compressed in RAM, and the zstd clusters ofqcow2dec.--without-zlib-ng— Decompressqcow2dec’s deflate clusters with zlib rather than zlib-ng.--with-libnbd— Thenbdplugin, which proxies another NBD server through libnbd.--with-ext2— Theext2filter, which serves one file from inside an ext2, ext3 or ext4 image, through e2fsprogs’libext2fs.--with-manpages— Build the manual pages, from POD with perl.--without-libvirt— The libvirt plugin. libvirt’s own nbdkit backend runs this server, and linking the two in both directions is a dependency cycle.--without-libblkio,--without-selinux— libblkio and SELinux, neither of which is a port.--with-bash-completions— Install the bash completions, into the directory bash-completion’s pkg-config file names.
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/nbdkit, 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 nbdkit-1.48.1-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/nbdkit, and runs the triggers its paths call for.
Contents
Installed programs: nbdkit.
Installed directories: /usr/lib/nbdkit, /usr/share/licenses/nbdkit.
Short descriptions
nbdkit |
network block device (NBD) server |
nbdkit.pc |
A toolkit for creating NBD servers |