93.2. dust-1.2.6
Disk usage as a tree, a du alternative (Rust)
| Version | 1.2.6, release 1 |
| Shelf | files — File managers, disk-usage analysers, duplicate finders and file locators |
| Phase | 41_system (System), 500 of 1047 in build order |
| Licence | Apache-2.0 |
| Homepage | https://github.com/bootandy/dust |
| Build time | 3.7 SBU |
| Installed size | 2.8 MiB in 7 files |
| Recipe | ports/core/files/dust/kpkgbuild |
About
dust shows what is filling a disk as a tree: the largest directories under a path, each with a bar for its share of the whole, sorted so the biggest entries sit next to the prompt. It answers the question du -sh * | sort -h asks, in one command. The interactive shell aliases it as dud (/etc/bash.bashrc). The recipe writes a terminal desktop entry for it with NoDisplay=true: dust prints its report and exits, so a Start row would open a terminal that closes at once.
Sources
dust-1.2.6.tar.gz(374.2 KiB)
sha2569dd1ec7576d43574e6f48342cb96a5087338b4c308460a848f5895f72ddc3bc9
upstream: https://github.com/bootandy/dust/archive/v1.2.6.tar.gz
archive copy: sources-2/files--dust-1.2.6.tar.gzdust-vendor-1.2.6.tar.xz(16.8 MiB)
sha2567e4d521ef3e594b593ef6979544efc99233043f5d23a5529c1dcd6bf9a908bce
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-2/files--dust-vendor-1.2.6.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 dust'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/files/dust.
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/files/dust
echo '9dd1ec7576d43574e6f48342cb96a5087338b4c308460a848f5895f72ddc3bc9 dust-1.2.6.tar.gz' | sha256sum -c -
echo '7e4d521ef3e594b593ef6979544efc99233043f5d23a5529c1dcd6bf9a908bce dust-vendor-1.2.6.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/dust
SRC=$SRC_ROOT/dust-1.2.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf dust-1.2.6.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/dust $PKG/usr/bin/dust
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/dust.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Disk Usage (dust)
GenericName=Disk Usage Analyser
Comment=A tree of what is filling the disk
Exec=dust
Icon=drive-harddisk
Terminal=true
NoDisplay=true
Categories=System;Filesystem;
Keywords=disk;usage;space;du;dust;
EOF
chmod 644 "$PKG/usr/share/applications/dust.desktop"
install -Dm644 man-page/dust.1 "$PKG/usr/share/man/man1/dust.1"
install -Dm644 completions/dust.bash "$PKG/usr/share/bash-completion/completions/dust"
install -Dm644 completions/dust.fish "$PKG/usr/share/fish/vendor_completions.d/dust.fish"
install -Dm644 completions/_dust "$PKG/usr/share/zsh/site-functions/_dust"
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/dust, 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 dust-1.2.6-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/dust, and runs the triggers its paths call for.
Contents
Installed programs: dust.
Installed directories: /usr/share/licenses/dust.
Short descriptions
dust |
Like du but more intuitive |
Notes
The Rust crates it builds against come from the vendor bundle, dust-vendor-<version>.tar.xz, which ports/fetch writes with cargo vendor and pins with its own sha256 = line; build.sh unpacks it at the top of the tree and cargo builds --frozen --offline from it (see Vendoring).
The manual page and the bash, fish and zsh completions are upstream’s pre-generated files in man-page/ and completions/, installed as they are.