unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Ruby install
@ 2014-05-04 17:51 Pjotr Prins
  2014-05-05  8:03 ` Ludovic Courtès
  2014-09-27 12:29 ` [PATCH] New ruby package Pjotr Prins
  0 siblings, 2 replies; 12+ messages in thread
From: Pjotr Prins @ 2014-05-04 17:51 UTC (permalink / raw)
  To: guix-devel

Hi,

I have a working Ruby installation at

  https://gitorious.org/guix/pjotrps-guix/source/61d21fad72d49cbbf0135b5ac7362bb0f64167fa:gnu/packages/ruby.scm

This is my first GUIX package (I have written Nix packages before), so
please have a look.

I intend to patch rubygems so gems get installed in a $HOME dir
specifically named after the SHA. This will accomodate people who just
want to use rubygems.

I am also going to add particalur gems to GUIX, each going into its
own expression. That will be a bit tricky because I don't want
Rubygems to install dependencies. Not sure how the Nix guys did it, so
I will study that.

Do we have a HOWTO on how to run expressions in the Guile debugger?
Never used that and would like to see how individual statements
evaluate in LISP.

I am really impressed with GUIX, and I think it is a no-brainer to use
a real functional programming language for this. Thanks Ludo and
others!  I just wish I could use GUIX on servers where I don't have (and
won't get) root access. Or is there a way? With Nix I could run as a
normal user.

Pj.

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

* Re: Ruby install
  2014-05-04 17:51 Ruby install Pjotr Prins
@ 2014-05-05  8:03 ` Ludovic Courtès
  2014-05-05  8:29   ` Pjotr Prins
                     ` (2 more replies)
  2014-09-27 12:29 ` [PATCH] New ruby package Pjotr Prins
  1 sibling, 3 replies; 12+ messages in thread
From: Ludovic Courtès @ 2014-05-05  8:03 UTC (permalink / raw)
  To: Pjotr Prins; +Cc: guix-devel

Hi, Pjotr,

Pjotr Prins <pjotr.public12@thebird.nl> skribis:

> I have a working Ruby installation at
>
>   https://gitorious.org/guix/pjotrps-guix/source/61d21fad72d49cbbf0135b5ac7362bb0f64167fa:gnu/packages/ruby.scm
>
> This is my first GUIX package (I have written Nix packages before), so
> please have a look.

Overall looks good to me!  A couple of comments:

59.            (substitute* (filter file-exists?
60.                             '( 
61.                               "ext/readline/readline.c"
62.                             ))

Here we can assume that the file exists I believe, so the ‘filter’ call
can be removed.

67.            (substitute* (filter file-exists?
68.                             '(
69.                               "configure"
70.                               "configure.in"
71.                               "Makefile.in"
72.                               "ext/pty/pty.c"
73.                               "io.c"
74.                               "lib/mkmf.rb"
75.                               "process.c"
76.                               "test/rubygems/test_gem_ext_configure_builder.rb"
77.                               "test/rdoc/test_rdoc_parser.rb"
78.                               "test/ruby/test_rubyoptions.rb"
79.                               "test/ruby/test_process.rb"
80.                               "test/ruby/test_system.rb"
81.                               "tool/rbinstall.rb"
82.                               "tool/config.guess"
83.                              ))
84.              (("/bin/sh") (which "sh"))))

Likewise.  In addition, I think only the .rb and .c files need to be
patched, since the others are already handled automatically, normally.

(In the future please send it as an in-line patch.)

> I intend to patch rubygems so gems get installed in a $HOME dir
> specifically named after the SHA. This will accomodate people who just
> want to use rubygems.
>
> I am also going to add particalur gems to GUIX, each going into its
> own expression. That will be a bit tricky because I don't want
> Rubygems to install dependencies. Not sure how the Nix guys did it, so
> I will study that.

