diff options
| author | pjotr | 2026-05-31 09:25:50 +0000 |
|---|---|---|
| committer | pjotr | 2026-05-31 09:25:50 +0000 |
| commit | 0853ee5abd7f95cb59038f99e0e5ae0eec20b992 (patch) | |
| tree | 8b19e485adc137f0e528e1274a5376d4b368d7b4 /scripts/lib-pangenome-pack.sh | |
| parent | 70cf276c980ce66f14076196cdba5db6f482bea1 (diff) | |
| download | guix-bioinformatics-0853ee5abd7f95cb59038f99e0e5ae0eec20b992.tar.gz | |
Pangenome fixes
Diffstat (limited to 'scripts/lib-pangenome-pack.sh')
| -rw-r--r-- | scripts/lib-pangenome-pack.sh | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/scripts/lib-pangenome-pack.sh b/scripts/lib-pangenome-pack.sh index efc5281..7707928 100644 --- a/scripts/lib-pangenome-pack.sh +++ b/scripts/lib-pangenome-pack.sh @@ -43,8 +43,11 @@ GB_HASH=$(git -C "$CHANNEL_DIR" rev-parse --short=8 HEAD) # your target microarch (e.g. Cascade Lake/Zen 4 -> v4 because # both have AVX-512). ARCH=$(uname -m) -ARCH_SLUG="$ARCH" TUNE="${TUNE:-}" +# When TUNE is set, the v-level already implies the architecture +# (x86-64-v4 only makes sense on x86_64); use it on its own to +# avoid a redundant "x86_64-x86-64-v4" slug. +ARCH_SLUG="${TUNE:-$ARCH}" if [ -n "$TUNE" ]; then case "$TUNE" in x86-64|x86-64-v2|x86-64-v3|x86-64-v4) : ;; @@ -63,7 +66,6 @@ EOF exit 2 ;; esac - ARCH_SLUG="$ARCH-$TUNE" fi cpu_compat () { @@ -77,20 +79,23 @@ cpu_compat () { } # Resolve the exact version each package contributes to the closure. -# `guix package -A` is regex-on-name and can be ambiguous (multiple -# wfmash variants), so go through `guix build -e ... -n` and parse -# the store basename, which always carries the full version. -resolve_version () { - expr="$1" ; name="$2" - path=$(guix build --no-offload -L "$CHANNEL_DIR" -e "$expr" -n 2>/dev/null \ - | tail -n 1) - [ -n "$path" ] || { echo "could not resolve $name" >&2; exit 1; } - basename "$path" | sed -E "s/^[a-z0-9]+-${name}-//" -} - -IMPG_VER=$(resolve_version '(@ (gn packages pangenome-rust) impg)' impg) -WFMASH_VER=$(resolve_version '(@ (gn packages pangenome) wfmash-0.14-snapshot)' wfmash) -PGGB_VER=$(resolve_version '(@ (gn packages pangenome) pggb)' pggb) +# Use `guix repl` so we read `package-version` directly -- `guix +# build -n` only prints the store path on stdout when the derivation +# is already realized, which makes it fragile after a channel update. +read IMPG_VER WFMASH_VER PGGB_VER <<EOF +$(guix repl -L "$CHANNEL_DIR" -- /dev/stdin 2>/dev/null <<'SCM' +(use-modules (guix packages) + (gn packages pangenome) + (gn packages pangenome-rust)) +(format #t "~a ~a ~a~%" + (package-version impg) + (package-version wfmash-0.14-snapshot) + (package-version pggb)) +SCM +) +EOF +[ -n "${IMPG_VER:-}" ] && [ -n "${WFMASH_VER:-}" ] && [ -n "${PGGB_VER:-}" ] \ + || { echo "could not resolve package versions" >&2; exit 1; } VERSION_STEM="$ARCH_SLUG-guix-bioinformatics-$GB_HASH-impg-$IMPG_VER-wfmash-$WFMASH_VER-pggb-$PGGB_VER" |
