92.12. hexyl-0.17.0
Hex viewer that colours bytes by class
| Version | 0.17.0, release 1 |
| Shelf | cli — Command-line productivity utilities: search, view, navigation and text wrangling in the terminal |
| Phase | 41_system (System), 293 of 1047 in build order |
| Licence | MIT OR Apache-2.0 |
| Homepage | https://github.com/sharkdp/hexyl |
| Build time | 1.3 SBU |
| Installed size | 1.3 MiB in 4 files |
| Recipe | ports/core/cli/hexyl/kpkgbuild |
About
hexyl is a hex viewer for the terminal. It colours each byte by its class (NUL, printable ASCII, ASCII whitespace, other ASCII and non-ASCII), so the structure of a binary file shows without a legend. The port installs hexyl and its manual page.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/cli.txt:
Colours by byte class, so structure in a binary is visible without a legend.
Sources
hexyl-0.17.0.tar.gz(190.3 KiB)
sha25672fa17397ad187eec6b295d02c7caabbb209a6e0d5706187b8a599bd5df8615e
upstream: https://github.com/sharkdp/hexyl/archive/refs/tags/v0.17.0.tar.gz
archive copy: sources-1/cli--hexyl-0.17.0.tar.gzhexyl-vendor-0.17.0.tar.xz(7.7 MiB)
sha256c62a13205347046ab3720427003208bce6dbbb9c902bcd3018710b6a193b53dd
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-1/cli--hexyl-vendor-0.17.0.tar.xz
Dependencies
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 hexyl'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/cli/hexyl.
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/cli/hexyl
echo '72fa17397ad187eec6b295d02c7caabbb209a6e0d5706187b8a599bd5df8615e hexyl-0.17.0.tar.gz' | sha256sum -c -
echo 'c62a13205347046ab3720427003208bce6dbbb9c902bcd3018710b6a193b53dd hexyl-vendor-0.17.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/hexyl
SRC=$SRC_ROOT/hexyl-0.17.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf hexyl-0.17.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 CARGO_HOME="$SRC_ROOT/.cargo"
export RUSTFLAGS="-C target-feature=-crt-static"
export CARGO_NET_OFFLINE=true
cargo build --release --frozen --offline
install -Dm755 target/release/hexyl $PKG/usr/bin/hexyl
lowdown -s -Tman -M "source=hexyl $version" -o target/hexyl.1 doc/hexyl.1.md
install -Dm644 target/hexyl.1 $PKG/usr/share/man/man1/hexyl.1
The switches, and why each is set:
-M— Give lowdown the manual page’ssourcefield,hexyl <version>. The Markdown page’s title block carries a version string of its own, which need not match the release, and lowdown takes the value given here over the document’s.
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/hexyl, 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 hexyl-0.17.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/hexyl, and runs the triggers its paths call for.
Contents
Installed programs: hexyl.
Installed directories: /usr/share/licenses/hexyl.
Short descriptions
hexyl |
a command-line hex viewer |
Notes
hexyl is built from a vendor bundle, hexyl-vendor-<version>.tar.xz, made by ports/fetch with cargo vendor; see Vendoring.