Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

68.3. jujutsu-0.45.1

Git-compatible version control system with an operation log

Version 0.45.1, release 1
Shelf vcs — Version control and diff/merge tools
Phase 40_lang (Languages), 184 of 186 in build order
Licence Apache-2.0
Homepage https://jj-vcs.github.io/jj/
Build time 7.3 SBU
Installed size 31.2 MiB in 127 files
Recipe ports/core/vcs/jujutsu/kpkgbuild

About

Jujutsu, the jj command, is a version control system whose repositories are ordinary git repositories, so git keeps working on the same tree. Every operation on the repository is recorded in an operation log, and jj op restore puts the whole repository back to any recorded moment. For fetch and push it runs the git command, so git is in depends.

It is a Rust program built with cargo from its vendor bundle, the second sha256 = line, with its default features, git and watchman (see Vendoring).

Why it is in KDOS

The comment above it in script/phases/40_lang/packages.d/vcs.txt:

jj op restore puts the repository back to any earlier moment. The usual recovery from a bad rebase is to re-clone from the remote, and there is no remote.

Sources

Dependencies

Depends on: rust, git.

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 jujutsu'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/vcs/jujutsu.

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/vcs/jujutsu
echo '72bf95905a92c592dd0e7316e2cbbad9a8f2ca04ca770cc4f4f7960495a44e15  jujutsu-0.45.1.tar.gz' | sha256sum -c -
echo 'da212f3b5c5a8f0d7e73e07bfae0b1bb50441cb6fafc511e405946f4ed675923  jujutsu-vendor-0.45.1.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/jujutsu
SRC=$SRC_ROOT/jujutsu-0.45.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf jujutsu-0.45.1.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 OPENSSL_NO_VENDOR=1
export RUSTFLAGS="-C target-feature=-crt-static"
cargo build --release --frozen --offline --bin jj
install -Dm755 target/release/jj $PKG/usr/bin/jj
target/release/jj util install-man-pages "$PKG/usr/share/man"
for _sh in bash zsh fish; do
	target/release/jj util completion $_sh > jj.$_sh
done
install -Dm644 jj.bash $PKG/usr/share/bash-completion/completions/jj
install -Dm644 jj.zsh  $PKG/usr/share/zsh/site-functions/_jj
install -Dm644 jj.fish $PKG/usr/share/fish/vendor_completions.d/jj.fish

The switches, and why each is set:

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/jujutsu, 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 jujutsu-0.45.1-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/jujutsu, and runs the triggers its paths call for.

Contents

Installed programs: jj.

Installed directories: /usr/share/licenses/jujutsu.

Short descriptions

jj Jujutsu (An experimental VCS)

Notes

The manual pages and the shell completions are written by the program just built: jj util install-man-pages and jj util completion bash, zsh and fish. A jj that cannot run in the build root fails the build there, after cargo build has succeeded.