unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Add scheme-bytestructures
@ 2016-10-09 10:38 Amirouche Boubekki
  2016-10-10 17:51 ` Kei Kebreau
  0 siblings, 1 reply; 10+ messages in thread
From: Amirouche Boubekki @ 2016-10-09 10:38 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 251 bytes --]

Warning: scheme-bytestructures works on various implementation of Scheme
but this patch adds it only for guile-2.0.

This is a pure scheme package there is no autotools that's why I use the
trivial-build-system.

This doesn't run the test suite, yet.

[-- Attachment #1.2: Type: text/html, Size: 308 bytes --]

[-- Attachment #2: 0001-gnu-Add-scheme-bytestructures.patch --]
[-- Type: text/x-patch, Size: 4212 bytes --]

From fb2eb7ffd88ec4fba09411195a54b59d67d9c137 Mon Sep 17 00:00:00 2001
From: Amirouche <amirouche@hypermove.net>
Date: Sun, 9 Oct 2016 12:31:20 +0200
Subject: [PATCH] gnu: Add scheme-bytestructures

* gnu/packages/guile.scm (scheme-bytestructures): New variable.

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 0890f19..383990e 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -1265,4 +1265,105 @@ is no support for parsing block and inline level HTML.")
 (define-public guile2.2-commonmark
   (package-for-guile-2.2 guile-commonmark))
 
+(define-public scheme-bytestructures
+  (package
+    (name "scheme-bytestructures")
+    (version "20160726.53127f6")
+    (source (origin
+	      (method git-fetch)
+	      (uri (git-reference
+		    (url "https://github.com/TaylanUB/scheme-bytestructures")
+		    (commit "53127f608caf64b34fa41c389b2743b546fbe9da")))
+	      (file-name (string-append name "-" version "-checkout"))
+	      (sha256
+	       (base32
+		"0l4nx1vp9fkrgrgwjiycj7nx6wfjfd39rqamv4pmq7issi8mrywq"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+	 (use-modules (guix build utils)
+		      (ice-9 match)
+		      (ice-9 popen)
+		      (ice-9 rdelim))
+
+	 (let* ((out (assoc-ref %outputs "out"))
+		(guile (assoc-ref %build-inputs "guile"))
+		(effective (read-line
+			    (open-pipe* OPEN_READ
+					(string-append guile "/bin/guile")
+					"-c" "(display (effective-version))")))
+		(module-dir (string-append out "/share/guile/site/"
+					   effective))
+		(source (assoc-ref %build-inputs "source"))
+		(doc (string-append out "/share/doc/scheme-bytestructures"))
+		(scm-files (string-split "bytestructures/guile/explicit-endianness.scm
+bytestructures/guile/numeric-metadata.scm
+bytestructures/guile/ffi.scm
+bytestructures/guile/vector.scm
+bytestructures/guile/union.scm
+bytestructures/guile/numeric-all.scm
+bytestructures/guile/utils.scm
+bytestructures/guile/pointer.scm
+bytestructures/guile/base.scm
+bytestructures/guile/numeric.scm
+bytestructures/guile/struct.scm
+bytestructures/guile/bitfields.scm
+bytestructures/r6/bytevectors.scm
+bytestructures/body/base.syntactic.scm
+bytestructures/body/explicit-endianness.scm
+bytestructures/body/vector.scm
+bytestructures/body/union.scm
+bytestructures/body/utils.scm
+bytestructures/body/base.scm
+bytestructures/body/numeric.scm
+bytestructures/body/struct.scm
+bytestructures/body/bitfields.scm
+bytestructures/guile.scm"
+					 #\newline))
+		(guild (string-append (assoc-ref %build-inputs "guile")
+				      "/bin/guild")))
+	   ;; Make installation directories.
+	   (mkdir-p (string-append module-dir "/bytestructures/guile"))
+	   (mkdir-p (string-append module-dir "/bytestructures/r6"))
+	   (mkdir-p (string-append module-dir "/bytestructures/body")) 
+	   (mkdir-p doc)
+
+	   ;; Compile .scm files and install.
+	   (chdir source)
+	   (setenv "GUILE_AUTO_COMPILE" "0")
+	   (for-each (lambda (file)
+		       (let* ((dest-file (string-append module-dir "/"
+							file))
+			      (go-file (string-append module-dir "/"
+						      (substring file 0
+								 (string-rindex file #\.))
+						      ".go")))
+			 ;; Install source module.
+			 (copy-file file dest-file)
+			 ;; Install compiled module.
+			 (unless (zero? (system* guild "compile"
+						 "-L" source
+						 "-o" go-file
+						 file))
+			   (error (format #f "Failed to compile ~s to ~s!"
+					  file go-file)))))
+		     scm-files)
+
+	   ;; Also copy over the README.
+	   (install-file "README.md" doc)
+	   #t))))
+    (inputs
+     `(("guile" ,guile-2.0)))
+    (home-page "https://github.com/TaylanUB/scheme-bytestructures")
+    (synopsis "Structured access to bytevector contents for Guile")
+    (description
+     "Scheme bytestructures offers a system imitating the type system
+of the C programming language, to be used on bytevectors.  C's type
+system works on raw memory, and Scheme works on bytevectors which are
+an abstraction over raw memory.  It's also more powerful than the C
+type system, elevating types to first-class status.")
+    (license gpl3)))
+
 ;;; guile.scm ends here
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add scheme-bytestructures
  2016-10-09 10:38 [PATCH] Add scheme-bytestructures Amirouche Boubekki
