Files
MX_Pmodule/ccp4/build
T
duan_jandClaude Fable 5 3bf22a4b7e 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>
2026-08-18 20:07:19 +02:00

40 lines
1.8 KiB
Python
Executable File

#!/usr/bin/env modbuild
# Download happens in the default prep via urls: in files/config.yaml.
# unpacker: none because BINARY.setup patches paths relative to its final
# location — we untar once, directly into $PREFIX, instead of unpacking
# ~20 GB into the build tmp and copying it over.
pbuild::configure() {
:
}
pbuild::compile() {
:
}
pbuild::install() {
cd "${PREFIX}"
# 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' | "./${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"
}