about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander_Kabui <alexanderkabua@gmail.com>2026-10-07 09:57:56 +0300
committerAlexander_Kabui <alexanderkabua@gmail.com>2026-10-07 09:57:56 +0300
commit80c52c495abc58d07df42ed825d7c40b1df2e767 (patch)
tree61da008c4d910f7f9b5bcb0a43ac1b61c3f799bb
parente469eb1d496bb5ca08a8eb264bfaead2816670e3 (diff)
downloadgenenetwork4-80c52c495abc58d07df42ed825d7c40b1df2e767.tar.gz
guix.scm (install phase): pass --locked to cargo install.
Guix attempt 5 got past the check phase (195.6 s, the full hermetic
suite green — the E0596/XGb6/ZXD test fixes held inside the build)
and died in the install phase instead: cargo-build-system's install
runs `cargo install --offline --no-track --path .', and cargo install
RE-RESOLVES the dependency graph, refusing to reuse the in-tree
Cargo.lock for the source-replaced git dependency xapian-rs
("the source git+... requires a lock file to be present first before
it can be used against vendored source code", drv 7s1h7nrj,
logs/guix-attempt5.log) — even though the lock sits in the source
root, restored by patch-cargo-checksums, and the build/check phases
consumed it happily.

Root cause proven on a minimal offline repro (vendored git dep, clean
CARGO_HOME, guix-env cargo 1.85.1; /tmp/inst-repro): `cargo build
--offline' EXIT=0 with the same layout, `cargo install --offline
--no-track --path .' fails with the byte-identical error, and the
same command with `--locked' succeeds — --locked makes cargo trust
and reuse the existing lock instead of re-resolving.

Fix: replace the stock install phase with the same invocation plus
--locked (everything else mirrors the stock phase for a bin-only
crate with #:install-source? #f: mkdir out, CARGO_TARGET_DIR=./target,
--no-track --path . --root out). Validated: primitive-load of the
recipe + dry-run lowering of the new derivation (drv gzz9sds5).

This obstacle is distinct from attempts 1-4 (vendoring/check-phase
test code): it is the install phase's re-resolution, understood and
proven offline before this attempt, within the retry cap for a new
obstacle.
-rw-r--r--guix.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/guix.scm b/guix.scm
index baf8a3f..25564a1 100644
--- a/guix.scm
+++ b/guix.scm
@@ -99,6 +99,26 @@ replace-with = 'vendored-sources'
                            (string-append xapian-dir "/.cargo-checksum.json")
                          (lambda (port)
                            (display "{\"files\":{}}" port)))))))
+               ;; The install phase must pass --locked: `cargo install'
+               ;; re-resolves the dependency graph and, for a
+               ;; source-replaced GIT dependency, refuses to trust the
+               ;; in-tree Cargo.lock without it ("requires a lock file to
+               ;; be present first before it can be used against
+               ;; vendored source code" — guix attempt 5, install phase,
+               ;; drv 7s1h7nrj; build/check are unaffected because plain
+               ;; `cargo build/test' consumes the lock as-is). Proven on
+               ;; a minimal offline repro (vendored git dep + clean
+               ;; CARGO_HOME): install fails byte-identically without
+               ;; --locked and succeeds with it. Everything else mirrors
+               ;; the stock install phase for a bin-only crate with
+               ;; #:install-source? #f.
+               (replace 'install
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   (let ((out (assoc-ref outputs "out")))
+                     (mkdir-p out)
+                     (setenv "CARGO_TARGET_DIR" "./target")
+                     (invoke "cargo" "install" "--offline" "--locked"
+                             "--no-track" "--path" "." "--root" out))))
                ;; tests/*.rs (Rust) and test/python/test_*.py mirror each
                ;; other endpoint for endpoint; the Python side exercises the
                ;; REST API over real HTTP since Python can only reach the