@ 2016-10-10 17:51 ` Kei Kebreau
  2016-10-10 20:46   ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Kei Kebreau @ 2016-10-10 17:51 UTC (permalink / raw)
  To: Amirouche Boubekki; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 5320 bytes --]

Amirouche Boubekki <amirouche.boubekki@gmail.com> writes:

> Warning: scheme-bytestructures works on various implementation of Scheme but this patch adds
> it only for guile-2.0.
>
> This is a pure scheme package there is no autotools that's why I use the trivial-build-system.
>
> This doesn't run the test suite, yet.
>
> From fb2eb7ffd88ec4fba09411195a54b59d67d9c137 Mon Sep 17 00:00:00 2001
> From: Amirouche <amirouche@hypermove.net>
> Date: Sun, 9 Oct 2016 12:31:20 +0200
> Subject: [PATCH] gnu: Add scheme-bytestructures
>
> * gnu/packages/guile.scm (scheme-bytestructures): New variable.
>
> diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
> index 0890f19..383990e 100644
> --- a/gnu/packages/guile.scm
> +++ b/gnu/packages/guile.scm
> @@ -1265,4 +1265,105 @@ is no support for parsing block and inline level HTML.")
>  (define-public guile2.2-commonmark
>    (package-for-guile-2.2 guile-commonmark))
>  
> +(define-public scheme-bytestructures
> +  (package
> +    (name "scheme-bytestructures")
> +    (version "20160726.53127f6")
> +    (source (origin
> +	      (method git-fetch)
> +	      (uri (git-reference
> +		    (url "https://github.com/TaylanUB/scheme-bytestructures")
> +		    (commit "53127f608caf64b34fa41c389b2743b546fbe9da")))
> +	      (file-name (string-append name "-" version "-checkout"))
> +	      (sha256
> +	       (base32
> +		"0l4nx1vp9fkrgrgwjiycj7nx6wfjfd39rqamv4pmq7issi8mrywq"))))
> +    (build-system trivial-build-system)
> +    (arguments
> +     `(#:modules ((guix build utils))
> +       #:builder
> +       (begin
> +	 (use-modules (guix build utils)
> +		      (ice-9 match)
> +		      (ice-9 popen)
> +		      (ice-9 rdelim))
> +
> +	 (let* ((out (assoc-ref %outputs "out"))
> +		(guile (assoc-ref %build-inputs "guile"))
> +		(effective (read-line
> +			    (open-pipe* OPEN_READ
> +					(string-append guile "/bin/guile")
> +					"-c" "(display (effective-version))")))
> +		(module-dir (string-append out "/share/guile/site/"
> +					   effective))
> +		(source (assoc-ref %build-inputs "source"))
> +		(doc (string-append out "/share/doc/scheme-bytestructures"))
> +		(scm-files (string-split "bytestructures/guile/explicit-endianness.scm
> +bytestructures/guile/numeric-metadata.scm
> +bytestructures/guile/ffi.scm
> +bytestructures/guile/vector.scm
> +bytestructures/guile/union.scm
> +bytestructures/guile/numeric-all.scm
> +bytestructures/guile/utils.scm
> +bytestructures/guile/pointer.scm
> +bytestructures/guile/base.scm
> +bytestructures/guile/numeric.scm
> +bytestructures/guile/struct.scm
> +bytestructures/guile/bitfields.scm
> +bytestructures/r6/bytevectors.scm
> +bytestructures/body/base.syntactic.scm
> +bytestructures/body/explicit-endianness.scm
> +bytestructures/body/vector.scm
> +bytestructures/body/union.scm
> +bytestructures/body/utils.scm
> +bytestructures/body/base.scm
> +bytestructures/body/numeric.scm
> +bytestructures/body/struct.scm
> +bytestructures/body/bitfields.scm
> +bytestructures/guile.scm"
> +					 #\newline))
> +		(guild (string-append (assoc-ref %build-inputs "guile")
> +				      "/bin/guild")))
> +	   ;; Make installation directories.
> +	   (mkdir-p (string-append module-dir "/bytestructures/guile"))
> +	   (mkdir-p (string-append module-dir "/bytestructures/r6"))
> +	   (mkdir-p (string-append module-dir "/bytestructures/body")) 
> +	   (mkdir-p doc)
> +
> +	   ;; Compile .scm files and install.
> +	   (chdir source)
> +	   (setenv "GUILE_AUTO_COMPILE" "0")
> +	   (for-each (lambda (file)
> +		       (let* ((dest-file (string-append module-dir "/"
> +							file))
> +			      (go-file (string-append module-dir "/"
> +						      (substring file 0
> +								 (string-rindex file #\.))
> +						      ".go")))
> +			 ;; Install source module.
> +			 (copy-file file dest-file)
> +			 ;; Install compiled module.
> +			 (unless (zero? (system* guild "compile"
> +						 "-L" source
> +						 "-o" go-file
> +						 file))
> +			   (error (format #f "Failed to compile ~s to ~s!"
> +					  file go-file)))))
> +		     scm-files)
> +
> +	   ;; Also copy over the README.
> +	   (install-file "README.md" doc)
> +	   #t))))
> +    (inputs
> +     `(("guile" ,guile-2.0)))
> +    (home-page "https://github.com/TaylanUB/scheme-bytestructures")
> +    (synopsis "Structured access to bytevector contents for Guile")
> +    (description
> +     "Scheme bytestructures offers a system imitating the type system
> +of the C programming language, to be used on bytevectors.  C's type
> +system works on raw memory, and Scheme works on bytevectors which are
> +an abstraction over raw memory.  It's also more powerful than the C
> +type system, elevating types to first-class status.")
> +    (license gpl3)))
> +
>  ;;; guile.scm ends here

Looks good for the most part. Just two things:

Formatting-wise, we use spaces rather than tabs; a simple fix.

I'm getting messages from "./pre-inst-env guix build --check --rounds=2
scheme-bytestructures" that the package derivation may not be
deterministic. However, other packages in guile.scm seem to have the
same issue, so perhaps someone more experienced with this file can
determine whether this is a cause for concern.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add scheme-bytestructures
  2016-10-10 17:51 ` Kei Kebreau
@ 2016-10-10 20:46   ` Ludovic Courtès
  2016-10-11 13:15     ` Taylan Ulrich Bayırlı/Kammer
  2016-10-18 13:14     ` Amirouche Boubekki
  0 siblings, 2 replies; 10+ messages in thread
From: Ludovic Courtès @ 2016-10-10 20:46 UTC (permalink / raw)
  To: Kei Kebreau; +Cc: guix-devel

Hi Amirouche,

Some comments to complement Kei’s.

Kei Kebreau <kei@openmailbox.org> skribis:

> Amirouche Boubekki <amirouche.boubekki@gmail.com> writes:
>
>> Warning: scheme-bytestructures works on various implementation of Scheme but this patch adds
>> it only for guile-2.0.
>>
>> This is a pure scheme package there is no autotools that's why I use the trivial-build-system.
>>
>> This doesn't run the test suite, yet.
>>
>> From fb2eb7ffd88ec4fba09411195a54b59d67d9c137 Mon Sep 17 00:00:00 2001
>> From: Amirouche <amirouche@hypermove.net>
>> Date: Sun, 9 Oct 2016 12:31:20 +0200
>> Subject: [PATCH] gnu: Add scheme-bytestructures
>>
>> * gnu/packages/guile.scm (scheme-bytestructures): New variable.
>>
>> diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
>> index 0890f19..383990e 100644
>> --- a/gnu/packages/guile.scm
>> +++ b/gnu/packages/guile.scm
>> @@ -1265,4 +1265,105 @@ is no support for parsing block and inline level HTML.")
>>  (define-public guile2.2-commonmark
>>    (package-for-guile-2.2 guile-commonmark))
>>  
>> +(define-public scheme-bytestructures
>> +  (package
>> +    (name "scheme-bytestructures")

I would suggest calling it “guile-scheme-bytestructures” (or
“guile-bytestructures”?) to distinguish this package from the same one
built for another implementation.

>> +		(scm-files (string-split "bytestructures/guile/explicit-endianness.scm
>> +bytestructures/guile/numeric-metadata.scm
>> +bytestructures/guile/ffi.scm
>> +bytestructures/guile/vector.scm
>> +bytestructures/guile/union.scm
>> +bytestructures/guile/numeric-all.scm
>> +bytestructures/guile/utils.scm
>> +bytestructures/guile/pointer.scm
>> +bytestructures/guile/base.scm
>> +bytestructures/guile/numeric.scm
>> +bytestructures/guile/struct.scm
>> +bytestructures/guile/bitfields.scm
>> +bytestructures/r6/bytevectors.scm
>> +bytestructures/body/base.syntactic.scm
>> +bytestructures/body/explicit-endianness.scm
>> +bytestructures/body/vector.scm
>> +bytestructures/body/union.scm
>> +bytestructures/body/utils.scm
>> +bytestructures/body/base.scm
>> +bytestructures/body/numeric.scm
>> +bytestructures/body/struct.scm
>> +bytestructures/body/bitfields.scm
>> +bytestructures/guile.scm"

Please let’s not list all the files.  :-)  Could it instead use
something like (find-files "bytestructures" "\\.scm$")?

>> +	   ;; Compile .scm files and install.
>> +	   (chdir source)
>> +	   (setenv "GUILE_AUTO_COMPILE" "0")
>> +	   (for-each (lambda (file)
>> +		       (let* ((dest-file (string-append module-dir "/"
>> +							file))
>> +			      (go-file (string-append module-dir "/"
>> +						      (substring file 0
>> +								 (string-rindex file #\.))
>> +						      ".go")))
>> +			 ;; Install source module.
>> +			 (copy-file file dest-file)
>> +			 ;; Install compiled module.
>> +			 (unless (zero? (system* guild "compile"
>> +						 "-L" source
>> +						 "-o" go-file
>> +						 file))
>> +			   (error (format #f "Failed to compile ~s to ~s!"
>> +					  file go-file)))))
>> +		     scm-files)

At some point we should factorize this in a new (guix build guile)
module or something.  Any takers?  :-)

>> +    (license gpl3)))

Probably ‘gpl3+’; could you check?

> I'm getting messages from "./pre-inst-env guix build --check --rounds=2
> scheme-bytestructures" that the package derivation may not be
> deterministic. However, other packages in guile.scm seem to have the
> same issue, so perhaps someone more experienced with this file can
> determine whether this is a cause for concern.

Yeah, this is due to a Guile issue: <http://bugs.gnu.org/20272>.

Thanks
Ludo’.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add scheme-bytestructures
  2016-10-10 20:46   ` Ludovic Courtès
@ 2016-10-11 13:15     ` Taylan Ulrich Bayırlı/Kammer
  2016-10-18 13:14     ` Amirouche Boubekki
  1 sibling, 0 replies; 10+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2016-10-11 13:15 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

ludo@gnu.org (Ludovic Courtès) writes:

> Hi Amirouche,
>
> Some comments to complement Kei’s.
>
> Kei Kebreau <kei@openmailbox.org> skribis:
>
>> Amirouche Boubekki <amirouche.boubekki@gmail.com> writes:
>>
>>> Warning: scheme-bytestructures works on various implementation of Scheme but this patch adds
>>> it only for guile-2.0.
>>>
>>> This is a pure scheme package there is no autotools that's why I use the trivial-build-system.
>>>
>>> This doesn't run the test suite, yet.
>>>
>>> From fb2eb7ffd88ec4fba09411195a54b59d67d9c137 Mon Sep 17 00:00:00 2001
>>> From: Amirouche <amirouche@hypermove.net>
>>> Date: Sun, 9 Oct 2016 12:31:20 +0200
>>> Subject: [PATCH] gnu: Add scheme-bytestructures
>>>
>>> * gnu/packages/guile.scm (scheme-bytestructures): New variable.
>>>
>>> diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
>>> index 0890f19..383990e 100644
>>> --- a/gnu/packages/guile.scm
>>> +++ b/gnu/packages/guile.scm
>>> @@ -1265,4 +1265,105 @@ is no support for parsing block and inline level HTML.")
>>>  (define-public guile2.2-commonmark
>>>    (package-for-guile-2.2 guile-commonmark))
>>>  
>>> +(define-public scheme-bytestructures
>>> +  (package
>>> +    (name "scheme-bytestructures")
>
> I would suggest calling it “guile-scheme-bytestructures” (or
> “guile-bytestructures”?) to distinguish this package from the same one
> built for another implementation.

FWIW, second option sounds good to me (guile-bytestructures), speaking
as bytestructures author.

>>> +    (license gpl3)))
>
> Probably ‘gpl3+’; could you check?

The intention is gpl3+ so if any file implies otherwise that's an error
on my end.  I'm pretty sure I've used standard gpl3+ boilerplate
everywhere though.

Thanks all for doing this. :-)

Taylan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add scheme-bytestructures
  2016-10-10 20:46   ` Ludovic Courtès
  2016-10-11 13:15     ` Taylan Ulrich Bayırlı/Kammer
@ 2016-10-18 13:14     ` Amirouche Boubekki
  2016-10-18 14:27       ` Ludovic Courtès
  1 sibling, 1 reply; 10+ messages in thread
From: Amirouche Boubekki @ 2016-10-18 13:14 UTC (permalink / raw)
  To: Ludovic Courtès, Kei Kebreau; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]

On Mon, Oct 10, 2016 at 10:46 PM Ludovic Courtès <ludo@gnu.org> wrote:

> Hi Amirouche,


[...]


> >> +            (scm-files (string-split
> "bytestructures/guile/explicit-endianness.scm
> >> +bytestructures/guile/numeric-metadata.scm
> >> +bytestructures/guile/ffi.scm
> >> +bytestructures/guile/vector.scm
> >> +bytestructures/guile/union.scm
> >> +bytestructures/guile/numeric-all.scm
> >> +bytestructures/guile/utils.scm
> >> +bytestructures/guile/pointer.scm
> >> +bytestructures/guile/base.scm
> >> +bytestructures/guile/numeric.scm
> >> +bytestructures/guile/struct.scm
> >> +bytestructures/guile/bitfields.scm
> >> +bytestructures/r6/bytevectors.scm
> >> +bytestructures/body/base.syntactic.scm
> >> +bytestructures/body/explicit-endianness.scm
> >> +bytestructures/body/vector.scm
> >> +bytestructures/body/union.scm
> >> +bytestructures/body/utils.scm
> >> +bytestructures/body/base.scm
> >> +bytestructures/body/numeric.scm
> >> +bytestructures/body/struct.scm
> >> +bytestructures/body/bitfields.scm
> >> +bytestructures/guile.scm"
>
> Please let’s not list all the files.  :-)  Could it instead use
> something like (find-files "bytestructures" "\\.scm$")?
>

The above is a subset of all files. Do you prefer to use `find-files` and
exclude some files?

Regards,

Amirouche

[-- Attachment #2: Type: text/html, Size: 2451 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add scheme-bytestructures
  2016-10-18 13:14     ` Amirouche Boubekki
@ 2016-10-18 14:27       ` Ludovic Courtès
  2016-10-19  7:18         ` Amirouche Boubekki
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2016-10-18 14:27 UTC (permalink / raw)
  To: Amirouche Boubekki; +Cc: guix-devel

Amirouche Boubekki <amirouche.boubekki@gmail.com> skribis:

> On Mon, Oct 10, 2016 at 10:46 PM Ludovic Courtès <ludo@gnu.org> wrote:
>
>> Hi Amirouche,
>
>
> [...]
>
>
>> >> +            (scm-files (string-split
>> "bytestructures/guile/explicit-endianness.scm
>> >> +bytestructures/guile/numeric-metadata.scm
>> >> +bytestructures/guile/ffi.scm
>> >> +bytestructures/guile/vector.scm
>> >> +bytestructures/guile/union.scm
>> >> +bytestructures/guile/numeric-all.scm
>> >> +bytestructures/guile/utils.scm
>> >> +bytestructures/guile/pointer.scm
>> >> +bytestructures/guile/base.scm
>> >> +bytestructures/guile/numeric.scm
>> >> +bytestructures/guile/struct.scm
>> >> +bytestructures/guile/bitfields.scm
>> >> +bytestructures/r6/bytevectors.scm
>> >> +bytestructures/body/base.syntactic.scm
>> >> +bytestructures/body/explicit-endianness.scm
>> >> +bytestructures/body/vector.scm
>> >> +bytestructures/body/union.scm
>> >> +bytestructures/body/utils.scm
>> >> +bytestructures/body/base.scm
>> >> +bytestructures/body/numeric.scm
>> >> +bytestructures/body/struct.scm
>> >> +bytestructures/body/bitfields.scm
>> >> +bytestructures/guile.scm"
>>
>> Please let’s not list all the files.  :-)  Could it instead use
>> something like (find-files "bytestructures" "\\.scm$")?
>>
>
> The above is a subset of all files. Do you prefer to use `find-files` and
> exclude some files?

Whichever is the most concise and most maintainable approach (I suspect
it’s ‘find-files’ + exclude specific files.)

Ludo’.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add scheme-bytestructures
  2016-10-18 14:27       ` Ludovic Courtès
@ 2016-10-19  7:18         ` Amirouche Boubekki
  2016-10-20 14:00           ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Amirouche Boubekki @ 2016-10-19  7:18 UTC (permalink / raw)
  To: Kei Kebreau, guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 738 bytes --]

Updated the patch.

On Tue, Oct 18, 2016 at 4:28 PM Ludovic Courtès <ludo@gnu.org> wrote:

> Amirouche Boubekki <amirouche.boubekki@gmail.com> skribis:
>
> > On Mon, Oct 10, 2016 at 10:46 PM Ludovic Courtès <ludo@gnu.org> wrote:
> >
>

[...]


> >> Please let’s not list all the files.  :-)  Could it instead use
> >> something like (find-files "bytestructures" "\\.scm$")?
> >>
> >
> > The above is a subset of all files. Do you prefer to use `find-files` and
> > exclude some files?
>
> Whichever is the most concise and most maintainable approach (I suspect
> it’s ‘find-files’ + exclude specific files.)
>
> Ludo’.
>

find-files does the right thing, there is no need to filter what it returns.

[-- Attachment #1.2: Type: text/html, Size: 1712 bytes --]

[-- Attachment #2: 0001-gnu-Add-guile-bytestructures.patch --]
[-- Type: text/x-patch, Size: 4511 bytes --]

From ea88bf4b53a63ba0d54f71622d055c32cd7e346e Mon Sep 17 00:00:00 2001
From: Amirouche <amirouche@hypermove.net>
Date: Sun, 9 Oct 2016 12:31:20 +0200
Subject: [PATCH] gnu: Add guile-bytestructures

* gnu/packages/guile.scm (guile-bytestructures): New variable.
---
 gnu/packages/guile.scm | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 43071e6..a03cb44 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -1267,4 +1267,82 @@ is no support for parsing block and inline level HTML.")
 (define-public guile2.2-commonmark
   (package-for-guile-2.2 guile-commonmark))
 
+(define-public guile-bytestructures
+  (package
+    (name "guile-bytestructures")
+    (version "20160726.53127f6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/TaylanUB/scheme-bytestructures")
+                    (commit "53127f608caf64b34fa41c389b2743b546fbe9da")))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "0l4nx1vp9fkrgrgwjiycj7nx6wfjfd39rqamv4pmq7issi8mrywq"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 match)
+                      (ice-9 popen)
+                      (ice-9 rdelim))
+
+         (let* ((out (assoc-ref %outputs "out"))
+                (guile (assoc-ref %build-inputs "guile"))
+                (effective (read-line
+                            (open-pipe* OPEN_READ
+                                        (string-append guile "/bin/guile")
+                                        "-c" "(display (effective-version))")))
+                (module-dir (string-append out "/share/guile/site/"
+                                           effective))
+                (source (assoc-ref %build-inputs "source"))
+                (doc (string-append out "/share/doc/scheme-bytestructures"))
+                (scm-files (find-files "bytestructures" "\\.scm$"))
+                (guild (string-append (assoc-ref %build-inputs "guile")
+                                      "/bin/guild")))
+           ;; Make installation directories.
+           (mkdir-p (string-append module-dir "/bytestructures/guile"))
+           (mkdir-p (string-append module-dir "/bytestructures/r6"))
+           (mkdir-p (string-append module-dir "/bytestructures/body"))
+           (mkdir-p doc)
+
+           ;; Compile .scm files and install.
+           (chdir source)
+           (setenv "GUILE_AUTO_COMPILE" "0")
+           (for-each (lambda (file)
+                       (let* ((dest-file (string-append module-dir "/"
+                                                        file))
+                              (go-file (string-append module-dir "/"
+                                                      (substring file 0
+                                                                 (string-rindex file #\.))
+                                                      ".go")))
+                         ;; Install source module.
+                         (copy-file file dest-file)
+                         ;; Install compiled module.
+                         (unless (zero? (system* guild "compile"
+                                                 "-L" source
+                                                 "-o" go-file
+                                                 file))
+                           (error (format #f "Failed to compile ~s to ~s!"
+                                          file go-file)))))
+                     scm-files)
+
+           ;; Also copy over the README.
+           (install-file "README.md" doc)
+           #t))))
+    (inputs
+     `(("guile" ,guile-2.0)))
+    (home-page "https://github.com/TaylanUB/scheme-bytestructures")
+    (synopsis "Structured access to bytevector contents for Guile")
+    (description
+     "Guile bytestructures offers a system imitating the type system
+of the C programming language, to be used on bytevectors.  C's type
+system works on raw memory, and Guile works on bytevectors which are
+an abstraction over raw memory.  It's also more powerful than the C
+type system, elevating types to first-class status.")
+    (license gpl3+)))
+
 ;;; guile.scm ends here
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add scheme-bytestructures
  2016-10-19  7:18         ` Amirouche Boubekki
@ 2016-10-20 14:00           ` Ludovic Courtès
  2016-10-20 16:03             ` Amirouche Boubekki
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2016-10-20 14:00 UTC (permalink / raw)
  To: Amirouche Boubekki; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 616 bytes --]

Hello,

Amirouche Boubekki <amirouche.boubekki@gmail.com> skribis:

> find-files does the right thing, there is no need to filter what it returns.
> From ea88bf4b53a63ba0d54f71622d055c32cd7e346e Mon Sep 17 00:00:00 2001
> From: Amirouche <amirouche@hypermove.net>
> Date: Sun, 9 Oct 2016 12:31:20 +0200
> Subject: [PATCH] gnu: Add guile-bytestructures
>
> * gnu/packages/guile.scm (guile-bytestructures): New variable.

I had to make these extra modifications (the package you sent built but
the result was a bunch of empty directories because ‘find-files’ was
called from the wrong directory):


[-- Attachment #2: Type: text/x-patch, Size: 2188 bytes --]

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index a03cb44..f99077b 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2016 Eraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2016 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <adfeno@openmailbox.org>
+;;; Copyright © 2016 Amirouche <amirouche@hypermove.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1300,13 +1301,11 @@ is no support for parsing block and inline level HTML.")
                                            effective))
                 (source (assoc-ref %build-inputs "source"))
                 (doc (string-append out "/share/doc/scheme-bytestructures"))
-                (scm-files (find-files "bytestructures" "\\.scm$"))
+                (scm-files (with-directory-excursion source
+                             (find-files "bytestructures" "\\.scm$")))
                 (guild (string-append (assoc-ref %build-inputs "guile")
                                       "/bin/guild")))
            ;; Make installation directories.
-           (mkdir-p (string-append module-dir "/bytestructures/guile"))
-           (mkdir-p (string-append module-dir "/bytestructures/r6"))
-           (mkdir-p (string-append module-dir "/bytestructures/body"))
            (mkdir-p doc)
 
            ;; Compile .scm files and install.
@@ -1320,8 +1319,11 @@ is no support for parsing block and inline level HTML.")
                                                                  (string-rindex file #\.))
                                                       ".go")))
                          ;; Install source module.
+                         (mkdir-p (dirname dest-file))
                          (copy-file file dest-file)
+
                          ;; Install compiled module.
+                         (mkdir-p (dirname go-file))
                          (unless (zero? (system* guild "compile"
                                                  "-L" source
                                                  "-o" go-file

[-- Attachment #3: Type: text/plain, Size: 1816 bytes --]


However, with those changes, I get:

--8<---------------cut here---------------start------------->8---
ice-9/boot-9.scm:106:20: Syntax error:
bytestructures/body/base.scm:38:0: definition in expression context, where definitions are not allowed, in form (define make-bytestructure-descriptor (case-lambda ((size alignment unwrapper getter setter) (%make-bytestructure-descriptor size alignment unwrapper getter setter #f)) ((size alignment unwrapper getter setter meta) (%make-bytestructure-descriptor size alignment unwrapper getter setter meta))))
Backtrace:
In ice-9/boot-9.scm:
 157: 12 [catch #t #<catch-closure 8c9560> ...]
In unknown file:
   ?: 11 [apply-smob/1 #<catch-closure 8c9560>]
In ice-9/boot-9.scm:
  63: 10 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 432: 9 [eval # #]
In ice-9/boot-9.scm:
2401: 8 [save-module-excursion #<procedure 8e7880 at ice-9/boot-9.scm:4045:3 ()>]
4050: 7 [#<procedure 8e7880 at ice-9/boot-9.scm:4045:3 ()>]
1724: 6 [%start-stack load-stack #<procedure 8fa7a0 at ice-9/boot-9.scm:4041:10 ()>]
1729: 5 [#<procedure 8fdc60 ()>]
In unknown file:
   ?: 4 [primitive-load "/gnu/store/jx9byzydknqixyv4dn19cxa5q7r6s6v9-guile-bytestructures-20160726.53127f6-guile-builder"]
In ice-9/eval.scm:
 387: 3 [eval # ()]
 432: 2 [eval # #]
In ice-9/boot-9.scm:
 768: 1 [for-each #<procedure ca5030 at ice-9/eval.scm:416:20 (a)> #]
In unknown file:
   ?: 0 [scm-error misc-error #f ...]

ERROR: In procedure scm-error:
ERROR: Failed to compile "bytestructures/r7/base.scm" to "/gnu/store/m0lqx4wli55dfj45nsjhlhlvgql1p974-guile-bytestructures-20160726.53127f6/share/guile/site/2.0/bytestructures/r7/base.go"!
--8<---------------cut here---------------end--------------->8---

Could you look into it and submit and updated patch?

TIA!

Ludo’.

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add scheme-bytestructures
  2016-10-20 14:00           ` Ludovic Courtès
@ 2016-10-20 16:03             ` Amirouche Boubekki
  2016-10-24 20:56               ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Amirouche Boubekki @ 2016-10-20 16:03 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 1279 bytes --]

On Thu, Oct 20, 2016 at 4:00 PM Ludovic Courtès <ludo@gnu.org> wrote:

> Hello,
>
> Amirouche Boubekki <amirouche.boubekki@gmail.com> skribis:
>
> > find-files does the right thing, there is no need to filter what it
> returns.
> > From ea88bf4b53a63ba0d54f71622d055c32cd7e346e Mon Sep 17 00:00:00 2001
> > From: Amirouche <amirouche@hypermove.net>
> > Date: Sun, 9 Oct 2016 12:31:20 +0200
> > Subject: [PATCH] gnu: Add guile-bytestructures
> >
> > * gnu/packages/guile.scm (guile-bytestructures): New variable.
>
> I had to make these extra modifications (the package you sent built but
> the result was a bunch of empty directories because ‘find-files’ was
> called from the wrong directory):
>
>
> However, with those changes, I get:
>
> --8<---------------cut here---------------start------------->8---
>

[...]


> ERROR: In procedure scm-error:
> ERROR: Failed to compile "bytestructures/r7/base.scm" to
> "/gnu/store/m0lqx4wli55dfj45nsjhlhlvgql1p974-guile-bytestructures-20160726.53127f6/share/guile/site/2.0/bytestructures/r7/base.go"!
> --8<---------------cut here---------------end--------------->8---
>
> Could you look into it and submit and updated patch?
>

It was the r7 files that could not be compiled. I filtered them.

[-- Attachment #1.2: Type: text/html, Size: 2412 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-guile-bytestructures.patch --]
[-- Type: text/x-patch; charset=US-ASCII; name="0001-gnu-Add-guile-bytestructures.patch", Size: 4984 bytes --]

From a40c2f8da528b4d1010cdf9d1ce96059ec084078 Mon Sep 17 00:00:00 2001
From: Amirouche <amirouche@hypermove.net>
Date: Sun, 9 Oct 2016 12:31:20 +0200
Subject: [PATCH] gnu: Add guile-bytestructures

* gnu/packages/guile.scm (guile-bytestructures): New variable.
---
 gnu/packages/guile.scm | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 43071e6..2325a25 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2016 Eraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2016 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <adfeno@openmailbox.org>
+;;; Copyright © 2016 Amirouche <amirouche@hypermove.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1267,4 +1268,84 @@ is no support for parsing block and inline level HTML.")
 (define-public guile2.2-commonmark
   (package-for-guile-2.2 guile-commonmark))
 
+(define-public guile-bytestructures
+  (package
+    (name "guile-bytestructures")
+    (version "20160726.53127f6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/TaylanUB/scheme-bytestructures")
+                    (commit "53127f608caf64b34fa41c389b2743b546fbe9da")))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "0l4nx1vp9fkrgrgwjiycj7nx6wfjfd39rqamv4pmq7issi8mrywq"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 match)
+                      (ice-9 popen)
+                      (ice-9 rdelim))
+         (let* ((out (assoc-ref %outputs "out"))
+                (guile (assoc-ref %build-inputs "guile"))
+                (effective (read-line
+                            (open-pipe* OPEN_READ
+                                        (string-append guile "/bin/guile")
+                                        "-c" "(display (effective-version))")))
+                (module-dir (string-append out "/share/guile/site/"
+                                           effective))
+                (source (assoc-ref %build-inputs "source"))
+                (doc (string-append out "/share/doc/scheme-bytestructures"))
+                (scm-files (filter (lambda (path)
+                                     (not (string-prefix? "bytestructures/r7" path)))
+                                   (with-directory-excursion source
+                                     (find-files "bytestructures" "\\.scm$"))))
+                (guild (string-append (assoc-ref %build-inputs "guile")
+                                      "/bin/guild")))
+           ;; Make installation directories.
+           (mkdir-p doc)
+
+           ;; Compile .scm files and install.
+           (chdir source)
+           (setenv "GUILE_AUTO_COMPILE" "0")
+           (for-each (lambda (file)
+                       (let* ((dest-file (string-append module-dir "/"
+                                                        file))
+                              (go-file (string-append module-dir "/"
+                                                      (substring file 0
+                                                                 (string-rindex file #\.))
+                                                      ".go")))
+                         ;; Install source module.
+                         (mkdir-p (dirname dest-file))
+                         (copy-file file dest-file)
+
+                         ;; Install compiled module.
+                         (mkdir-p (dirname go-file))
+                         (unless (zero? (system* guild "compile"
+                                                 "-L" source
+                                                 "-o" go-file
+                                                 file))
+                           (error (format #f "Failed to compile ~s to ~s!"
+                                          file go-file)))))
+                     scm-files)
+
+           ;; Also copy over the README.
+           (install-file "README.md" doc)
+           #t))))
+    (inputs
+     `(("guile" ,guile-2.0)))
+    (home-page "https://github.com/TaylanUB/scheme-bytestructures")
+    (synopsis "Structured access to bytevector contents for Guile")
+    (description
+     "Guile bytestructures offers a system imitating the type system
+of the C programming language, to be used on bytevectors.  C's type
+system works on raw memory, and Guile works on bytevectors which are
+an abstraction over raw memory.  It's also more powerful than the C
+type system, elevating types to first-class status.")
+    (license gpl3+)))
+
 ;;; guile.scm ends here
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add scheme-bytestructures
  2016-10-20 16:03             ` Amirouche Boubekki
@ 2016-10-24 20:56               ` Ludovic Courtès
  0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2016-10-24 20:56 UTC (permalink / raw)
  To: Amirouche Boubekki; +Cc: guix-devel

Amirouche Boubekki <amirouche.boubekki@gmail.com> skribis:

> On Thu, Oct 20, 2016 at 4:00 PM Ludovic Courtès <ludo@gnu.org> wrote:

[...]

>> ERROR: In procedure scm-error:
>> ERROR: Failed to compile "bytestructures/r7/base.scm" to
>> "/gnu/store/m0lqx4wli55dfj45nsjhlhlvgql1p974-guile-bytestructures-20160726.53127f6/share/guile/site/2.0/bytestructures/r7/base.go"!
>> --8<---------------cut here---------------end--------------->8---
>>
>> Could you look into it and submit and updated patch?
>>
>
> It was the r7 files that could not be compiled. I filtered them.
> From a40c2f8da528b4d1010cdf9d1ce96059ec084078 Mon Sep 17 00:00:00 2001
> From: Amirouche <amirouche@hypermove.net>
> Date: Sun, 9 Oct 2016 12:31:20 +0200
> Subject: [PATCH] gnu: Add guile-bytestructures
>
> * gnu/packages/guile.scm (guile-bytestructures): New variable.

Applied, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-10-24 20:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-09 10:38 [PATCH] Add scheme-bytestructures Amirouche Boubekki
2016-10-10 17:51 ` Kei Kebreau
2016-10-10 20:46   ` Ludovic Courtès
2016-10-11 13:15     ` Taylan Ulrich Bayırlı/Kammer
2016-10-18 13:14     ` Amirouche Boubekki
2016-10-18 14:27       ` Ludovic Courtès
2016-10-19  7:18         ` Amirouche Boubekki
2016-10-20 14:00           ` Ludovic Courtès
2016-10-20 16:03             ` Amirouche Boubekki
2016-10-24 20:56               ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).