107.5. doggo-1.4.0
Command-line DNS client
| Version | 1.4.0, release 1 |
| Shelf | net-diag — Network diagnostics, capture, measurement and low-level socket tools |
| Phase | 41_system (System), 784 of 1047 in build order |
| Licence | GPL-3.0-only |
| Homepage | https://doggo.mrkaran.dev/ |
| Build time | 0.6 SBU |
| Installed size | 16.2 MiB in 5 files |
| Recipe | ports/core/net-diag/doggo/kpkgbuild |
About
doggo is a command-line DNS client in Go, in the manner of dig: it sends a query over UDP, TCP, DoT, DoH, DoQ or DNSCrypt and prints the answer as a table or as JSON. It is built from its Go vendor bundle with cgo off.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/net-diag.txt:
A DNS client with readable output, on a machine expected to BE the DNS server for an island network.
Sources
doggo-1.4.0.tar.gz(2.4 MiB)
sha256e0d043aa34fb8daa44df07558fd32fe2686eba6644d5f6834edbc8a789d42e1d
upstream: https://github.com/mr-karan/doggo/archive/refs/tags/v1.4.0.tar.gz
archive copy: sources-3/net-diag--doggo-1.4.0.tar.gzdoggo-vendor-1.4.0.tar.xz(2.3 MiB)
sha2567b52c5ff4bb1744dfb19790d35056615d49f4be2db4a1758162bcdb03bf9d642
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-3/net-diag--doggo-vendor-1.4.0.tar.xz
Dependencies
Depends on: go.
Required by: no port names it.
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 doggo'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-diag/doggo.
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/net-diag/doggo
echo 'e0d043aa34fb8daa44df07558fd32fe2686eba6644d5f6834edbc8a789d42e1d doggo-1.4.0.tar.gz' | sha256sum -c -
echo '7b52c5ff4bb1744dfb19790d35056615d49f4be2db4a1758162bcdb03bf9d642 doggo-vendor-1.4.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/doggo
SRC=$SRC_ROOT/doggo-1.4.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf doggo-1.4.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
export CGO_ENABLED=0
go build -mod=vendor -ldflags "-s -w -X main.buildVersion=v$version" -o doggo ./cmd/doggo
install -Dm755 doggo $PKG/usr/bin/doggo
./doggo completions bash > doggo.bash
./doggo completions zsh > _doggo
./doggo completions fish > doggo.fish
install -Dm644 doggo.bash $PKG/usr/share/bash-completion/completions/doggo
install -Dm644 _doggo $PKG/usr/share/zsh/site-functions/_doggo
install -Dm644 doggo.fish $PKG/usr/share/fish/vendor_completions.d/doggo.fish
The switches, and why each is set:
-X— sets the string variablemain.buildVersionat link time tov$version. doggo prints it fordoggo --versionand puts it in the User-Agent it sends to the Globalping service; left unset it readsunknown. Upstream’s own makefile sets it andmain.buildDate;build.shsets the version alone, sodoggo --versionprintsunknownfor the date.
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/doggo, 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 doggo-1.4.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/doggo, and runs the triggers its paths call for.
Contents
Installed programs: doggo.
Installed directories: /usr/share/licenses/doggo.
Notes
build.sh runs the binary it has just built, ./doggo completions bash|zsh|fish, to write the three shell completion files it installs; doggo handles the completions word before it reads any configuration.