Skip to content

Commit 13eb5d4

Browse files
committed
DOC: Document local rattler-build invocation and stale package cache fix
Add two sections to README_Advanced.md: 1. "Local build invocation" — shows the correct way to call rattler-build locally (the dev pixi env does not bundle it; use the rattler cache path or pixi global install). 2. "Stale rattler package cache" — explains the hash mismatch error that occurs on repeated local builds and gives the one-line workaround: rm -rf ~/.cache/rattler/cache/pkgs/libitk-* Root cause documented: the staging cache key includes build-environment package hashes, which change as conda-forge updates packages between runs, forcing a new libitk build with a different hash each time.
1 parent 1be14b6 commit 13eb5d4

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

Utilities/conda-packages/README_Advanced.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,57 @@
33
Advanced / opt-in features of the `Utilities/conda-packages/` build. The baseline
44
workflow is in [`README.md`](./README.md); read that first.
55

6+
## Local build invocation
7+
8+
The `dev` pixi environment does not bundle `rattler-build`. Use the copy
9+
that rattler itself caches under `~/.cache/rattler/pkgs/`:
10+
11+
```bash
12+
# Find the rattler-build binary (version may differ)
13+
RATTLER=$(ls ~/.cache/rattler/pkgs/rattler-build-*/bin/rattler-build | sort -V | tail -1)
14+
15+
# Verify
16+
$RATTLER --version
17+
18+
# Build (add ccache vars if desired — see below)
19+
ITK_CONDA_USE_CCACHE=1 CCACHE_DIR=$HOME/.ccache \
20+
$RATTLER build --experimental \
21+
--recipe Utilities/conda-packages/recipe.yaml \
22+
--output-dir ~/my-itk-channel/
23+
```
24+
25+
Alternatively, install rattler-build as a pixi global tool:
26+
27+
```bash
28+
pixi global install rattler-build
29+
rattler-build --version
30+
```
31+
32+
## Stale rattler package cache — hash mismatch errors
33+
34+
Each `rattler-build` run may produce a `libitk` package with a different
35+
build hash (timestamps, environment hash). If a previous `libitk` is
36+
cached in `~/.cache/rattler/cache/pkgs/`, subsequent builds fail with:
37+
38+
```
39+
hash mismatch, wanted … hash A … but the cached package has hash B
40+
```
41+
42+
**Workaround — clear the stale cache before re-running:**
43+
44+
```bash
45+
rm -rf ~/.cache/rattler/cache/pkgs/libitk-*
46+
```
47+
48+
This forces rattler to re-fetch `libitk` from the local channel on the
49+
next run. The compiler cache (ccache) is not affected.
50+
51+
**Root cause:** rattler-build's staging cache key includes the resolved
52+
build-environment package hashes. When conda-forge updates a build
53+
dependency between runs, the staging cache misses and a new `libitk`
54+
is produced with a different hash. The rattler package cache then holds
55+
a stale copy that no longer matches the channel's repodata.json.
56+
657
## ccache — compiler caching across rattler-build runs
758

859
Rattler-build creates a fresh work directory (`rattler-build_libitk_<ts>/`)

0 commit comments

Comments
 (0)