From 3cb3fa6747251c6beac226d0233063524bd5f4d6 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 17 Dec 2017 08:25:44 +0000 Subject: guix: build: ruby-build-system: Install to the vendor directory * guix/build/ruby-build-system.scm (install): Install gems to the vendor directory, rather than the GEM_HOME. The vendor directory does not include the version of ruby used to install the gem in the path, which makes it easier to add it to the GEM_PATH for all versions of ruby to use. (gem-home): Remove procedure. * gnu/packages/ruby.scm (ruby, ruby-2.1)[native-search-paths]: Switch to lib/ruby/vendor_ruby. (ruby-1.8)[native-search-paths]: Remove native-search-paths. (gem-directory): Remove procedure. (ruby-ansi, ruby-ae)[arguments]: Remove use of gem-directory. (ruby-metaclass, ruby-instantiator, ruby-introspection, ruby-mocha, ruby-nokogiri, ruby-minitest-tu-shim, ruby-redcloth)[arguments]: Remove use of gem-home. (ruby-git, ruby-httpclient)[arguments]: Remove use of GEM_HOME. * gnu/packages/databases.scm (es-dump-restore)[arguments]: Remove use of GEM_HOME. --- gnu/packages/databases.scm | 8 ++--- gnu/packages/ruby.scm | 78 +++++++++++++++++----------------------------- 2 files changed, 32 insertions(+), 54 deletions(-) (limited to 'gnu/packages') diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm index 86beb762bb..d7bcce44e7 100644 --- a/gnu/packages/databases.scm +++ b/gnu/packages/databases.scm @@ -298,10 +298,10 @@ SQL, Key/Value, XML/XQuery or Java Object storage for their data model.") (lambda* (#:key outputs #:allow-other-keys) (wrap-program (string-append (assoc-ref outputs "out") "/bin/es_dump_restore") - `("GEM_PATH" ":" prefix (,(string-append - (getenv "GEM_PATH") - ":" - (getenv "GEM_HOME"))))) + `("GEM_PATH" ":" prefix (,(getenv "GEM_PATH") + ,(string-append + (assoc-ref outputs "out") + "/lib/ruby/vendor_ruby")))) #t))))) (propagated-inputs `(("ruby-httpclient" ,ruby-httpclient) diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm index 2741bd6b7d..ab3c077036 100644 --- a/gnu/packages/ruby.scm +++ b/gnu/packages/ruby.scm @@ -96,9 +96,7 @@ (native-search-paths (list (search-path-specification (variable "GEM_PATH") - (files (list (string-append "lib/ruby/gems/" - (version-major+minor version) - ".0")))))) + (files (list (string-append "lib/ruby/vendor_ruby")))))) (synopsis "Programming language interpreter") (description "Ruby is a dynamic object-oriented programming language with a focus on simplicity and productivity.") @@ -182,13 +180,7 @@ a focus on simplicity and productivity.") "lib/mkmf.rb" "process.c") (("/bin/sh") (which "sh"))) - #t))))) - (native-search-paths - (list (search-path-specification - (variable "GEM_PATH") - (files (list (string-append "lib/ruby/gems/" - (version-major+minor version) - ".0")))))))) + #t))))))) (define-public ruby-1.8 (package (inherit ruby) @@ -218,11 +210,6 @@ a focus on simplicity and productivity.") (("/bin/sh") (which "sh"))) #t))))))) -(define (gem-directory ruby-version) - "Return the relative gem install directory for RUBY-VERSION." - (string-append "/lib/ruby/gems/" (version-major+minor ruby-version) - ".0/gems")) - (define-public ruby-highline (package (name "ruby-highline") @@ -1322,13 +1309,11 @@ It allows writing tests, checking results and automated testing in Ruby.") (modify-phases %standard-phases (add-after 'unpack 'add-test-unit-to-search-path (lambda* (#:key inputs #:allow-other-keys) - (let* ((test-unit (assoc-ref inputs "ruby-test-unit")) - (test-unit-home (gem-home test-unit - ,(package-version ruby)))) + (let* ((test-unit (assoc-ref inputs "ruby-test-unit"))) (substitute* "Rakefile" (("t\\.libs << \"test\"" line) (string-append line "; t.libs << \"" - test-unit-home + test-unit "/lib/ruby/vendor_ruby" "/gems/test-unit-" ,(package-version ruby-test-unit) "/lib\"")))) @@ -1387,13 +1372,11 @@ as a base class when writing classes that depend upon (modify-phases %standard-phases (add-after 'unpack 'add-test-unit-to-search-path (lambda* (#:key inputs #:allow-other-keys) - (let* ((test-unit (assoc-ref inputs "ruby-test-unit")) - (test-unit-home (gem-home test-unit ,(package-version - ruby)))) + (let* ((test-unit (assoc-ref inputs "ruby-test-unit"))) (substitute* "Rakefile" (("t\\.libs << \"test\"" line) (string-append line "; t.libs << \"" - test-unit-home + test-unit "/lib/ruby/vendor_ruby" "/gems/test-unit-" ,(package-version ruby-test-unit) "/lib\"")))) @@ -1426,13 +1409,11 @@ knowing anything about the constructor.") (modify-phases %standard-phases (add-after 'unpack 'add-test-unit-to-search-path (lambda* (#:key inputs #:allow-other-keys) - (let* ((test-unit (assoc-ref inputs "ruby-test-unit")) - (test-unit-home (gem-home test-unit ,(package-version - ruby)))) + (let* ((test-unit (assoc-ref inputs "ruby-test-unit"))) (substitute* "Rakefile" (("t\\.libs << \"test\"" line) (string-append line "; t.libs << \"" - test-unit-home + test-unit "/lib/ruby/vendor_ruby" "/gems/test-unit-" ,(package-version ruby-test-unit) "/lib\"")))) @@ -1499,13 +1480,11 @@ conversion to (X)HTML.") (modify-phases %standard-phases (add-after 'unpack 'add-test-unit-to-search-path (lambda* (#:key inputs #:allow-other-keys) - (let* ((test-unit (assoc-ref inputs "ruby-test-unit")) - (test-unit-home (gem-home test-unit - ,(package-version ruby)))) + (let* ((test-unit (assoc-ref inputs "ruby-test-unit"))) (substitute* "Rakefile" (("t\\.libs << 'test'" line) (string-append line "; t.libs << \"" - test-unit-home + test-unit "/lib/ruby/vendor_ruby" "/gems/test-unit-" ,(package-version ruby-test-unit) "/lib\"")))) @@ -1870,9 +1849,10 @@ run as a daemon and to be controlled by simple start/stop/restart commands.") ;; store. (let ((git (string-append (assoc-ref inputs "git") "/bin/git")) - (config (string-append (getenv "GEM_HOME") - "/gems/git-" ,version - "/lib/git/config.rb"))) + (config (string-append + (assoc-ref outputs "out") + "/lib/ruby/vendor_ruby/gems/git-" + ,version "/lib/git/config.rb"))) (substitute* (list config) (("'git'") (string-append "'" git "'"))) @@ -2057,13 +2037,11 @@ to reproduce user environments.") ;; 'pkg-config' is not included in the GEM_PATH during ;; installation, so we add it directly to the load path. (lambda* (#:key inputs #:allow-other-keys) - (let* ((pkg-config (assoc-ref inputs "ruby-pkg-config")) - (pkg-config-home (gem-home pkg-config - ,(package-version ruby)))) + (let* ((pkg-config (assoc-ref inputs "ruby-pkg-config"))) (substitute* "ext/nokogiri/extconf.rb" (("gem 'pkg-config'.*") (string-append "$:.unshift '" - pkg-config-home + pkg-config "/lib/ruby/vendor_ruby" "/gems/pkg-config-" ,(package-version ruby-pkg-config) "/lib'\n")))) @@ -2470,13 +2448,11 @@ development of Ruby gems.") (modify-phases %standard-phases (add-after 'unpack 'fix-test-include-path (lambda* (#:key inputs #:allow-other-keys) - (let* ((minitest (assoc-ref inputs "ruby-minitest-4")) - (minitest-home (gem-home minitest - ,(package-version ruby)))) + (let* ((minitest (assoc-ref inputs "ruby-minitest-4"))) (substitute* "Rakefile" (("Hoe\\.add_include_dirs .*") (string-append "Hoe.add_include_dirs \"" - minitest-home + minitest "/lib/ruby/vendor_ruby" "/gems/minitest-" ,(package-version ruby-minitest-4) "/lib" "\"")))) @@ -2883,7 +2859,9 @@ alternative to Marshal for Object serialization. ") (lambda* (#:key outputs #:allow-other-keys) (wrap-program (string-append (assoc-ref outputs "out") "/bin/redcloth") - `("GEM_HOME" ":" prefix (,(getenv "GEM_HOME")))) + `("GEM_PATH" ":" prefix (,(string-append + (assoc-ref outputs "out") + "/lib/ruby/vendor_ruby")))) #t))))) (native-inputs `(("bundler" ,bundler) @@ -3737,7 +3715,7 @@ It has built-in support for the legacy @code{cookies.txt} and (lambda* (#:key outputs #:allow-other-keys) (wrap-program (string-append (assoc-ref outputs "out") "/bin/httpclient") - `("GEM_HOME" ":" prefix (,(getenv "GEM_HOME")))) + `("GEM_PATH" ":" prefix (,(getenv "GEM_PATH")))) #t))))) (native-inputs `(("ruby-rack" ,ruby-rack))) @@ -3780,9 +3758,9 @@ requests either using arguments or with an interactive prompt.") (add-before 'validate-runpath 'replace-broken-symlink (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) - (file (string-append out - ,(gem-directory (package-version ruby)) - "/ansi-" ,version "/lib/ansi.yml"))) + (file (string-append + out "/lib/ruby/vendor_ruby/gems/ansi-" + ,version "/lib/ansi.yml"))) ;; XXX: This symlink is broken since ruby 2.4. ;; https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00034.html (delete-file file) @@ -3980,9 +3958,9 @@ requirement specifications systems like Cucumber.") (add-before 'validate-runpath 'replace-broken-symlink (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) - (file (string-append out - ,(gem-directory (package-version ruby)) - "/ae-" ,version "/lib/ae.yml"))) + (file (string-append + out "/lib/ruby/vendor_ruby/gems/ae-" + ,version "/lib/ae.yml"))) ;; XXX: This symlink is broken since ruby 2.4. ;; https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00034.html (delete-file file) -- cgit v1.2.3