diff mbox series

[bug#43183,v2,3/5] gnu: Add guile-struct-pack.

Message ID 20200904202517.6131-4-mjbecze@riseup.net
State Accepted
Headers show
Series gnu: Add loko-scheme. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Martin Becze Sept. 4, 2020, 8:25 p.m. UTC
* gnu/packages/guile-xyz.scm (guile-struct-pack): New variable.
---
 gnu/packages/guile-xyz.scm | 43 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Mathieu Othacehe Sept. 7, 2020, 6:30 a.m. UTC | #1
Hey Martin,

Thanks for the v2!

> +                       (define (mv dst)

I'm not sure it's useful to define a procedure here, as it will only be
called once.

> +                         (define (target file)
> +                           (string-append  dst "/" file))
> +                         (define files (cddr (scandir ".")))

We try to avoid car, cdr & friends. You can use:

--8<---------------cut here---------------start------------->8---
(scandir dir (negate (cut member <> '("." ".."))))
--8<---------------cut here---------------end--------------->8---

instead.

> +    (description
> +      "This is an R6RS library for working with packed byte structures.  It is
> +similar to struct in Python or pack and unpack in Perl.")
> +                                (license license:expat)))

Make sure to use the correct indentation, using Emacs or indent-code.el
script.

Also, the order of the patchset is not correct. The patch adding
"loko-scheme" should be the last one, as it depends on the other ones,
and won't build without them.

Could you send an updated version :) ?

Thanks,

Mathieu
Martin Becze Sept. 8, 2020, 4:04 p.m. UTC | #2
Thanks for the feedback Mathieu!

On 9/7/20 1:30 AM, Mathieu Othacehe wrote:
> Make sure to use the correct indentation, using Emacs or indent-code.el
> script.

I apologize, I'm having a bit of difficultly with Emacs atm.

> Could you send an updated version :) ?

I just sent V3, hopefull with all the feedback correctly integrated.
Mathieu Othacehe Sept. 10, 2020, 7:37 a.m. UTC | #3
Hello Martin,

> I apologize, I'm having a bit of difficultly with Emacs atm.

No worries! I fixed minor details and pushed.

Thanks,
diff mbox series

Patch

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 308ce0ad59..a2df03760d 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -3846,3 +3846,46 @@  between data, in a way that is very similar to WikiData or RDF for instance.
 An object can have relations (in the form of an IRI) that relates it to one or
 more objects or strings, represented by a Json object or an IRI.")
     (license license:gpl3+)))
+
+(define-public guile-struct-pack
+  (package
+    (name "guile-struct-pack")
+    (version "1.1.1")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/weinholt/struct-pack.git")
+               (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+          (base32 "0hd72m821pahjphzyjn26i55542v8makr55xzjll2cycja4wsbc1"))))
+    (build-system guile-build-system)
+    (arguments
+      `(#:compile-flags '("--r6rs" "-Wunbound-variable" "-Warity-mismatch")
+        #:modules ((guix build guile-build-system)
+                   (guix build utils)
+                   (ice-9 ftw))
+        #:phases (modify-phases %standard-phases
+                   (add-before 'build 'move-sls-files
+                     (lambda _
+                       ;; Move files under a struct/ directory to reflect the
+                       ;; module hierarchy.
+                       (define (mv dst)
+                         (define (target file)
+                           (string-append  dst "/" file))
+                         (define files (cddr (scandir ".")))
+                         (mkdir dst)
+                         (for-each (lambda (file)
+                                     (rename-file file (target file)))
+                                   files))
+                       (mv "struct")
+                       #t)))))
+    (native-inputs
+      `(("guile" ,guile-3.0)))
+    (home-page "https://gitlab.com/mjbecze/guile-srfi-89")
+    (synopsis "R6RS library for working with packed byte structures")
+    (description
+      "This is an R6RS library for working with packed byte structures.  It is
+similar to struct in Python or pack and unpack in Perl.")
+                                (license license:expat)))