From 84ab01c241fa64c5218377636a713c5268faa1a4 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sun, 4 May 2025 14:37:28 +0200 Subject: [PATCH] fix: package vhdl-ls properly Lang macros and lang should be taken out of the repo, not out of new crate-source's --- modules/ruther/packages/rust-crates.scm | 12 +--- modules/ruther/packages/vhdl-ls.scm | 76 +++++++++++++++++-------- 2 files changed, 52 insertions(+), 36 deletions(-) diff --git a/modules/ruther/packages/rust-crates.scm b/modules/ruther/packages/rust-crates.scm index e145628..03d952f 100644 --- a/modules/ruther/packages/rust-crates.scm +++ b/modules/ruther/packages/rust-crates.scm @@ -702,14 +702,6 @@ (crate-source "zerovec-derive" "0.10.3" "1ik322dys6wnap5d3gcsn09azmssq466xryn5czfm13mn7gsdbvf")) -(define rust-vhdl-lang-macros-0.83.1 - (crate-source "vhdl_lang_macros" "0.83.1" - "186l183yqhnf42m8bpzmj189zzsrklrzvh4a0z3hzfdhsg221cb5")) - -(define rust-vhdl-lang-0.83.1 - (crate-source "vhdl_lang" "0.83.1" - "0l4n9pbja1vwpvcmz3b4darlm90vvyhjkpp09qx6zh1bqp8w3za6")) - (define ssss-separator 'end-of-crates) @@ -718,9 +710,7 @@ ;;; (define-cargo-inputs lookup-cargo-inputs (vhdl-ls => - (list rust-vhdl-lang-0.83.1 - rust-vhdl-lang-macros-0.83.1 - rust-aho-corasick-1.1.3 + (list rust-aho-corasick-1.1.3 rust-anstream-0.6.18 rust-anstyle-1.0.10 rust-anstyle-parse-0.2.6 diff --git a/modules/ruther/packages/vhdl-ls.scm b/modules/ruther/packages/vhdl-ls.scm index 8132f42..fbbb02e 100644 --- a/modules/ruther/packages/vhdl-ls.scm +++ b/modules/ruther/packages/vhdl-ls.scm @@ -25,38 +25,64 @@ (uri (git-reference (url "https://github.com/VHDL-LS/rust_hdl") (commit (string-append "v" version)))) - (snippet - #~(begin (use-modules (guix build utils)) - (substitute* "vhdl_ls/Cargo.toml" - ((", path = \"../vhdl_lang\"") "")))) + ;; (snippet + ;; #~(begin (use-modules (guix build utils)) + ;; (substitute* "vhdl_ls/Cargo.toml" + ;; ((", path = \"../vhdl_lang\"") "")))) (sha256 (base32 "0fs8qghnxw82by8dmlxlvm2spzqq3rk8aywj1ay7jxzwblkpkvq0")))) (build-system cargo-build-system) + (native-inputs + (list + )) (inputs (my-cargo-inputs 'vhdl-ls)) (arguments - `(#:phases - (modify-phases %standard-phases - (replace 'install - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out"))) - (mkdir-p out) - (invoke "cargo" "install" "--no-track" - "--path" "./vhdl_ls" "--root" out) - (mkdir-p (string-append out "/share/vhdl_libraries")) - (copy-recursively "vhdl_libraries" - (string-append out "/share/vhdl_libraries")))))) - #:cargo-build-flags - (list - "--release" "--package" "vhdl_ls") - #:cargo-package-flags - (list - "--no-metadata" "--no-verify" - "--package" "vhdl_ls") - #:cargo-test-flags - (list + (list + #:phases + #~(modify-phases %standard-phases + (add-after 'install 'install-libraries + (lambda _ + (mkdir-p (string-append #$output "/share/vhdl_libraries")) + (copy-recursively "vhdl_libraries" + (string-append #$output "/share/vhdl_libraries")))) + (replace 'package + (lambda _ + (begin + ;;error: invalid inclusion of reserved file name Cargo.toml.orig in package source + (when (file-exists? "Cargo.toml.orig") + (delete-file "Cargo.toml.orig")) + + ;; Use unstable feature ‘--registry’. + (setenv "RUSTC_BOOTSTRAP" "1") + (for-each + (lambda (pkg) + (invoke "cargo" "package" "--offline" "--package" pkg + "--registry" "crates-io" "-Z" "package-workspace" + "--no-metadata" "--no-verify") + (for-each + (lambda (crate) + (invoke "tar" "xzf" crate "-C" "guix-vendor")) + (begin + (delete-file-recursively "target/package/tmp-registry") + (find-files "target/package" "\\.crate$"))) + ((assoc-ref %standard-phases 'patch-cargo-checksums))) + '("vhdl_lang_macros" "vhdl_lang" "vhdl_ls")) + (unsetenv "RUSTC_BOOTSTRAP")))) + (replace 'install + (lambda _ + (mkdir-p #$output) + (invoke "cargo" "install" "--no-track" + "--path" "./vhdl_ls" "--root" #$output)))) + ;; TODO After rust-team gets merged, remove replacement of 'package and use this + ;; #:cargo-package-crates ''("vhdl_lang_macros" "vhdl_lang" "vhdl_ls") + ;; TODO After rust-team gets merged, remove replacement of 'install and use this + ;; #:cargo-install-paths ''("vhdl_ls") + #:cargo-test-flags + '(list "--release" - "--package" "vhdl_ls"))) + "--package" "vhdl_ls") + )) (home-page "https://github.com/kraigher/rust_hdl") (synopsis "VHDL Language Server") (description "This package provides VHDL Language Server.") -- 2.49.0