diff --git a/ccp4/README.md b/ccp4/README.md index a7ca21a..2a5027f 100644 --- a/ccp4/README.md +++ b/ccp4/README.md @@ -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. diff --git a/ccp4/build b/ccp4/build index f82090b..faaf73e 100755 --- a/ccp4/build +++ b/ccp4/build @@ -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" }