diff mbox series

[bug#70772] gnu: Add rust-serialport

Message ID 6b33aa66caf9a6854564c359c559018e23ba9185.1714833993.git.m@f-a.nz
State New
Headers show
Series [bug#70772] gnu: Add rust-serialport | expand

Commit Message

Franz Geffke May 4, 2024, 2:46 p.m. UTC
Change-Id: I7935aab748ffd86569cac0af2e91da02323c4123
---
 gnu/packages/crates-io.scm                    | 132 ++++++++++++++++++
 .../rust-serialport-remove-macos.patch        |  17 +++
 2 files changed, 149 insertions(+)
 create mode 100644 gnu/packages/patches/rust-serialport-remove-macos.patch


base-commit: 9e184d5e54d1fee98c75bcb577a98456a77ae015

Comments

Nicolas Graves May 13, 2024, 7:13 a.m. UTC | #1
Hi Franck,

guix lint complains about quite a few warnings on QA :
https://qa.guix.gnu.org/issue/70772

Could you address them and send a new patch?

Thanks.
diff mbox series

Patch

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index a67d3d74bb..35cb1028df 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -3862,6 +3862,24 @@  (define-public rust-assert2-macros-0.3
     (description "This package provides procedural macros for assert2.")
     (license license:bsd-2)))
 
+(define-public rust-assert-hex-0.4
+  (package
+    (name "rust-assert_hex")
+    (version "0.4.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "assert_hex" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "19xwlhz2swak1gw6rv38wai7d1xn9l3mspnv1fl8rz7h60a0y0gp"))))
+    (build-system cargo-build-system)
+    (home-page "https://github.com/wcampbell0x2a/assert_hex")
+    (synopsis "Display assert panics in hexadecimal format")
+    (description
+     "Rust library to display assert panics in hexadecimal format")
+    (license license:expat)))
+
 (define-public rust-associative-cache-1
   (package
     (name "rust-associative-cache")
@@ -34763,6 +34781,64 @@  (define-public rust-libz-ng-sys-1
 high-performance zlib library.")
     (license (list license:expat license:asl2.0))))
 
+(define-public rust-libudev-sys-0.1
+  (package
+    (name "rust-libudev-sys")
+    (version "0.1.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "libudev-sys" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "09236fdzlx9l0dlrsc6xx21v5x8flpfm3d5rjq9jr5ivlas6k11w"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-libc" ,rust-libc-0.2))
+       #:cargo-development-inputs
+       (("rust-pkg-config" ,rust-pkg-config-0.3))))
+    (native-inputs
+     (list pkg-config
+           eudev))
+    (home-page "https://github.com/dcuddeback/libudev-rs")
+    (synopsis "Rust wrapper for libudev")
+    (description
+     "This crate provides a safe wrapper around the native libudev library.")
+    (license license:expat)))
+
+(define-public rust-libudev-0.3
+  (package
+    (name "rust-libudev")
+    (version "0.3.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "libudev" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "1q1my5alvdwyi8i9pc9gn2mcx5rhbsssmz5cjnxzfpd65laj9cvq"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           (substitute* "Cargo.toml"
+             (("0.1.3") "0.1.4"))))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-libc" ,rust-libc-0.2)
+        ("rust-libudev-sys" ,rust-libudev-sys-0.1))
+       #:cargo-development-inputs
+        (("rust-pkg-config" ,rust-pkg-config-0.3))))
+    (native-inputs
+     (list pkg-config
+           eudev))
+    (home-page "https://github.com/dcuddeback/libudev-rs")
+    (synopsis "Rust wrapper for libudev")
+    (description
+     "This crate provides a safe wrapper around the native libudev library.")
+    (license license:expat)))
+
 (define-public rust-lifeguard-0.6
   (package
     (name "rust-lifeguard")
@@ -61303,6 +61379,41 @@  (define-public rust-serial-test-0.4
     (description "Serialising Rust tests")
     (license license:expat)))
 
+(define-public rust-serialport-4
+  (package
+    (name "rust-serialport")
+    (version "4.3.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "serialport" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0a380655dqrl16wfqnr75zxk3f8h3fshjjr68r4gh3clpv81anlg"))
+       (patches (search-patches "rust-serialport-remove-macos.patch"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-bitflags" ,rust-bitflags-2)
+        ("rust-cfg-if" ,rust-cfg-if-1)
+        ("rust-libudev" ,rust-libudev-0.3)
+        ("rust-nix" ,rust-nix-0.26)
+        ("rust-regex" ,rust-regex-1)
+        ("rust-scopeguard" ,rust-scopeguard-1)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-unescaper" ,rust-unescaper-0.1))
+       #:cargo-development-inputs (("rust-assert-hex" ,rust-assert-hex-0.4)
+                                   ("rust-clap" ,rust-clap-3))))
+    (native-inputs
+     (list pkg-config
+           eudev))
+    (home-page "https://github.com/serialport/serialport-rs")
+    (synopsis "A cross-platform serial port library in Rust.")
+    (description
+     "A cross-platform serial port library in Rust. Provides a blocking I/O
+interface and port enumeration including USB device information.")
+    (license license:expat)))
+
 (define-public rust-servo-fontconfig-0.5
   (package
     (name "rust-servo-fontconfig")
@@ -74909,6 +75020,27 @@  (define-public rust-unescape-0.1
      "Unescapes strings with escape sequences written out as literal characters.")
     (license license:expat)))
 
+(define-public rust-unescaper-0.1
+  (package
+    (name "rust-unescaper")
+    (version "0.1.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "unescaper" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0d4xi16mindhksi3lqvn0kzzgj5az9qbgxqmz7gwmcxm5v9nmpqa"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-thiserror" ,rust-thiserror-1))))
+    (home-page "https://github.com/hack-ink/unescaper")
+    (synopsis "Unescape strings with escape sequences.")
+    (description
+     "Unescape strings with escape sequences written out as literal characters.")
+    (license license:expat)))
+
 (define-public rust-ungrammar-1
   (package
     (name "rust-ungrammar")
diff --git a/gnu/packages/patches/rust-serialport-remove-macos.patch b/gnu/packages/patches/rust-serialport-remove-macos.patch
new file mode 100644
index 0000000000..5f779a78df
--- /dev/null
+++ b/gnu/packages/patches/rust-serialport-remove-macos.patch
@@ -0,0 +1,17 @@ 
+--- serialport-4.3.0/Cargo.toml	2024-05-01 16:01:21.986121155 +0100
++++ serialport-4.3.0/Cargo.toml	2024-05-01 16:00:38.874019301 +0100
+@@ -57,15 +57,6 @@ optional = true
+ [target."cfg(all(target_os = \"linux\", not(target_env = \"musl\")))".dependencies.unescaper]
+ version = "0.1.3"
+
+-[target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies.core-foundation-sys]
+-version = "0.8.4"
+-
+-[target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies.io-kit-sys]
+-version = "0.4.0"
+-
+-[target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies.mach2]
+-version = "0.4.1"
+-
+ [target."cfg(unix)".dependencies.bitflags]
+ version = "2.4.0"
\ No newline at end of file