From 3facb10bcfefd87c42685c8855c548b9cd4c490d Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 28 Nov 2026 07:17:21 +0000 Subject: search: pin gn-search where it now lives, and drop the vendoring stopgap gn-search moved to git.genenetwork.org/gn-search, and the revision pushed there (144de8f) is the one that spells its two crates out instead of inheriting from the workspace root. So the pin moves and the packaging stops rewriting manifests: 'vendor-gn-search now copies crates/engine and crates/schema into guix-vendor as they are, and the names it copies to -- gn-search-engine-0.1.0 and "schema" -- are the contract, because the engine depends on ../schema. With no rewriting there is nothing for cargo to re-resolve either, so the make-file-writable "Cargo.lock" allowance goes: the lock the build ships is the lock it resolved, and 'install stays --locked for the reason it always was. Measured on the stopgap's own build (67 suites, 0 failed); this shape was verified against a read-only lock at the cargo level before the push. --- Cargo.lock | 4 +-- Cargo.toml | 2 +- guix.scm | 97 +++++++++++++++++++++----------------------------------------- 3 files changed, 36 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f269fab..ae660b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1159,7 +1159,7 @@ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" [[package]] name = "gn-search-engine" version = "0.1.0" -source = "git+https://github.com/Alexanderlacuna/gn-search?rev=b00139d50369bdc6146337e4448da772d9a4af61#b00139d50369bdc6146337e4448da772d9a4af61" +source = "git+https://git.genenetwork.org/gn-search?rev=326de21c9084b28522bed7a332c01412bb8b951f#326de21c9084b28522bed7a332c01412bb8b951f" dependencies = [ "gn-search-schema", "serde_json", @@ -1170,7 +1170,7 @@ dependencies = [ [[package]] name = "gn-search-schema" version = "0.1.0" -source = "git+https://github.com/Alexanderlacuna/gn-search?rev=b00139d50369bdc6146337e4448da772d9a4af61#b00139d50369bdc6146337e4448da772d9a4af61" +source = "git+https://git.genenetwork.org/gn-search?rev=326de21c9084b28522bed7a332c01412bb8b951f#326de21c9084b28522bed7a332c01412bb8b951f" dependencies = [ "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index c939f7f..6c9e4c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2024" [dependencies] -gn-search-engine = { git = "https://github.com/Alexanderlacuna/gn-search", rev = "b00139d50369bdc6146337e4448da772d9a4af61", features = ["schema"] } +gn-search-engine = { git = "https://git.genenetwork.org/gn-search", rev = "326de21c9084b28522bed7a332c01412bb8b951f", features = ["schema"] } axum = "0.8.9" correlation_rust = { git = "https://git.genenetwork.org/correlation_rust", rev = "12c2a37c3ef3a09f1ab0c5ea69b31b433b15f9f6", version = "0.1.0" } duckdb = "1.10506.0" diff --git a/guix.scm b/guix.scm index c2ce685..09d5083 100644 --- a/guix.scm +++ b/guix.scm @@ -22,7 +22,7 @@ (guix packages) (guix download) ; url-fetch, for the pinned xapian-1.4 source (guix git-download) ; git-fetch, for the gn-search checkout - (guix build utils) ; substitute*, copy-recursively in 'vendor-gn-search + (guix build utils) ; copy-recursively, in 'vendor-gn-search (guix build-system cargo) (gnu packages llvm) ; clang-13: libclang for autocxx codegen (gnu packages databases) ; lmdb: embedded key/value store @@ -52,27 +52,27 @@ ;; native-inputs). Guix's own `xapian` has moved on to 2.1.0, so pin the ;; last 1.4 release here instead of tracking it; drop this pin once ;; xapian-rs targets Xapian 2. -;; The extracted search engine (github.com/Alexanderlacuna/gn-search) is a +;; The extracted search engine (git.genenetwork.org/gn-search) is a ;; cargo *workspace* -- crates/engine, crates/schema, crates/indexer -- and ;; Cargo.toml pins it by git revision, so a store build (which has no ;; network) cannot fetch it. Fetch the checkout here and let the ;; 'vendor-gn-search phase below turn the two crates GN4 links ;; (gn-search-engine, gn-search-schema) into vendored *directory* sources. ;; -;; They cannot be used as they stand: their Cargo.toml inherits -;; `version.workspace = true`, `xapian-rs.workspace = true` and so on from -;; the workspace root, and a vendored directory has no workspace root above -;; it. The phase writes the inheritance out in full, which is the same -;; manifest cargo vendor would produce. +;; The two crates GN4 links carry their own version, edition, licence and +;; dependency specifications (gn-search commit 144de8f) precisely so that a +;; vendored directory -- which has no workspace root above it -- parses as it +;; stands. Nothing has to be rewritten here: the phase copies, and the names +;; it copies to are the contract (see 'vendor-gn-search). (define gn-search-source (origin (method git-fetch) - (uri (git-reference (url "https://github.com/Alexanderlacuna/gn-search") - (commit "b00139d50369bdc6146337e4448da772d9a4af61"))) + (uri (git-reference (url "https://git.genenetwork.org/gn-search") + (commit "326de21c9084b28522bed7a332c01412bb8b951f"))) ;; The input label IS the file-name, and 'vendor-gn-search looks ;; the checkout up as "gn-search". (file-name "gn-search") - (sha256 (base32 "1fi4rflljxikbsv3y4ad5mafflv85d2vfaccnrf1dhfpf2j54r27")))) + (sha256 (base32 "1brj62mabdjg27adij9v1xv2jywf5svq27rx1scvajpam1pqv0vp")))) (define xapian-1.4 (package @@ -202,46 +202,28 @@ replace-with = 'vendored-sources' (display "{\"files\":{}}" port))))) (list "^rust-xapian-rs" "^rust-correlation_rust"))))) - ;; gn-search is a workspace, and a directory source has no - ;; workspace root: flatten the two crates GN4 links into - ;; standalone vendored dirs named -, the - ;; layout `cargo vendor' would have produced. The xapian-rs - ;; pin inside them is the same revision this package - ;; vendors, so the source replacement above covers it. + ;; gn-search is a workspace, so the two crates GN4 links are + ;; copied out of it as directory sources of their own. The + ;; names are the contract: the engine depends on ../schema, so + ;; the schema crate's directory has to be called "schema" + ;; beside "gn-search-engine-0.1.0". (add-after 'unpack-rust-crates 'vendor-gn-search (lambda* (#:key inputs #:allow-other-keys) - (let ((checkout (assoc-ref inputs "gn-search")) - (vendor "guix-vendor")) - (define (flatten crate vendored) - (let ((dir (string-append vendor "/" vendored))) - (copy-recursively (string-append checkout crate) dir) - (substitute* (string-append dir "/Cargo.toml") - (("version.workspace = true") - "version = \"0.1.0\"") - (("edition.workspace = true") - "edition = \"2021\"") - (("license.workspace = true") - "license = \"AGPL-3.0-or-later\"") - (("gn-search-schema.workspace = true") - "gn-search-schema = \"0.1.0\"") - (("serde_json.workspace = true") - "serde_json = \"1.0.151\"") - (("serde.workspace = true") - "serde = { version = \"1.0.229\", features = [\"derive\"] }") - (("utoipa = \\{ workspace = true, optional = true \\}") - "utoipa = { version = \"5\", optional = true }") - (("xapian-rs.workspace = true") - (string-append - "xapian-rs = { git = \"https://github.com/Alexanderlacuna/xapian-rs\"" - ", rev = \"70c5eace78dbca29c434cb103cb8b2c5d4246f0d\" }"))) - ;; A git checkout carries no checksum in the lock; - ;; stub it like the two git deps above. - (call-with-output-file - (string-append dir "/.cargo-checksum.json") - (lambda (port) - (display "{\"files\":{}}" port))))) - (flatten "/crates/engine" "gn-search-engine-0.1.0") - (flatten "/crates/schema" "gn-search-schema-0.1.0")))) + (let ((checkout (assoc-ref inputs "gn-search"))) + (copy-recursively (string-append checkout "/crates/engine") + "guix-vendor/gn-search-engine-0.1.0") + (copy-recursively (string-append checkout "/crates/schema") + "guix-vendor/schema") + ;; A git checkout carries no checksum in the lock; stub + ;; both, like the two single-crate git deps above. + (for-each + (lambda (dir) + (call-with-output-file + (string-append dir "/.cargo-checksum.json") + (lambda (port) + (display "{\"files\":{}}" port)))) + (list "guix-vendor/gn-search-engine-0.1.0" + "guix-vendor/schema"))))) ;; The correlation engine is a second git dependency, so it ;; needs its own source-replacement stanza: cargo resolves a @@ -267,8 +249,8 @@ replace-with = 'vendored-sources' ;; them so .cargo/config exists. (add-after 'vendor-correlation-crate 'vendor-gn-search-crate (lambda* (#:key #:allow-other-keys) - (let* ((rev "b00139d50369bdc6146337e4448da772d9a4af61") - (git-url "https://github.com/Alexanderlacuna/gn-search") + (let* ((rev "326de21c9084b28522bed7a332c01412bb8b951f") + (git-url "https://git.genenetwork.org/gn-search") (port (open-file ".cargo/config" "a" #:encoding "utf-8"))) (format port " @@ -278,20 +260,7 @@ rev = \"~a\" replace-with = 'vendored-sources' " git-url rev git-url rev) - (close-port port) - ;; One lock rewrite has to be allowed here, and this is - ;; the only place --offline makes it safe to allow it: - ;; gn-search-schema is a *path* dependency inside the - ;; upstream workspace, and cargo records such a package - ;; under the git source. Vendored as a directory source - ;; it can only be found by name and version, i.e. as a - ;; replacement for crates.io, so the first resolve moves - ;; that one line from the git source to the registry - ;; source -- resolved against guix-vendor, never the - ;; network. The lock restored by 'patch-cargo-checksums - ;; is read-only (it comes from the store), hence the - ;; chmod; 'install still runs with --locked. - (make-file-writable "Cargo.lock")))) + (close-port port)))) ;; The install phase must pass --locked: `cargo install' ;; re-resolves the dependency graph and, for a -- cgit 1.4.1