91.6. zoxide-0.10.0
A cd command that ranks directories by use
| Version | 0.10.0, release 1 |
| Shelf | shells — Interactive shells and their add-ons, terminal multiplexers, and terminal emulators |
| Phase | 41_system (System), 951 of 1047 in build order |
| Licence | MIT |
| Homepage | https://github.com/ajeetdsouza/zoxide |
| Build time | 2.7 SBU |
| Installed size | 1.1 MiB in 11 files |
| Recipe | ports/core/shells/zoxide/kpkgbuild |
About
zoxide is a cd that remembers which directories are used and how recently, and jumps to the best match for a few letters. The system bash.bashrc runs zoxide init bash --cmd j, so the jump command is j (see Shell environment).
Sources
zoxide-0.10.0.tar.gz(148.2 KiB)
sha2564fcd4272b013a10b637dbcc299c58a9924b94470a9042677ca1a204cc2e9150e
upstream: https://github.com/ajeetdsouza/zoxide/archive/v0.10.0.tar.gz
archive copy: sources-4/shells--zoxide-0.10.0.tar.gzzoxide-vendor-0.10.0.tar.xz(7.0 MiB)
sha256a1d486590a75773c39877a60317790e9e4d3630ec9b62a099c9cd20e2d30ac15
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-4/shells--zoxide-vendor-0.10.0.tar.xz
Dependencies
Depends on: rust.
Required by (1): yazi.
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 zoxide'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/shells/zoxide.
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/shells/zoxide
echo '4fcd4272b013a10b637dbcc299c58a9924b94470a9042677ca1a204cc2e9150e zoxide-0.10.0.tar.gz' | sha256sum -c -
echo 'a1d486590a75773c39877a60317790e9e4d3630ec9b62a099c9cd20e2d30ac15 zoxide-vendor-0.10.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/zoxide
SRC=$SRC_ROOT/zoxide-0.10.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf zoxide-0.10.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
install -Dm755 target/release/zoxide $PKG/usr/bin/zoxide
install -Dm644 man/man1/*.1 -t "$PKG/usr/share/man/man1"
install -Dm644 contrib/completions/zoxide.bash $PKG/usr/share/bash-completion/completions/zoxide
install -Dm644 contrib/completions/_zoxide $PKG/usr/share/zsh/site-functions/_zoxide
install -Dm644 contrib/completions/zoxide.fish $PKG/usr/share/fish/vendor_completions.d/zoxide.fish
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/zoxide, 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 zoxide-0.10.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/zoxide, and runs the triggers its paths call for.
Contents
Installed programs: zoxide.
Installed directories: /usr/share/licenses/zoxide.
Short descriptions
zoxide |
a smarter cd command |
Notes
The crates come from the vendor bundle, zoxide-vendor-<version>.tar.xz, made by ports/fetch with cargo vendor and unpacked into the top of the source tree, where cargo finds its configuration; the build runs --frozen --offline (see Vendoring). cargo builds only the binary, so build.sh copies the manual pages and the bash, zsh and fish completions from the source tree to the places each shell reads them.