unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCHES]  Add ruby-pg and adjust Ruby build system
@ 2015-08-30  2:07 David Thompson
  2015-09-06 21:34 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: David Thompson @ 2015-08-30  2:07 UTC (permalink / raw)
  To: guix-devel

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

Unlike a lot of other gems, I was pleasantly surprised that I could
actually run ruby-pg's test suite successfully.  However, I had to tweak
the build system to use shorter file names for the build directory
because the test suite was trying to create a UNIX-domain socket longer
than the maximum of 107.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-build-ruby-Avoid-long-build-directory-names.patch --]
[-- Type: text/x-patch, Size: 2008 bytes --]

From 8f29026d37a66d8bcbddc6f32a6354d93d40f50d Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Sat, 29 Aug 2015 21:55:12 -0400
Subject: [PATCH 1/2] build: ruby: Avoid long build directory names.

Having the hash of the source gem in the source directory file name proved to
be problematic when running the test suite for the 'pg' gem that creates
UNIX-domain sockets in the source directory and exceeded the 108 character
limit on GNU/Linux systems.

* guix/build/ruby-build-system.scm (unpack): Rename unpacked gem directory to
  "gem".
---
 guix/build/ruby-build-system.scm | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm
index 90fab92..4184ccc 100644
--- a/guix/build/ruby-build-system.scm
+++ b/guix/build/ruby-build-system.scm
@@ -44,12 +44,16 @@ directory."
 (define* (unpack #:key source #:allow-other-keys)
   "Unpack the gem SOURCE and enter the resulting directory."
   (and (zero? (system* "gem" "unpack" source))
-       (begin
-         ;; The unpacked gem directory is named the same as the archive, sans
-         ;; the ".gem" extension.
-         (chdir (match:substring (string-match "^(.*)\\.gem$"
-                                               (basename source))
-                                 1))
+       ;; The unpacked gem directory is named the same as the archive, sans
+       ;; the ".gem" extension.  It is renamed to simply "gem" in an effort to
+       ;; keep file names shorter to avoid UNIX-domain socket file names and
+       ;; shebangs that exceed the system's fixed maximum length when running
+       ;; test suites.
+       (let ((dir (match:substring (string-match "^(.*)\\.gem$"
+                                                 (basename source))
+                                   1)))
+         (rename-file dir "gem")
+         (chdir "gem")
          #t)))
 
 (define* (build #:key source #:allow-other-keys)
-- 
2.5.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-Add-ruby-pg.patch --]
[-- Type: text/x-patch, Size: 1767 bytes --]

From efced81a77bc4a5a72a430987ab8168196358d47 Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Sat, 29 Aug 2015 22:03:51 -0400
Subject: [PATCH 2/2] gnu: Add ruby-pg.

* gnu/packages/ruby.scm (ruby-pg): New variable.
---
 gnu/packages/ruby.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 33da738..29aaffc 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -23,6 +23,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages databases)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages libffi)
@@ -707,3 +708,29 @@ messing up your system.")
 both CSS3 selector and XPath 1.0 support.")
     (home-page "http://www.nokogiri.org/")
     (license license:expat)))
+
+(define-public ruby-pg
+  (package
+    (name "ruby-pg")
+    (version "0.18.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (rubygems-uri "pg" version))
+       (sha256
+        (base32
+         "1axxbf6ij1iqi3i1r3asvjc80b0py5bz0m2wy5kdi5xkrpr82kpf"))))
+    (build-system ruby-build-system)
+    (arguments
+     '(#:test-target "spec"))
+    (native-inputs
+     `(("ruby-rake-compiler" ,ruby-rake-compiler)
+       ("ruby-hoe" ,ruby-hoe)
+       ("ruby-rspec" ,ruby-rspec)))
+    (inputs
+     `(("postgresql" ,postgresql)))
+    (synopsis "Ruby interface to PostgreSQL")
+    (description "Pg is the Ruby interface to the PostgreSQL RDBMS.  It works
+with PostgreSQL 8.4 and later.")
+    (home-page "https://bitbucket.org/ged/ruby-pg")
+    (license license:ruby)))
-- 
2.5.0


[-- Attachment #4: Type: text/plain, Size: 38 bytes --]


-- 
David Thompson
GPG Key: 0FF1D807

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

* Re: [PATCHES]  Add ruby-pg and adjust Ruby build system
  2015-08-30  2:07 [PATCHES] Add ruby-pg and adjust Ruby build system David Thompson
@ 2015-09-06 21:34 ` Ludovic Courtès
  2015-09-07 13:44   ` Thompson, David
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2015-09-06 21:34 UTC (permalink / raw)
  To: David Thompson; +Cc: guix-devel

David Thompson <dthompson2@worcester.edu> skribis:

> From 8f29026d37a66d8bcbddc6f32a6354d93d40f50d Mon Sep 17 00:00:00 2001
> From: David Thompson <dthompson2@worcester.edu>
> Date: Sat, 29 Aug 2015 21:55:12 -0400
> Subject: [PATCH 1/2] build: ruby: Avoid long build directory names.
>
> Having the hash of the source gem in the source directory file name proved to
> be problematic when running the test suite for the 'pg' gem that creates
> UNIX-domain sockets in the source directory and exceeded the 108 character
> limit on GNU/Linux systems.
>
> * guix/build/ruby-build-system.scm (unpack): Rename unpacked gem directory to
>   "gem".

Heh, LGTM.

> From efced81a77bc4a5a72a430987ab8168196358d47 Mon Sep 17 00:00:00 2001
> From: David Thompson <dthompson2@worcester.edu>
> Date: Sat, 29 Aug 2015 22:03:51 -0400
> Subject: [PATCH 2/2] gnu: Add ruby-pg.
>
> * gnu/packages/ruby.scm (ruby-pg): New variable.

OK.

Thanks!

Ludo'.

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

* Re: [PATCHES] Add ruby-pg and adjust Ruby build system
  2015-09-06 21:34 ` Ludovic Courtès
@ 2015-09-07 13:44   ` Thompson, David
  0 siblings, 0 replies; 3+ messages in thread
From: Thompson, David @ 2015-09-07 13:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Sun, Sep 6, 2015 at 5:34 PM, Ludovic Courtès <ludo@gnu.org> wrote:
> David Thompson <dthompson2@worcester.edu> skribis:
>
>> From 8f29026d37a66d8bcbddc6f32a6354d93d40f50d Mon Sep 17 00:00:00 2001
>> From: David Thompson <dthompson2@worcester.edu>
>> Date: Sat, 29 Aug 2015 21:55:12 -0400
>> Subject: [PATCH 1/2] build: ruby: Avoid long build directory names.
>>
>> Having the hash of the source gem in the source directory file name proved to
>> be problematic when running the test suite for the 'pg' gem that creates
>> UNIX-domain sockets in the source directory and exceeded the 108 character
>> limit on GNU/Linux systems.
>>
>> * guix/build/ruby-build-system.scm (unpack): Rename unpacked gem directory to
>>   "gem".
>
> Heh, LGTM.
>
>> From efced81a77bc4a5a72a430987ab8168196358d47 Mon Sep 17 00:00:00 2001
>> From: David Thompson <dthompson2@worcester.edu>
>> Date: Sat, 29 Aug 2015 22:03:51 -0400
>> Subject: [PATCH 2/2] gnu: Add ruby-pg.
>>
>> * gnu/packages/ruby.scm (ruby-pg): New variable.
>
> OK.

Pushed, thanks!

- Dave

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

end of thread, other threads:[~2015-09-07 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-30  2:07 [PATCHES] Add ruby-pg and adjust Ruby build system David Thompson
2015-09-06 21:34 ` Ludovic Courtès
2015-09-07 13:44   ` Thompson, David

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