67.16. tokei-15.0.0
Counts lines of code by language
| Version | 15.0.0, release 1 |
| Shelf | devtools — Debuggers, tracers, profilers, analysers, linters, language servers and developer utilities |
| Phase | 40_lang (Languages), 24 of 186 in build order |
| Licence | MIT OR Apache-2.0 |
| Homepage | https://github.com/XAMPPRocky/tokei |
| Build time | 3.2 SBU |
| Installed size | 5.9 MiB in 3 files |
| Recipe | ports/core/devtools/tokei/kpkgbuild |
About
tokei counts the lines of code, comments and blank lines in a source tree, per language.
Sources
tokei-15.0.0.tar.gz(161.3 KiB)
sha256966da7b9a81ac6cb777b9f159f4c02e5b83a8b8bd30ebf5991007839926b600c
upstream: https://github.com/XAMPPRocky/tokei/archive/refs/tags/v15.0.0.tar.gz
archive copy: sources-1/devtools--tokei-15.0.0.tar.gztokei-vendor-15.0.0.tar.xz(19.0 MiB)
sha25619a768c821dcf7444c9ab06c178e7ef5ebde10afa8f21c00e00d29dda663d017
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-1/devtools--tokei-vendor-15.0.0.tar.xz
Dependencies
Depends on: rust.
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/40_lang/phase.env && kpkg install tokei'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/devtools/tokei.
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/devtools/tokei
echo '966da7b9a81ac6cb777b9f159f4c02e5b83a8b8bd30ebf5991007839926b600c tokei-15.0.0.tar.gz' | sha256sum -c -
echo '19a768c821dcf7444c9ab06c178e7ef5ebde10afa8f21c00e00d29dda663d017 tokei-vendor-15.0.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/tokei
SRC=$SRC_ROOT/tokei-15.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf tokei-15.0.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 RUSTFLAGS="-C target-feature=-crt-static"
cargo build --release --frozen --offline --features all
install -Dm755 target/release/tokei $PKG/usr/bin/tokei
The switches, and why each is set:
--features all— Turn on thecborandyamloutput formats beside the defaultclifeature; JSON output needs no feature. Without it,tokei -o yamland-o cborare refused. Both are pure Rust crates from the vendor bundle.
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/tokei, 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 tokei-15.0.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/tokei, and runs the triggers its paths call for.
Contents
Installed programs: tokei.
Installed directories: /usr/share/licenses/tokei.