ccp4: die-guard install steps, glob ccp4-* top dir

First Ra run "succeeded" while broken: modbuild has no errexit in hooks,
so a truncated cached tarball (gzip EOF) and a wrong hardcoded top dir
(tarball unpacks to ccp4-9, not ccp4-9.0) scrolled by and the modulefile
got installed anyway. Every critical step now ends the build via
std::die, the top dir is globbed, and install verifies ccp4.setup-sh
exists before finishing. README documents the recovery (rm partial
tarball from distfiles, --clean-install).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-18 20:07:19 +02:00
co-authored by Claude Fable 5
parent 8f1b3bf3a1
commit 3bf22a4b7e
2 changed files with 35 additions and 5 deletions
+19 -1
View File
@@ -42,12 +42,30 @@ https://www.ccp4.ac.uk/download/ and update `files/config.yaml`, or drop a
hand-downloaded tarball into the distfiles dir under the `name:` given in
`files/config.yaml`.
## Known failure modes
- **"done" but broken install**: modbuild has no errexit in hooks — errors in
`pbuild::install` used to scroll by and the build still reported done. The
build script now `std::die`s on every critical step.
- **Truncated download reused silently**: an interrupted `curl` leaves a
partial file in the distfiles dir, and prep reuses any file it finds there
(no integrity check without `shasums:`). Symptom:
`gzip: stdin: unexpected end of file`. Fix:
```bash
rm ~/.cache/Pmodules/distfiles/ccp4-9.0-shelx-arp-x86_64.tar.gz
modbuild build --clean-install 9.0
# or verify by hand before building:
gzip -t ~/.cache/Pmodules/distfiles/ccp4-9.0-shelx-arp-x86_64.tar.gz
```
- The tarball unpacks to `ccp4-9` (not `ccp4-9.0` as the CCP4 install doc
implies); the build globs `ccp4-*/` instead of assuming the name.
## Verify
```bash
module use MX unstable && module load ccp4/9.0
which refmac5 ccp4i2
echo $CCP4 # should point into /opt/psi/MX/ccp4/9.0/ccp4
echo $CCP4 # should point into /opt/psi/MX/ccp4/9.0/ccp4 (-> ccp4-9)
```
Bundled SHELX and ARP/wARP still need their own academic registrations.
+16 -4
View File
@@ -15,13 +15,25 @@ pbuild::compile() {
pbuild::install() {
cd "${PREFIX}"
tar -xzf "${SRC_DIR}/ccp4-${V}-shelx-arp-x86_64.tar.gz"
# modbuild has no errexit in hooks — without the die-guards a failed step
# still ends in a "done" build with a broken PREFIX (happened 2026-08-18
# with a truncated cached tarball).
tar -xzf "${SRC_DIR}/ccp4-${V}-shelx-arp-x86_64.tar.gz" || \
std::die 42 "ccp4: untar failed — cached tarball likely truncated; rm it from the distfiles dir and re-run (fetch a fresh sid link if the download fails)"
# the 9-series tarball unpacks to ccp4-9 (NOT ccp4-9.0 as the install doc
# implies) — glob instead of guessing the name
local -a top=( ccp4-*/ )
[[ -x "${top[0]}BINARY.setup" ]] || \
std::die 42 "ccp4: ${top[0]}BINARY.setup not found — vendor layout changed, inspect ${PREFIX}"
# Pre-agree the CCP4 licence so BINARY.setup skips its interactive prompt
# (downloading from ccp4.ac.uk already required accepting it). The printf
# answers any prompt a newer BINARY.setup might still ask; printf instead
# of `yes` because modbuild runs with pipefail and yes dies by SIGPIPE.
touch "${PREFIX}/.agree2ccp4v6" "${HOME}/.agree2ccp4v6"
printf 'y\ny\ny\n' | "./ccp4-${V_MAJOR}.${V_MINOR}/BINARY.setup"
# version-independent symlink so the modulefile survives 9.0.xxx updates
ln -sfn "ccp4-${V_MAJOR}.${V_MINOR}" ccp4
printf 'y\ny\ny\n' | "./${top[0]}BINARY.setup" || \
std::die 42 "ccp4: BINARY.setup failed"
# version-independent symlink so the modulefile survives 9.x updates
ln -sfn "${top[0]%/}" ccp4
[[ -r ccp4/bin/ccp4.setup-sh ]] || \
std::die 42 "ccp4: ccp4/bin/ccp4.setup-sh missing after setup — the modulefile would be broken"
}