Subject: [PATCH rust-team v2 1/2] gnu: rust-pear: Added version 0.2.8 with deps

From: Aaron Covrig <[email-masked]>
Date: Thu, 7 Mar 2024 21:37:27 -0500

* gnu/packages/crates-io.scm (rust-inlinable-string-0.1) : Added inlinable-string version 0.1.15.
    * gnu/packages/crates-io.scm (rust-pear-0.2) : Added version 0.2.8.
    * gnu/packages/crates-io.scm (rust-pear-codengen-0.2) : Changed to full build with tests
    * gnu/packages/crates-io.scm (rust-pear-0.1) : Changed to full build
      with tests
    * gnu/packages/crates-io.scm (rust-pear-codegen-0.1) : Changed to full build
      with tests
---
 gnu/packages/crates-io.scm | 107 +++++++++++++++++++++++++++++--------
 1 file changed, 84 insertions(+), 23 deletions(-)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 1a08748392..8a81a75e30 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -30496,6 +30496,31 @@ (define-public rust-inline-c-macro-0.1
 writing and executing C code inside Rust.")
     (license license:bsd-3)))
 
+(define-public rust-inlinable-string-0.1
+  (package
+    (name "rust-inlinable-string")
+    (version "0.1.15")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "inlinable_string" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "1ysjci8yfvxgf51z0ny2nnwhxrclhmb3vbngin8v4bznhr3ybyn8"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs (("rust-serde" ,rust-serde-1))
+       #:cargo-development-inputs (("rust-serde-test" ,rust-serde-test-1))))
+    (home-page "https://github.com/fitzgen/inlinable_string")
+    (synopsis "Provides inline strings that avoid heap-allocation")
+    (description
+     "The @code{inlinable_string} crate provides the @code{InlinableString} type
+-- an owned, grow-able UTF-8 string that stores small strings inline and avoids
+heap-allocation -- and the @code{StringExt} trait which abstracts string
+operations over both @code{std::string::String} and @code{InlinableString} (or
+even your own custom string type)")
+    (license (list license:asl2.0 license:expat))))
+
 (define-public rust-inotify-0.10
   (package
     (name "rust-inotify")
@@ -46264,27 +46289,47 @@ (define-public rust-pdqselect-0.1
 pdqsort.")
     (license (list license:asl2.0 license:expat))))
 
-(define-public rust-pear-0.1
+(define-public rust-pear-0.2
   (package
     (name "rust-pear")
-    (version "0.1.5")
+    (version "0.2.8")
     (source
      (origin
        (method url-fetch)
        (uri (crate-uri "pear" version))
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
-        (base32 "02lnp8c414z5ds0lskd4zxlalrjljzpkg8g6kizszij4h52sgprj"))))
+        (base32 "1j03s6m80iqldnm6jzh3k1fbyk0lxirx8bi4ivgq3k3sq7va1k2c"))))
     (build-system cargo-build-system)
     (arguments
-     `(#:skip-build? #t
-       #:cargo-inputs
-       (("rust-pear-codegen" ,rust-pear-codegen-0.1))))
+     `(#:cargo-inputs (("rust-inlinable-string" ,rust-inlinable-string-0.1)
+                       ("rust-pear-codegen" ,rust-pear-codegen-0.2)
+                       ("rust-yansi" ,rust-yansi-1))))
     (home-page "https://crates.io/crates/pear")
     (synopsis "Pear is a fruit")
     (description "This package provides a pear is a fruit.")
     (license (list license:expat license:asl2.0))))
 
