Re: [PATCH] Add scheme-bytestructures

2016-10-24 Thread Ludovic Courtès
Amirouche Boubekki  skribis:

> On Thu, Oct 20, 2016 at 4:00 PM Ludovic Courtès  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 
> 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’.



Re: [PATCH] Add scheme-bytestructures

2016-10-20 Thread Amirouche Boubekki
On Thu, Oct 20, 2016 at 4:00 PM Ludovic Courtès  wrote:

> Hello,
>
> Amirouche Boubekki  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 
> > 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.
From a40c2f8da528b4d1010cdf9d1ce96059ec084078 Mon Sep 17 00:00:00 2001
From: Amirouche 
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 
 ;;; Copyright © 2016 Alex Kost 
 ;;; Copyright © 2016 Adonay "adfeno" Felipe Nogueira  
+;;; Copyright © 2016 Amirouche 
 ;;;
 ;;; 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)
+
+

Re: [PATCH] Add scheme-bytestructures

2016-10-20 Thread Ludovic Courtès
Hello,

Amirouche Boubekki  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 
> 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):

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 
 ;;; Copyright © 2016 Alex Kost 
 ;;; Copyright © 2016 Adonay "adfeno" Felipe Nogueira  
+;;; Copyright © 2016 Amirouche 
 ;;;
 ;;; 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

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 # ...]
In unknown file:
   ?: 11 [apply-smob/1 #]
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 #]
4050: 7 [#]
1724: 6 [%start-stack load-stack #]
1729: 5 [#]
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 # #]
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’.


Re: [PATCH] Add scheme-bytestructures

2016-10-19 Thread Amirouche Boubekki
Updated the patch.

On Tue, Oct 18, 2016 at 4:28 PM Ludovic Courtès  wrote:

> Amirouche Boubekki  skribis:
>
> > On Mon, Oct 10, 2016 at 10:46 PM Ludovic Courtès  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.
From ea88bf4b53a63ba0d54f71622d055c32cd7e346e Mon Sep 17 00:00:00 2001
From: Amirouche 
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 

Re: [PATCH] Add scheme-bytestructures

2016-10-18 Thread Ludovic Courtès
Amirouche Boubekki  skribis:

> On Mon, Oct 10, 2016 at 10:46 PM Ludovic Courtès  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’.



Re: [PATCH] Add scheme-bytestructures

2016-10-18 Thread Amirouche Boubekki
On Mon, Oct 10, 2016 at 10:46 PM Ludovic Courtès  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


Re: [PATCH] Add scheme-bytestructures

2016-10-10 Thread Kei Kebreau
Amirouche Boubekki  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 
> 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)
> +