It may be helpful to have a ‘ruby-build-system’, akin to
‘python-build-system’ but with the right incantations (info "(guix)
Build Systems").

> Do we have a HOWTO on how to run expressions in the Guile debugger?
> Never used that and would like to see how individual statements
> evaluate in LISP.

Basically there are two approaches.  From the command line, like this:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guile
GNU Guile 2.0.11.20-4338f
Copyright (C) 1995-2014 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> ,use (gnu packages python)
scheme@(guile-user)> ,use (guix)
scheme@(guile-user)> (define s (open-connection))
scheme@(guile-user)> python
$1 = #<package python-3.3.5 gnu/packages/python.scm:46 2946840>
scheme@(guile-user)> (package-derivation s python)
$2 = #<derivation /gnu/store/k0lvsy8jwcw0amv1rsmii2cvwfnmn2gz-python-3.3.5.drv => /gnu/store/ij8xgynicdmnzb7pzmyb6bqi17s0ll3y-python-3.3.5 3f4fdc0>
scheme@(guile-user)> (build-derivations s (list $2))
$3 = #t
--8<---------------cut here---------------end--------------->8---

But the best thing, if you use Emacs, is to use Geiser, as noted in
‘HACKING’.  In addition to a REPL, it brings stuff like autodoc,
jump-to-definition, expression evaluation from the buffer, etc.

> I am really impressed with GUIX, and I think it is a no-brainer to use
> a real functional programming language for this. Thanks Ludo and
> others!  I just wish I could use GUIX on servers where I don't have (and
> won't get) root access. Or is there a way? With Nix I could run as a
> normal user.

It’s the same as Nix, which means that if the daemon cannot run as root,
then it’s usable in a “degraded” mode (info "(guix) Build Environment
Setup").

HTH,
Ludo’.

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

* Re: Ruby install
  2014-05-05  8:03 ` Ludovic Courtès
@ 2014-05-05  8:29   ` Pjotr Prins
  2014-05-05 11:42     ` Ludovic Courtès
  2014-06-04 21:36   ` Ludovic Courtès
  2014-10-27  4:58   ` guile ERROR: Unbound variable: sha256 Pjotr Prins
  2 siblings, 1 reply; 12+ messages in thread
From: Pjotr Prins @ 2014-05-05  8:29 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Mon, May 05, 2014 at 10:03:30AM +0200, Ludovic Courtès wrote:
> > I am really impressed with GUIX, and I think it is a no-brainer to use
> > a real functional programming language for this. 

I was imprecise here. It is my first real foray into LISP. What I
meant is that it is great to use a real programming language with the
most important functional characteristics of recursion and anonymous
functions :)

I believe much of Nix could be greatly simplified if they had opted
for this route. Did you see NixOS is speeding up the ranks in
distrowatch? I bet that is partly due to GUIX.

> > Thanks Ludo and
> > others!  I just wish I could use GUIX on servers where I don't have (and
> > won't get) root access. Or is there a way? With Nix I could run as a
> > normal user.
> 
> It???s the same as Nix, which means that if the daemon cannot run as root,
> then it???s usable in a ???degraded??? mode (info "(guix) Build Environment
> Setup").

That is good news. Anyone here using it as such?

Pj.

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

* Re: Ruby install
  2014-05-05  8:29   ` Pjotr Prins
@ 2014-05-05 11:42     ` Ludovic Courtès
  0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2014-05-05 11:42 UTC (permalink / raw)
  To: Pjotr Prins; +Cc: guix-devel

Pjotr Prins <pjotr.public12@thebird.nl> skribis:

> On Mon, May 05, 2014 at 10:03:30AM +0200, Ludovic Courtès wrote:
>> > I am really impressed with GUIX, and I think it is a no-brainer to use
>> > a real functional programming language for this. 
>
> I was imprecise here. It is my first real foray into LISP. What I
> meant is that it is great to use a real programming language with the
> most important functional characteristics of recursion and anonymous
> functions :)

The key benefit with using a general-purpose programming language is
that you get all the tools (REPL, IDE, debugger, compiler, i18n, etc.),
and it makes the whole thing composable.

Composability means that it’s trivial to implement things like ‘guix
build --with-source’, or Nikita’s ‘guix prefetch’ command, or the
program that builds <http://www.gnu.org/software/guix/package-list.html>,
for example.

Ludo’.

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

* Re: Ruby install
  2014-05-05  8:03 ` Ludovic Courtès
  2014-05-05  8:29   ` Pjotr Prins
@ 2014-06-04 21:36   ` Ludovic Courtès
  2014-06-05  9:57     ` Pjotr Prins
  2014-10-27  4:58   ` guile ERROR: Unbound variable: sha256 Pjotr Prins
  2 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2014-06-04 21:36 UTC (permalink / raw)
  To: Pjotr Prins; +Cc: guix-devel

Hello,

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

> Pjotr Prins <pjotr.public12@thebird.nl> skribis:
>
>> I have a working Ruby installation at
>>
>>   https://gitorious.org/guix/pjotrps-guix/source/61d21fad72d49cbbf0135b5ac7362bb0f64167fa:gnu/packages/ruby.scm
>>
>> This is my first GUIX package (I have written Nix packages before), so
>> please have a look.
>
> Overall looks good to me!  A couple of comments:

Did you have a chance to look at it?

Ludo’.

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

* Re: Ruby install
  2014-06-04 21:36   ` Ludovic Courtès
@ 2014-06-05  9:57     ` Pjotr Prins
  0 siblings, 0 replies; 12+ messages in thread
From: Pjotr Prins @ 2014-06-05  9:57 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Wed, Jun 04, 2014 at 11:36:44PM +0200, Ludovic Courtès wrote:
> >> I have a working Ruby installation at
> >>
> >>   https://gitorious.org/guix/pjotrps-guix/source/61d21fad72d49cbbf0135b5ac7362bb0f64167fa:gnu/packages/ruby.scm
> >>
> >> This is my first GUIX package (I have written Nix packages before), so
> >> please have a look.
> >
> > Overall looks good to me!  A couple of comments:
> 
> Did you have a chance to look at it?

I am still in bootstrap mode on an aging CenOS6 compute cluster, so I
am not in package writing mode. I need to be able to install Nix/Guix
without root. I work in short stretches on the problem (I wish it
was easier! I tried bootstrapping Guix, but failed).

At this point I got Nix 1.6.1 working with this script
https://github.com/pjotrp/nix-no-root/blob/master/scripts/nix-bootstrap-home.sh,
which is derived from the Nix wiki.

Now, I need to patch Nix to work with PAM/LDAP (that fix is in 1.7,
but that does source tree does not compile with my script, I tried
that yesterday), next I need to upgrade the Guix package in Nix (it is
at 0.3) and then I can continue playing with packages.

The Ruby package needs work too because we need a sane way to handle
gems. I need to understand the way Nix does it and what Guix does with
Python. The way it is done now in Nix looks fairly complex. I don't
think we want automated gem processing.

Pj.

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

* [PATCH] New ruby package
  2014-05-04 17:51 Ruby install Pjotr Prins
  2014-05-05  8:03 ` Ludovic Courtès
@ 2014-09-27 12:29 ` Pjotr Prins
  2014-09-27 13:06   ` Pjotr Prins
  2014-09-28  4:00   ` David Thompson
  1 sibling, 2 replies; 12+ messages in thread
From: Pjotr Prins @ 2014-09-27 12:29 UTC (permalink / raw)
  To: guix-devel

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

Working Ruby package. Next step is to get gems working locally.

[-- Attachment #2: ruby-new.patch --]
[-- Type: text/x-diff, Size: 4358 bytes --]

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
new file mode 100644
index 0000000..a13606c
--- /dev/null
+++ b/gnu/packages/ruby.scm
@@ -0,0 +1,99 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2014 Pjotr Prins <pjotr.guix@thebird.nl>
+;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages ruby)
+  #:use-module ((guix licenses)
+                #:select (rl))
+  #:use-module (gnu packages)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages readline)
+  #:use-module (gnu packages openssl)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages libffi)
+  #:use-module (gnu packages gdbm)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix utils)
+  #:use-module (guix build-system gnu)
+;;;  #:use-module (guix build-system trivial))
+)
+
+(define-public ruby
+  (package
+    (name "ruby")
+    (version "2.1.3")
+    (source
+     (origin
+      (method url-fetch)
+      (uri (string-append "http://cache.ruby-lang.org/pub/ruby/2.1/"
+                          "ruby-" version ".tar.gz"))
+      ;;; (patch-flags '("p76"))
+      (sha256
+       (base32
+        "00bz6jcbxgnllplk4b9lnyc3w8yd3pz5rn11rmca1s8cn6vvw608"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:parallel-tests? #f
+       #:phases
+        (alist-cons-after
+         ;;; minor patch https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/45225/diff/
+         'unpack 'patch-readline  
+         (lambda _
+           (substitute* '( 
+                           "ext/readline/readline.c"
+                        )
+             (("Function ") "rl_hook_func_t ")))
+        (alist-cons-before
+         'configure 'replace-bin-sh
+         (lambda _
+           (substitute* '(
+                          "Makefile.in"
+                          "ext/pty/pty.c"
+                          "io.c"
+                          "lib/mkmf.rb"
+                          "process.c"
+                          "test/rubygems/test_gem_ext_configure_builder.rb"
+                          "test/rdoc/test_rdoc_parser.rb"
+                          "test/ruby/test_rubyoptions.rb"
+                          "test/ruby/test_process.rb"
+                          "test/ruby/test_system.rb"
+                          "tool/rbinstall.rb"
+                          ;;; "tool/config.guess"
+                        )
+             (("/bin/sh") (which "sh"))))
+          %standard-phases))))
+
+    (inputs
+     `(("readline" ,readline)
+       ("autoconf" ,autoconf)
+       ("openssl" ,openssl)
+       ("libffi" ,libffi)
+       ("gdbm" ,gdbm)
+       ("zlib" ,zlib)
+       ))
+
+    (synopsis "Ruby")
+    (home-page "https://www.ruby-lang.org/en/")
+    (synopsis
+     "Ruby programming language")
+    (description
+     "Ruby description")
+    (license rl)))
+
diff --git a/guix/licenses.scm b/guix/licenses.scm
index 23e4458..d9b71d7 100644
--- a/guix/licenses.scm
+++ b/guix/licenses.scm
@@ -255,6 +255,11 @@ which may be a file:// URI pointing the package's tree."
            "http://directory.fsf.org/wiki/License:QPLv1.0"
            "http://www.gnu.org/licenses/license-list.html#QPL"))
 
+(define rl
+  (license "Ruby License"
+           "http://directory.fsf.org/wiki/License:Ruby"
+           "https://www.ruby-lang.org/en/about/license.txt"))
+
 (define vim
   (license "Vim"
            "http://directory.fsf.org/wiki/License:Vim7.2"

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

* Re: [PATCH] New ruby package
  2014-09-27 12:29 ` [PATCH] New ruby package Pjotr Prins
@ 2014-09-27 13:06   ` Pjotr Prins
  2014-09-27 13:44     ` David Thompson
  2014-09-28  4:00   ` David Thompson
  1 sibling, 1 reply; 12+ messages in thread
From: Pjotr Prins @ 2014-09-27 13:06 UTC (permalink / raw)
  To: guix-devel

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

Ok, hopefully this is the right patch after rebase and format-patch.


[-- Attachment #2: 0001-packages-Add-Ruby.patch --]
[-- Type: text/x-diff, Size: 4880 bytes --]

From d0d9843f80aca29e51f82c2da894369f892c9e3c Mon Sep 17 00:00:00 2001
From: Pjotr Prins <pjotr.public01@thebird.nl>
Date: Sat, 27 Sep 2014 14:56:44 +0200
Subject: [PATCH] packages: Add Ruby

* gnu/packages/ruby.scm (Ruby): Added Ruby package
* guix/licenses.scm: Added Ruby license information
---
 gnu/packages/ruby.scm |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
 guix/licenses.scm     |    5 +++
 2 files changed, 104 insertions(+)
 create mode 100644 gnu/packages/ruby.scm

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
new file mode 100644
index 0000000..a13606c
--- /dev/null
+++ b/gnu/packages/ruby.scm
@@ -0,0 +1,99 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2014 Pjotr Prins <pjotr.guix@thebird.nl>
+;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages ruby)
+  #:use-module ((guix licenses)
+                #:select (rl))
+  #:use-module (gnu packages)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages readline)
+  #:use-module (gnu packages openssl)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages libffi)
+  #:use-module (gnu packages gdbm)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix utils)
+  #:use-module (guix build-system gnu)
+;;;  #:use-module (guix build-system trivial))
+)
+
+(define-public ruby
+  (package
+    (name "ruby")
+    (version "2.1.3")
+    (source
+     (origin
+      (method url-fetch)
+      (uri (string-append "http://cache.ruby-lang.org/pub/ruby/2.1/"
+                          "ruby-" version ".tar.gz"))
+      ;;; (patch-flags '("p76"))
+      (sha256
+       (base32
+        "00bz6jcbxgnllplk4b9lnyc3w8yd3pz5rn11rmca1s8cn6vvw608"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:parallel-tests? #f
+       #:phases
+        (alist-cons-after
+         ;;; minor patch https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/45225/diff/
+         'unpack 'patch-readline  
+         (lambda _
+           (substitute* '( 
+                           "ext/readline/readline.c"
+                        )
+             (("Function ") "rl_hook_func_t ")))
+        (alist-cons-before
+         'configure 'replace-bin-sh
+         (lambda _
+           (substitute* '(
+                          "Makefile.in"
+                          "ext/pty/pty.c"
+                          "io.c"
+                          "lib/mkmf.rb"
+                          "process.c"
+                          "test/rubygems/test_gem_ext_configure_builder.rb"
+                          "test/rdoc/test_rdoc_parser.rb"
+                          "test/ruby/test_rubyoptions.rb"
+                          "test/ruby/test_process.rb"
+                          "test/ruby/test_system.rb"
+                          "tool/rbinstall.rb"
+                          ;;; "tool/config.guess"
+                        )
+             (("/bin/sh") (which "sh"))))
+          %standard-phases))))
+
+    (inputs
+     `(("readline" ,readline)
+       ("autoconf" ,autoconf)
+       ("openssl" ,openssl)
+       ("libffi" ,libffi)
+       ("gdbm" ,gdbm)
+       ("zlib" ,zlib)
+       ))
+
+    (synopsis "Ruby")
+    (home-page "https://www.ruby-lang.org/en/")
+    (synopsis
+     "Ruby programming language")
+    (description
+     "Ruby description")
+    (license rl)))
+
diff --git a/guix/licenses.scm b/guix/licenses.scm
index 23e4458..d9b71d7 100644
--- a/guix/licenses.scm
+++ b/guix/licenses.scm
@@ -255,6 +255,11 @@ which may be a file:// URI pointing the package's tree."
            "http://directory.fsf.org/wiki/License:QPLv1.0"
            "http://www.gnu.org/licenses/license-list.html#QPL"))
 
