Ruby's native search path for $GEM_PATH looks like
"/lib/ruby/gems/2.2.0", where the version number at the end is formed by
the major + minor version of our Ruby package followed a ".0", ignoring
the patch version.  However, the Ruby build system was installing gems
into places like "/lib/ruby/gems/2.2.1", using the patch version from
the Ruby used when building.  Because of this, the search path suggested
by 'guix package --search-paths' was useless.  This patch fixes that.

>From c616752342336a1018366d1293621e5a29f72587 Mon Sep 17 00:00:00 2001
From: David Thompson <dthomps...@worcester.edu>
Date: Sat, 7 Mar 2015 18:36:13 -0500
Subject: [PATCH] build: ruby: Set $GEM_HOME that matches Ruby's $GEM_PATH.

* guix/build/ruby-build-system.scm (install): Ignore the Ruby patch version
  when creating $GEM_HOME.
---
 guix/build/ruby-build-system.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm
index 1310c4a..a143df4 100644
--- a/guix/build/ruby-build-system.scm
+++ b/guix/build/ruby-build-system.scm
@@ -58,11 +58,11 @@ directory."
 
 (define* (install #:key source inputs outputs #:allow-other-keys)
   (let* ((ruby-version
-          (match:substring (string-match "ruby-(.*)$"
+          (match:substring (string-match "ruby-(.*)\\.[0-9]$"
                                          (assoc-ref inputs "ruby"))
                            1))
          (out (assoc-ref outputs "out"))
-         (gem-home (string-append out "/lib/ruby/gems/" ruby-version)))
+         (gem-home (string-append out "/lib/ruby/gems/" ruby-version ".0")))
     (setenv "GEM_HOME" gem-home)
     (mkdir-p gem-home)
     (zero? (system* "gem" "install" "--local"
-- 
2.1.4

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

Reply via email to