Subject: Re: [bug#43414] [PATCH 1/3] gnu: Add rust-lab.

From: Efraim Flashner <[email-masked]>
Date: Wed, 16 Sep 2020 09:48:40 +0300

A couple of issues I've found with this patch:
(I've attached the updated patch)

On Tue, Sep 15, 2020 at 08:52:24AM +0800, Gabriel Arazas wrote:
> * gnu/packages/crates-io.scm (rust-lab-0.8): New variable.
> * gnu/packages/crates-io.scm (rust-lab-0.7): New variable.
> * gnu/packages/crates-io.scm (rust-lab-0.4): New variable.
> ---
>  gnu/packages/crates-io.scm | 61 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 61 insertions(+)
> 
> diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
> index 0f0f0c28c9..2f3cead9cf 100644
> --- a/gnu/packages/crates-io.scm
> +++ b/gnu/packages/crates-io.scm
> @@ -12220,6 +12220,67 @@ currently supports parsing (fully conformant parser), formatting and comparing
>  language tags.")
>      (license license:expat)))
>  
> +(define-public rust-lab-0.8
> +  (package
> +    (name "rust-lab")
> +    (version "0.8.1")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (crate-uri "lab" version))
> +        (file-name
> +          (string-append name "-" version ".tar.gz"))
> +        (sha256
> +          (base32
> +            "1ysnbviwi35mq6xyz9c59mpgigyfp4s4y2mispxzrms4vk83bx15"))))
> +    (build-system cargo-build-system)
> +    (arguments
> +      `(#:cargo-development-inputs
> +        (("rust-approx" ,rust-approx-0.3)
> +         ("rust-criterion" ,rust-criterion-0.3)
> +         ("rust-lazy-static" ,rust-lazy-static-1.4)
> +         ("rust-pretty-assertions"
> +          ,rust-pretty-assertions-0.6)
> +         ("rust-rand" ,rust-rand-0.7))))

This is actually rust-rand-0.5

> +    (home-page "https://github.com/TooManyBees/lab")
> +    (synopsis
> +      "Converts RGB to CIE-LAB for Rust")
> +    (description
> +      "Tools for converting RGB colors to the CIE-LAB color space, and
> +comparing differences in color.
> +  ")
> +    (license license:expat)))
> +

These two packages don't actually use the same dependencies as
rust-lab-0.8. I normally check https://crates.io/crates/<package-name>
to make sure I have the correct dependencies.

> +(define-public rust-lab-0.7
> +  (package
> +    (inherit rust-lab-0.8)
> +    (name "rust-lab")
> +    (version "0.7.2")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (crate-uri "lab" version))
> +        (file-name
> +          (string-append name "-" version ".tar.gz"))
> +        (sha256
> +          (base32
> +            "0g692d489lq01pv3mzfhxd98j0r22lw28l6bk112m74djlfzxdmw"))))))
> +
> +(define-public rust-lab-0.4
> +  (package
> +    (inherit rust-lab-0.8)
> +    (name "rust-lab")
> +    (version "0.4.4")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (crate-uri "lab" version))
> +        (file-name
> +          (string-append name "-" version ".tar.gz"))
> +        (sha256
> +          (base32
> +            "0h4ig5bvzmwlzd74zj7b4sh7kzi3c6mjjnw7yjz8ijxvr4mrcr1s"))))))
> +
>  (define-public rust-lalrpop-0.17
>    (package
>      (name "rust-lalrpop")
> -- 
> 2.28.0
> 

In addition, rust-lab-0.7 failed the test suite for me. I got:
error: process didn't exit successfully: `/tmp/guix-build-rust-lab-0.7.2.drv-0/lab-0.7.2/target/release/deps/lab-674125292fb73d25` (signal: 4, SIGILL: illegal instruction)
When I looked into it more it looks like it's building targeting avx2
with 0.8.1¹, unspecified on 0.7.2² and nothing in particular in 0.4.2
(couldn't find a tag for 0.4.4 in the git repo).

Do programs compiled using this crate work on machines without all the
expected CPU extensions?

Since the two packages depending on lab-0.7 pass their test suite I
assume it's more of an issue about the test suite for 0.7 and less of an
issue about the crate itself.

¹ https://github.com/TooManyBees/lab/blob/v0.8.1/src/lib.rs#L96
² https://github.com/TooManyBees/lab/blob/v0.7.2/src/lib.rs#L51

-- 
Efraim Flashner   <[email-masked]>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
From 833dfde76e9058a22b80526a73038dc341947c5b Mon Sep 17 00:00:00 2001
From: Gabriel Arazas <[email-masked]>
Date: Tue, 15 Sep 2020 08:52:24 +0800
Subject: [PATCH] gnu: Add rust-lab-0.8, rust-lab-0.7, rust-lab-0.4.

* gnu/packages/crates-io.scm (rust-lab-0.8, rust-lab-0.7,
rust-lab-0.4): New variables.

Signed-off-by: Efraim Flashner <[email-masked]>
---
 gnu/packages/crates-io.scm | 69 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 0f0f0c28c9..eee1432f94 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2019, 2020 Hartmut Goebel <[email-masked]>
 ;;; Copyright © 2020 Jakub Kądziołka <[email-masked]>
 ;;; Copyright © 2020 Leo Famulari <[email-masked]>
+;;; Copyright © 2020 Gabriel Arazas <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -12220,6 +12221,74 @@ currently supports parsing (fully conformant parser), formatting and comparing
 language tags.")
     (license license:expat)))
 
+(define-public rust-lab-0.8
+  (package
+    (name "rust-lab")
+    (version "0.8.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (crate-uri "lab" version))
+        (file-name
+         (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "1ysnbviwi35mq6xyz9c59mpgigyfp4s4y2mispxzrms4vk83bx15"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-development-inputs
+       (("rust-approx" ,rust-approx-0.3)
+        ("rust-criterion" ,rust-criterion-0.3)
+        ("rust-lazy-static" ,rust-lazy-static-1)
+        ("rust-pretty-assertions" ,rust-pretty-assertions-0.6)
+        ("rust-rand" ,rust-rand-0.5))))
+    (home-page "https://github.com/TooManyBees/lab")
+    (synopsis "Convert RGB to CIE-LAB for Rust")
+    (description
+     "This package contains tools for converting RGB colors to the CIE-LAB color
+space, and comparing differences in color.")
+    (license license:expat)))
+
+(define-public rust-lab-0.7
+  (package
+    (inherit rust-lab-0.8)
+    (name "rust-lab")
+    (version "0.7.2")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (crate-uri "lab" version))
+        (file-name
+         (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "0g692d489lq01pv3mzfhxd98j0r22lw28l6bk112m74djlfzxdmw"))))
+    (arguments
+     `(#:tests? #f  ; test suite assumes avx2 support
+       #:cargo-development-inputs
+       (("rust-criterion" ,rust-criterion-0.3)
+        ("rust-lazy-static" ,rust-lazy-static-1)
+        ("rust-pretty-assertions" ,rust-pretty-assertions-0.6)
+        ("rust-rand" ,rust-rand-0.5))))))
+
+(define-public rust-lab-0.4
+  (package
+    (inherit rust-lab-0.8)
+    (name "rust-lab")
+    (version "0.4.4")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (crate-uri "lab" version))
+        (file-name
+         (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "0h4ig5bvzmwlzd74zj7b4sh7kzi3c6mjjnw7yjz8ijxvr4mrcr1s"))))
+    (arguments
+     `(#:cargo-development-inputs
+       (("rust-rand" ,rust-rand-0.3))))))
+
 (define-public rust-lalrpop-0.17
   (package
     (name "rust-lalrpop")
-- 
2.28.0