+(define rl
+  (license "Ruby License"
+           "http://directory.fsf.org/wiki/License:Ruby"
+           "https://www.ruby-lang.org/en/about/license.txt"))
+
 (define vim
   (license "Vim"
            "http://directory.fsf.org/wiki/License:Vim7.2"
-- 
1.7.10.4


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

* Re: [PATCH] New ruby package
  2014-09-27 13:06   ` Pjotr Prins
@ 2014-09-27 13:44     ` David Thompson
  0 siblings, 0 replies; 12+ messages in thread
From: David Thompson @ 2014-09-27 13:44 UTC (permalink / raw)
  To: Pjotr Prins, guix-devel

Pjotr Prins <pjotr.public12@thebird.nl> writes:

> Ok, hopefully this is the right patch after rebase and format-patch.
>

I can confirm that the package builds and runs. :)

> From d0d9843f80aca29e51f82c2da894369f892c9e3c Mon Sep 17 00:00:00 2001
> From: Pjotr Prins <pjotr.public01@thebird.nl>
> Date: Sat, 27 Sep 2014 14:56:44 +0200
> Subject: [PATCH] packages: Add Ruby

Change to "gnu: Add Ruby."

>
> * gnu/packages/ruby.scm (Ruby): Added Ruby package
> * guix/licenses.scm: Added Ruby license information
> ---
>  gnu/packages/ruby.scm |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
>  guix/licenses.scm     |    5 +++
>  2 files changed, 104 insertions(+)
>  create mode 100644 gnu/packages/ruby.scm
>
> diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
> new file mode 100644
> index 0000000..a13606c
> --- /dev/null
> +++ b/gnu/packages/ruby.scm
> @@ -0,0 +1,99 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2014 Pjotr Prins <pjotr.guix@thebird.nl>
> +;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages ruby)
> +  #:use-module ((guix licenses)
> +                #:select (rl))
> +  #:use-module (gnu packages)
> +  #:use-module (gnu packages compression)
> +  #:use-module (gnu packages readline)
> +  #:use-module (gnu packages openssl)
> +  #:use-module (gnu packages autotools)
> +  #:use-module (gnu packages libffi)
> +  #:use-module (gnu packages gdbm)
> +  #:use-module (guix packages)
> +  #:use-module (guix download)
> +  #:use-module (guix utils)
> +  #:use-module (guix build-system gnu)
> +;;;  #:use-module (guix build-system trivial))

Remove commented code.

> +)
> +
> +(define-public ruby
> +  (package
> +    (name "ruby")
> +    (version "2.1.3")
> +    (source
> +     (origin
> +      (method url-fetch)
> +      (uri (string-append "http://cache.ruby-lang.org/pub/ruby/2.1/"
> +                          "ruby-" version ".tar.gz"))
> +      ;;; (patch-flags '("p76"))

Remove commented code.

> +      (sha256
> +       (base32
> +        "00bz6jcbxgnllplk4b9lnyc3w8yd3pz5rn11rmca1s8cn6vvw608"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:test-target "test"
> +       #:parallel-tests? #f
> +       #:phases
> +        (alist-cons-after
> +         ;;; minor patch
> https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/45225/diff/

Nitpick: 2 semicolons, not 3.

> +         'unpack 'patch-readline  
> +         (lambda _
> +           (substitute* '( 
> +                           "ext/readline/readline.c"
> +                        )

Don't put parens on new lines.

  '("ext/readline/readline.c")

> +             (("Function ") "rl_hook_func_t ")))
> +        (alist-cons-before
> +         'configure 'replace-bin-sh
> +         (lambda _
> +           (substitute* '(
> +                          "Makefile.in"
> +                          "ext/pty/pty.c"
> +                          "io.c"
> +                          "lib/mkmf.rb"
> +                          "process.c"
> +                          "test/rubygems/test_gem_ext_configure_builder.rb"
> +                          "test/rdoc/test_rdoc_parser.rb"
> +                          "test/ruby/test_rubyoptions.rb"
> +                          "test/ruby/test_process.rb"
> +                          "test/ruby/test_system.rb"
> +                          "tool/rbinstall.rb"
> +                          ;;; "tool/config.guess"
> +                        )

Same as above, and remove commented code.

> +             (("/bin/sh") (which "sh"))))
> +          %standard-phases))))
> +
> +    (inputs
> +     `(("readline" ,readline)
> +       ("autoconf" ,autoconf)
> +       ("openssl" ,openssl)
> +       ("libffi" ,libffi)
> +       ("gdbm" ,gdbm)
> +       ("zlib" ,zlib)
> +       ))

The parens are lonely. :(
Move them to the previous line.

> +
> +    (synopsis "Ruby")

Duplicated synopsis field.  Surprised this isn't a syntax error.

> +    (home-page "https://www.ruby-lang.org/en/")

Remove the 'en/' part.

> +    (synopsis
> +     "Ruby programming language")
> +    (description
> +     "Ruby description")

Expand the description.

> +    (license rl)))
> +
> diff --git a/guix/licenses.scm b/guix/licenses.scm
> index 23e4458..d9b71d7 100644
> --- a/guix/licenses.scm
> +++ b/guix/licenses.scm
> @@ -255,6 +255,11 @@ which may be a file:// URI pointing the package's tree."
>             "http://directory.fsf.org/wiki/License:QPLv1.0"
>             "http://www.gnu.org/licenses/license-list.html#QPL"))
>  
> +(define rl
> +  (license "Ruby License"
> +           "http://directory.fsf.org/wiki/License:Ruby"
> +           "https://www.ruby-lang.org/en/about/license.txt"))
> +

How about naming this 'ruby' instead?  Then, in the ruby package module,
you can add a prefix to the imported symbols to avoid a name clash.

    #:use-module ((guix licenses) #:prefix license:)

You would then refer to the license variable as 'license:ruby'.

>  (define vim
>    (license "Vim"
>             "http://directory.fsf.org/wiki/License:Vim7.2"
> -- 
> 1.7.10.4
>

Thanks for this!  I was struggling with my own Ruby package.  Now I
don't have to waste anymore time on it.  :)

Now, we need to get gems working and write a gem->guix import script!

-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate

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

* Re: [PATCH] New ruby package
  2014-09-27 12:29 ` [PATCH] New ruby package Pjotr Prins
  2014-09-27 13:06   ` Pjotr Prins
@ 2014-09-28  4:00   ` David Thompson
  1 sibling, 0 replies; 12+ messages in thread
From: David Thompson @ 2014-09-28  4:00 UTC (permalink / raw)
  To: Pjotr Prins, guix-devel

Pjotr Prins <pjotr.public12@thebird.nl> writes:

> Working Ruby package. Next step is to get gems working locally.

I don't have the patches quite ready yet, but I wrote a working Ruby
build system for building gems locally.  I'll share the patches when I
wake up.

-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate

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

* guile ERROR: Unbound variable: sha256
  2014-05-05  8:03 ` Ludovic Courtès
  2014-05-05  8:29   ` Pjotr Prins
  2014-06-04 21:36   ` Ludovic Courtès
@ 2014-10-27  4:58   ` Pjotr Prins
  2014-10-27  9:18     ` Ludovic Courtès
  2 siblings, 1 reply; 12+ messages in thread
From: Pjotr Prins @ 2014-10-27  4:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Hi Ludo,

I suspect this was introduced with bags.  When I use below Guile instruction running
from the CLI I get

$2 = #<package python-3.3.5 gnu/packages/python.scm:49 3976210>
scheme@(guile-user)> (package-derivation s python)
ERROR: In procedure memoize-variable-access!:
ERROR: Unbound variable: sha256

scheme@(guile-user) [1]> ,bt
In guix/packages.scm:
   584:14 17 (cache #<package python-3.3.5 gnu/packages/python.scm:49 3976210> "x86_64-linux" #<proced...>)
    686:6 16 (bag->derivation #<build-daemon 256.14 2ff8f80> #<<bag> name: "python-3.3.5" system: "...> #)
In srfi/srfi-1.scm:
   578:27 15 (map #<procedure 2995000 at guix/packages.scm:688:30 (t-43862)> (("source" #<origi...>) ...))
In guix/packages.scm:
   640:16 14 (expand-input #<build-daemon 256.14 2ff8f80> #<package python-3.3.5 gnu/packages/pytho...> ...)
   473:19 13 (package-source-derivation #<build-daemon 256.14 2ff8f80> #<origin "https://www.python...> #)
In guix/download.scm:
    206:4 12 (url-fetch #<build-daemon 256.14 2ff8f80> "https://www.python.org/ftp/python/3.3.5/Pyt..." ...)
In guix/packages.scm:
   584:14 11 (cache #<package guile-2.0.11 gnu/packages/commencement.scm:633 39c1210> "x86_64-linux" #)
    686:6 10 (bag->derivation #<build-daemon 256.14 2ff8f80> #<<bag> name: "guile-2.0.11" system: "...> #)
In srfi/srfi-1.scm:
   578:27  9 (map #<procedure 2998ed0 at guix/packages.scm:688:30 (t-43862)> (("source" #<origi...>) ...))
In guix/packages.scm:
   640:16  8 (expand-input #<build-daemon 256.14 2ff8f80> #<package guile-2.0.11 gnu/packages/comme...> ...)
In guix/download.scm:
    206:4  7 (url-fetch #<build-daemon 256.14 2ff8f80> "mirror://gnu/guile/guile-2.0.11.tar.xz" sha256 ...)
In guix/packages.scm:
   584:14  6 (cache #<package guile-bootstrap-2.0 gnu/packages/bootstrap.scm:220 2c2f6e0> "x86_64-l..." #)
In ice-9/eval.scm:
   411:25  5 (eval #<memoized (let ((_ (<7> <0>))) (let ((_ (add-text-to-store <22> (string-append ...> #)
   411:25  4 (eval #<memoized (let ((_ (#<variable 28c6ae0 value: #<procedure derivation-hash args>...> #)
In guix/utils.scm:
   426:27  3 (derivation-hash #<derivation #f =>  2af8dc0>)
In ice-9/eval.scm:
    386:9  2 (eval #<memoized (sha256 (string->utf8 (derivation->string <0>)))> (#<derivation #f ...> . #))
   393:14  1 (eval #<memoized sha256> (#<derivation #f =>  2af8d70> () (("out" . "")) (("out" . "")) . #))
In unknown file:
           0 (memoize-variable-access! #<memoized sha256> #<directory (guix derivations) 27dc480>)

On Mon, May 05, 2014 at 10:03:30AM +0200, Ludovic Courtès wrote:
> It may be helpful to have a ???ruby-build-system???, akin to
> ???python-build-system??? but with the right incantations (info "(guix)
> Build Systems").
> 
> > Do we have a HOWTO on how to run expressions in the Guile debugger?
> > Never used that and would like to see how individual statements
> > evaluate in LISP.
> 
> Basically there are two approaches.  From the command line, like this:
> 
> --8<---------------cut here---------------start------------->8---
> $ ./pre-inst-env guile
> GNU Guile 2.0.11.20-4338f
> Copyright (C) 1995-2014 Free Software Foundation, Inc.
> 
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
> 
> Enter `,help' for help.
> scheme@(guile-user)> ,use (gnu packages python)
> scheme@(guile-user)> ,use (guix)
> scheme@(guile-user)> (define s (open-connection))
> scheme@(guile-user)> python
> $1 = #<package python-3.3.5 gnu/packages/python.scm:46 2946840>
> scheme@(guile-user)> (package-derivation s python)
> $2 = #<derivation /gnu/store/k0lvsy8jwcw0amv1rsmii2cvwfnmn2gz-python-3.3.5.drv => /gnu/store/ij8xgynicdmnzb7pzmyb6bqi17s0ll3y-python-3.3.5 3f4fdc0>
> scheme@(guile-user)> (build-derivations s (list $2))
> $3 = #t
> --8<---------------cut here---------------end--------------->8---
> 
> But the best thing, if you use Emacs, is to use Geiser, as noted in
> ???HACKING???.  In addition to a REPL, it brings stuff like autodoc,
> jump-to-definition, expression evaluation from the buffer, etc.
> 
> > I am really impressed with GUIX, and I think it is a no-brainer to use
> > a real functional programming language for this. Thanks Ludo and
> > others!  I just wish I could use GUIX on servers where I don't have (and
> > won't get) root access. Or is there a way? With Nix I could run as a
> > normal user.
> 
> It???s the same as Nix, which means that if the daemon cannot run as root,
> then it???s usable in a ???degraded??? mode (info "(guix) Build Environment
> Setup").
> 
> HTH,
> Ludo???.
> 

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

* Re: guile ERROR: Unbound variable: sha256
  2014-10-27  4:58   ` guile ERROR: Unbound variable: sha256 Pjotr Prins
@ 2014-10-27  9:18     ` Ludovic Courtès
  0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2014-10-27  9:18 UTC (permalink / raw)
  To: Pjotr Prins; +Cc: guix-devel

Hi Pjotr,

Pjotr Prins <pjotr.public12@thebird.nl> skribis:

> I suspect this was introduced with bags.  When I use below Guile instruction running
> from the CLI I get
>
> $2 = #<package python-3.3.5 gnu/packages/python.scm:49 3976210>
> scheme@(guile-user)> (package-derivation s python)
> ERROR: In procedure memoize-variable-access!:
> ERROR: Unbound variable: sha256

[...]

> In guix/utils.scm:
>    426:27  3 (derivation-hash #<derivation #f =>  2af8dc0>)
> In ice-9/eval.scm:
>     386:9  2 (eval #<memoized (sha256 (string->utf8 (derivation->string <0>)))> (#<derivation #f ...> . #))
>    393:14  1 (eval #<memoized sha256> (#<derivation #f =>  2af8d70> () (("out" . "")) (("out" . "")) . #))
> In unknown file:
>            0 (memoize-variable-access! #<memoized sha256> #<directory (guix derivations) 27dc480>)

I can’t reproduce it.  Could it be that guix/derivations.scm was
modified in your local tree, such that it misses the
#:use-module (guix hash) line?  Is there a warning when compiling
guix/derivations.go?

Thanks,
Ludo’.

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

end of thread, other threads:[~2014-10-27  9:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-04 17:51 Ruby install Pjotr Prins
2014-05-05  8:03 ` Ludovic Courtès
2014-05-05  8:29   ` Pjotr Prins
2014-05-05 11:42     ` Ludovic Courtès
2014-06-04 21:36   ` Ludovic Courtès
2014-06-05  9:57     ` Pjotr Prins
2014-10-27  4:58   ` guile ERROR: Unbound variable: sha256 Pjotr Prins
2014-10-27  9:18     ` Ludovic Courtès
2014-09-27 12:29 ` [PATCH] New ruby package Pjotr Prins
2014-09-27 13:06   ` Pjotr Prins
2014-09-27 13:44     ` David Thompson
2014-09-28  4:00   ` David Thompson

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).