110.1. pizauth-1.1.0
Obtains and refreshes OAuth2 tokens for mail clients
| Version | 1.1.0, release 1 |
| Shelf | mail — Email clients, fetch and send tools, mail libraries, and feed readers |
| Phase | 41_system (System), 730 of 1047 in build order |
| Licence | Apache-2.0 OR MIT |
| Homepage | https://tratt.net/laurie/src/pizauth/ |
| Build time | 2.6 SBU |
| Installed size | 5.1 MiB in 9 files |
| Recipe | ports/core/mail/pizauth/kpkgbuild |
About
pizauth obtains and refreshes OAuth2 access tokens for mail programs, for providers that refuse a plain password over IMAP and SMTP. It runs as a per-user daemon; pizauth show <account> prints a current token, which a mail program reads as its password. aerc and msmtp present it over OAUTHBEARER or XOAUTH2, and mbsync over XOAUTH2 only, through cyrus-sasl and cyrus-sasl-xoauth2 (see isync). It is written in Rust, and its HTTP client uses rustls, so nothing links openssl for it.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/mail.txt:
THE TOKEN A PROVIDER WANTS INSTEAD OF A PASSWORD. aerc and msmtp present it over OAUTHBEARER or XOAUTH2, and mbsync over XOAUTH2 only, through cyrus-sasl-xoauth2. Rust, and its HTTP client is rustls, so nothing links openssl for it.
Sources
pizauth-1.1.0.tar.gz(71.5 KiB)
sha2561e7219795937160f74fabfe98e948818a1fa28cfc9dc9b7bcfb6853bce5fb72d
upstream: https://github.com/ltratt/pizauth/archive/refs/tags/pizauth-1.1.0.tar.gz
archive copy: sources-3/mail--pizauth-1.1.0.tar.gzpizauth-vendor-1.1.0.tar.xz(15.0 MiB)
sha256ba4edb5ddd5125a1ffcce5137a073d8dc662b041928af9805227fa28f06ab8be
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-3/mail--pizauth-vendor-1.1.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 pizauth'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/mail/pizauth.
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/mail/pizauth
echo '1e7219795937160f74fabfe98e948818a1fa28cfc9dc9b7bcfb6853bce5fb72d pizauth-1.1.0.tar.gz' | sha256sum -c -
echo 'ba4edb5ddd5125a1ffcce5137a073d8dc662b041928af9805227fa28f06ab8be pizauth-vendor-1.1.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/pizauth
SRC=$SRC_ROOT/pizauth-1.1.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf pizauth-1.1.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/pizauth $PKG/usr/bin/pizauth
install -Dm644 pizauth.1 -t $PKG/usr/share/man/man1
install -Dm644 pizauth.conf.5 -t $PKG/usr/share/man/man5
install -Dm644 share/bash/completion.bash $PKG/usr/share/bash-completion/completions/pizauth
install -Dm644 share/fish/pizauth.fish $PKG/usr/share/fish/vendor_completions.d/pizauth.fish
install -Dm644 share/zsh/_pizauth $PKG/usr/share/zsh/site-functions/_pizauth
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/pizauth, 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 pizauth-1.1.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/pizauth, and runs the triggers its paths call for.
Contents
Installed programs: pizauth.
Installed directories: /usr/share/licenses/pizauth.
Short descriptions
pizauth |
OAuth2 authentication daemon |
Notes
The crates come from the vendor bundle, pizauth-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 crate’s one optional feature, systemd, adds sd-notify readiness reports; the recipe builds the default features, so it is not compiled in. The manual pages, pizauth(1) and pizauth.conf(5), and the bash, fish and zsh completions are upstream’s own files, installed as they are.