diff --git a/ccp4/README.md b/ccp4/README.md index 2a5027f..2887e3e 100644 --- a/ccp4/README.md +++ b/ccp4/README.md @@ -3,9 +3,10 @@ CCP4 suite (binary distribution, bundled with SHELX and ARP/wARP) for macromolecular crystallography. https://www.ccp4.ac.uk/ -- Vendor tarball install: default `prep` downloads the ~5 GB tarball - (cached in `$PMODULES_DISTFILESDIR`), `install` untars it into `$PREFIX` - and runs `BINARY.setup`. +- Vendor tarball install: custom `prep` downloads the ~3.7 GB tarball with + `wget --continue` (resumes partial downloads; the builtin curl can't) and + verifies it with `gzip -t`; `install` untars it into `$PREFIX` and runs + `BINARY.setup`. - Non-interactive: the CCP4 licence is pre-agreed via `.agree2ccp4v6` before `BINARY.setup` runs, so the build never prompts. - No `shasums:`: the download link is session-gated (`sid=` expires), so @@ -47,16 +48,12 @@ hand-downloaded tarball into the distfiles dir under the `name:` given in - **"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 - ``` +- **Interrupted download**: prep now detects a truncated tarball with + `gzip -t` and resumes it with `wget --continue` — just re-run + `modbuild build 9.0`. A download that dies with + `Failure writing output to destination` means quota/disk full at the + distfiles dir, not a network problem — free space or move `download_dir:` + (see above) before retrying. - 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. diff --git a/ccp4/build b/ccp4/build index faaf73e..011b0c1 100755 --- a/ccp4/build +++ b/ccp4/build @@ -1,9 +1,25 @@ #!/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. +# Custom prep instead of urls: in config.yaml — modbuild's builtin curl has +# no retry/resume, so an interrupted 3.7 GB download restarts from zero and +# leaves a partial file the next prep reuses silently. wget --continue +# resumes it, and gzip -t gates the build on an intact tarball. +# sid= in the URL is session-generated on ccp4.ac.uk and expires; on download +# failure get a fresh link from https://www.ccp4.ac.uk/download/ (package +# "CCP4 + SHELX + ARP/wARP", Linux x86_64), or pre-stage the tarball by hand +# in $PMODULES_DISTFILESDIR under the name below. +pbuild::prep() { + local -r tarball="${PMODULES_DISTFILESDIR}/ccp4-${V}-shelx-arp-x86_64.tar.gz" + local -r url='https://www.ccp4.ac.uk/download/download_file.php?os=linux&pkg=ccp4-shelx-arp-x86_64&sid=09b78d1369f605f517efa393f88d2bae713ad0b6' + if ! gzip -t "${tarball}" 2>/dev/null; then + mkdir -p "${PMODULES_DISTFILESDIR}" + wget --continue --tries=20 --waitretry=30 \ + --output-document="${tarball}" "${url}" || \ + std::die 42 "ccp4: download failed — quota/disk full, or expired sid (fetch a fresh link from https://www.ccp4.ac.uk/download/)" + gzip -t "${tarball}" || \ + std::die 42 "ccp4: tarball fails gzip -t after download — re-run to resume, or rm it to restart" + fi +} pbuild::configure() { : @@ -18,8 +34,10 @@ pbuild::install() { # 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)" + # untar straight from the distfiles cache — no point copying 3.7 GB into + # SRC_DIR first (prep already verified it with gzip -t) + tar -xzf "${PMODULES_DISTFILESDIR}/ccp4-${V}-shelx-arp-x86_64.tar.gz" || \ + std::die 42 "ccp4: untar failed — rm the tarball from the distfiles dir and re-run" # 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-*/ ) diff --git a/ccp4/files/config.yaml b/ccp4/files/config.yaml index c2af7de..0c88ce7 100644 --- a/ccp4/files/config.yaml +++ b/ccp4/files/config.yaml @@ -5,14 +5,9 @@ ccp4: group: MX overlay: base relstage: unstable - urls: - # sid= is session-generated on ccp4.ac.uk and expires; if the download - # fails, get a fresh link from https://www.ccp4.ac.uk/download/ - # (package "CCP4 + SHELX + ARP/wARP", Linux x86_64) or pre-stage the - # tarball as $PMODULES_DISTFILESDIR/ccp4--shelx-arp-x86_64.tar.gz - - url: "https://www.ccp4.ac.uk/download/download_file.php?os=linux&pkg=ccp4-shelx-arp-x86_64&sid=09b78d1369f605f517efa393f88d2bae713ad0b6" - name: ccp4-${V}-shelx-arp-x86_64.tar.gz - unpacker: none + # no urls: — download lives in build's pbuild::prep (wget --continue + + # gzip -t), because the builtin curl has no retry/resume for the 3.7 GB + # session-gated tarball versions: 9.0: config: