guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] New ruby package


From: David Thompson
Subject: Re: [PATCH] New ruby package
Date: Sat, 27 Sep 2014 09:44:10 -0400
User-agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu)

Pjotr Prins <address@hidden> 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 <address@hidden>
> 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 <address@hidden>
> +;;; Copyright © 2014 Ludovic Courtès <address@hidden>
> +;;;
> +;;; 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]