92.18. ttyper-1.6.0
Terminal touch-typing practice with per-key statistics
| Version | 1.6.0, release 1 |
| Shelf | cli — Command-line productivity utilities: search, view, navigation and text wrangling in the terminal |
| Phase | 41_system (System), 299 of 1047 in build order |
| Licence | MIT |
| Homepage | https://github.com/max-niederman/ttyper |
| Build time | 1.5 SBU |
| Installed size | 2.3 MiB in 3 files |
| Recipe | ports/core/cli/ttyper/kpkgbuild |
About
ttyper is touch-typing practice in the terminal: it shows a run of words, times you as you type it, and reports your speed in raw and accuracy-adjusted words per minute, your accuracy and your worst keys, with a chart of your speed across the test, then offers a new test made of the words you missed. The port installs the program and a desktop entry that opens it in a terminal as Typing Practice.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/cli.txt:
On a keyboard-driven desktop typing speed is throughput. ttyper rather than gtypist, whose last release was 2011.
Sources
ttyper-1.6.0.tar.gz(999.8 KiB)
sha256f7e4ff2f803483b17f35aa0c02977326a0546a95f5b465b4dd34ff17e45b4021
upstream: https://github.com/max-niederman/ttyper/archive/refs/tags/v1.6.0.tar.gz
archive copy: sources-1/cli--ttyper-1.6.0.tar.gzttyper-vendor-1.6.0.tar.xz(14.6 MiB)
sha2569204250e1852c4b0a675696be3d2040ed8b683d5c94294635c88be3640cbf945
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-1/cli--ttyper-vendor-1.6.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/41_system/phase.env && kpkg install ttyper'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/cli/ttyper.
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/ttyper
echo 'f7e4ff2f803483b17f35aa0c02977326a0546a95f5b465b4dd34ff17e45b4021 ttyper-1.6.0.tar.gz' | sha256sum -c -
echo '9204250e1852c4b0a675696be3d2040ed8b683d5c94294635c88be3640cbf945 ttyper-vendor-1.6.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/ttyper
SRC=$SRC_ROOT/ttyper-1.6.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf ttyper-1.6.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/$name $PKG/usr/bin/$name
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/ttyper.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Typing Practice
GenericName=Typing Test
Comment=Practise typing speed and accuracy
Exec=ttyper
Icon=system-run
Terminal=true
Categories=Game;Education;
Keywords=typing;speed;wpm;practice;ttyper;
EOF
chmod 644 "$PKG/usr/share/applications/ttyper.desktop"
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/ttyper, 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 ttyper-1.6.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/ttyper, and runs the triggers its paths call for.
Contents
Installed programs: ttyper.
Installed directories: /usr/share/licenses/ttyper.
Notes
ttyper is built from a vendor bundle, ttyper-vendor-<version>.tar.xz, made by ports/fetch with cargo vendor; see Vendoring and the rust build shape. Its build is that shape with nothing added.