Kakadu SDK and Sipi builds¶
Sipi's JPEG2000 support uses the proprietary Kakadu SDK. The
SDK is not redistributable, so it lives in the private
dasch-swiss/dsp-ci-assets
repo as a release asset. Bazel fetches it at build time via a
custom kakadu_archive repository_rule that shells out to
gh release download. The SHA-256 is pinned, so builds are fully
reproducible and verifiable.
How it works¶
The repository_rule is declared in
bazel/kakadu.bzl
and registered in MODULE.bazel. On the first bazel build
invocation that needs Kakadu (most do — //src/cli:sipi,
//src:image, every test that links sipi), Bazel:
- Resolves the
ghbinary on PATH (the dev shell provides it). - Calls
gh release download <tag> --repo dasch-swiss/dsp-ci-assets --pattern v8_5-XXX.zipinto Bazel's repository cache. - Verifies the downloaded archive against the pinned SHA-256.
- Exposes the unpacked source tree as
@kakadu_archive//:archivefor the foreign_cc rule under//ext/kakaduto consume.
After the first download, the archive lives in Bazel's content- addressed repository cache and never re-downloads (until the SHA pin moves).
Local-dev requirements¶
- Membership in the
dasch-swissGitHub organisation. gh auth logincompleted once (soghresolves a usable PAT).- The dev shell active (
nix develop);ghis on PATH there.
That's it. There is no vendor/ step, no
just kakadu-fetch recipe, no GH_TOKEN export. gh reads its
token from ~/.config/gh/hosts.yml automatically.
gh auth login # one-time
nix develop
just bazel-build # repository_rule fetches Kakadu on first build
CI requirements¶
Every Bazel-invoking workflow step sets
GH_TOKEN: ${{ secrets.DASCHBOT_PAT }} on its env: block so the
kakadu_archive repository_rule can authenticate non-interactively.
The PAT is scoped to read dsp-ci-assets. Bazel's repository cache
is keyed by SHA-256, so subsequent CI runs on the same key (and
the same MODULE.bazel.lock) reuse the download from the disk
cache.
Updating the Kakadu version¶
- Publish the new archive on
dsp-ci-assets(see itskakadu/README.md) - In
MODULE.bazel, update thekakadu_archiveextension's tag/asset/sha256 attributes to match the new release. - Run
bazel build //src/cli:sipi. A SHA-256 mismatch at this step means the pin disagrees with the published archive — check the release asset and the pin are consistent. - Run
just bazel-testto confirm the new SDK passes the test suite. - Commit
MODULE.bazelandMODULE.bazel.lock, open a PR.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
gh: command not found |
Outside the dev shell | nix develop |
release not found from gh |
Not authenticated, or no org membership | gh auth login; ask to be added to dasch-swiss |
Bazel: GH_TOKEN required |
CI: workflow step missing env: block |
Add GH_TOKEN: ${{ secrets.DASCHBOT_PAT }} to the offending step |
Bazel: sha256 mismatch |
Release asset replaced or pin out of date | Recompute SHA-256 and update MODULE.bazel |
Why not vendor it directly?¶
- Sipi is a public repo; Kakadu is proprietary — committing it would be a licence breach.
- Keeping it in
dsp-ci-assetsaligns the licence-compliance boundary with repo membership. - Hash-pinning in
MODULE.bazelgives reproducible, cacheable builds without the ~15 MB re-commit churn per version bump.