+(define-public rust-pear-0.1
+  (package
+    (inherit rust-pear-0.2)
+    (name "rust-pear")
+    (version "0.1.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "pear" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "02lnp8c414z5ds0lskd4zxlalrjljzpkg8g6kizszij4h52sgprj"))))
+    (arguments
+     `(#:cargo-inputs (("rust-pear-codegen" ,rust-pear-codegen-0.1))
+       #:phases (modify-phases %standard-phases
+                  ;; Enable using nightly/dev features
+                  (add-after 'unpack 'enable-unstable-features
+                    (lambda _
+                      (setenv "RUSTC_BOOTSTRAP" "1"))))))))
+
 (define-public rust-pear-codegen-0.2
   (package
     (name "rust-pear-codegen")
@@ -46295,19 +46340,25 @@ (define-public rust-pear-codegen-0.2
        (uri (crate-uri "pear_codegen" version))
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
-        (base32 "0xrwnlncg7l64gfy82vf6kq55ww7p6krq6bc3pqwymxpiq76f8if"))))
+        (base32 "0xrwnlncg7l64gfy82vf6kq55ww7p6krq6bc3pqwymxpiq76f8if"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   ;; Add missing development dependency (for tests)
+                   (substitute* "Cargo.toml"
+                     (("\\[dev-dependencies\\]" all)
+                      (string-append "[dev-dependencies.pear]" "\n"
+                                     "version = \"0.2.8\""))) #t))))
     (build-system cargo-build-system)
     (arguments
-     `(#:tests? #f  ; use of undeclared crate or module `pear`
-       #:cargo-inputs
-       (("rust-proc-macro2" ,rust-proc-macro2-1)
-        ("rust-proc-macro2-diagnostics" ,rust-proc-macro2-diagnostics-0.10)
-        ("rust-quote" ,rust-quote-1)
-        ("rust-syn" ,rust-syn-2))))
+     `(#:cargo-inputs (("rust-proc-macro2" ,rust-proc-macro2-1)
+                       ("rust-proc-macro2-diagnostics" ,rust-proc-macro2-diagnostics-0.10)
+                       ("rust-quote" ,rust-quote-1)
+                       ("rust-syn" ,rust-syn-2))
+       ;; Add missing dev crate
+       #:cargo-development-inputs (("rust-pear" ,rust-pear-0.2))))
     (home-page "https://crates.io/crates/pear_codegen")
     (synopsis "Codegen for pear")
-    (description
-     "This package provides a (codegen) pear is a fruit.")
+    (description "This package provides a (codegen) pear is a fruit.")
     (license (list license:expat license:asl2.0))))
 
 (define-public rust-pear-codegen-0.1
@@ -46321,15 +46372,25 @@ (define-public rust-pear-codegen-0.1
        (uri (crate-uri "pear_codegen" version))
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
-        (base32 "19lcpkfspizd4ywwvca6rxgc311m070k3ndvwa9vrbw1snjqna60"))))
+        (base32 "19lcpkfspizd4ywwvca6rxgc311m070k3ndvwa9vrbw1snjqna60"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   (delete-file "build.rs")))))
+    (build-system cargo-build-system)
     (arguments
-     `(#:skip-build? #t
-       #:cargo-inputs
-       (("rust-proc-macro2" ,rust-proc-macro2-0.4)
-        ("rust-quote" ,rust-quote-0.6)
-        ("rust-syn" ,rust-syn-0.15)
-        ("rust-version-check" ,rust-version-check-0.9)
-        ("rust-yansi" ,rust-yansi-0.5))))))
+     `(#:cargo-inputs (("rust-proc-macro2" ,rust-proc-macro2-0.4)
+                       ("rust-quote" ,rust-quote-0.6)
+                       ("rust-syn" ,rust-syn-0.15)
+                       ;; development inputs here to address build issues
+                       ("rust-version-check" ,rust-version-check-0.9)
+                       ("rust-yansi" ,rust-yansi-0.5))
+       #:cargo-development-inputs (("rust-version-check" ,rust-version-check-0.9)
+                                   ("rust-yansi" ,rust-yansi-0.5))
+       #:phases (modify-phases %standard-phases
+                  ;; Enable using nightly/dev features
+                  (add-after 'unpack 'enable-unstable-features
+                    (lambda _
+                      (setenv "RUSTC_BOOTSTRAP" "1"))))))))
 
 (define-public rust-peeking-take-while-0.1
   (package
-- 
2.41.0