unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] build: ruby: Add gitify phase.
@ 2015-02-25  3:20 David Thompson
  2015-02-28 20:48 ` David Thompson
  0 siblings, 1 reply; 3+ messages in thread
From: David Thompson @ 2015-02-25  3:20 UTC (permalink / raw)
  To: guix-devel

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

This patch solves a blocking issue for packaging a very large number of
Ruby gems, which is that the build process assumes you are working out
of a git repository.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-build-ruby-Add-gitify-phase.patch --]
[-- Type: text/x-diff, Size: 3743 bytes --]

From 7828651066c6a6eb338ca5343456228f0edbeafa Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Mon, 23 Feb 2015 18:18:59 -0500
Subject: [PATCH] build: ruby: Add gitify phase.

* guix/build-system/ruby.scm (lower): Add git as implicit input.
* guix/build/ruby-build-system.scm (gitify): New procedure.
  (%standard-phases): Add gitify phase.
---
 guix/build-system/ruby.scm       | 32 +++++++++++++++++---------------
 guix/build/ruby-build-system.scm | 21 ++++++++++++++++-----
 2 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/guix/build-system/ruby.scm b/guix/build-system/ruby.scm
index d2dd6a4..08301ec 100644
--- a/guix/build-system/ruby.scm
+++ b/guix/build-system/ruby.scm
@@ -43,22 +43,24 @@
   (define private-keywords
     '(#:source #:target #:ruby #:inputs #:native-inputs))
 
-  (and (not target)                               ;XXX: no cross-compilation
-       (bag
-         (name name)
-         (system system)
-         (host-inputs `(,@(if source
-                              `(("source" ,source))
-                              '())
-                        ,@inputs
+  (let ((version-control (resolve-interface '(gnu packages version-control))))
+    (and (not target)                    ;XXX: no cross-compilation
+         (bag
+           (name name)
+           (system system)
+           (host-inputs `(,@(if source
+                                `(("source" ,source))
+                                '())
+                          ,@inputs
 
-                        ;; Keep the standard inputs of 'gnu-build-system'.
-                        ,@(standard-packages)))
-         (build-inputs `(("ruby" ,ruby)
-                         ,@native-inputs))
-         (outputs outputs)
-         (build ruby-build)
-         (arguments (strip-keyword-arguments private-keywords arguments)))))
+                          ;; Keep the standard inputs of 'gnu-build-system'.
+                          ,@(standard-packages)))
+           (build-inputs `(("ruby" ,ruby)
+                           ("git" ,(module-ref version-control 'git))
+                           ,@native-inputs))
+           (outputs outputs)
+           (build ruby-build)
+           (arguments (strip-keyword-arguments private-keywords arguments))))))
 
 (define* (ruby-build store name inputs
                      #:key
diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm
index 2b3ba7c..933788c 100644
--- a/guix/build/ruby-build-system.scm
+++ b/guix/build/ruby-build-system.scm
@@ -39,6 +39,14 @@ directory."
     ((file-name . _) file-name)
     (() (error "No files matching pattern: " pattern))))
 
+;; Most gemspecs assume that builds are taking place within a git repository
+;; by include calls to 'git ls-files'.  In order for these gemspecs to work
+;; as-is, every file in the source tree is added to the staging area.
+(define gitify
+  (lambda _
+    (and (zero? (system* "git" "init"))
+         (zero? (system* "git" "add" ".")))))
+
 (define build
   (lambda _
     (zero? (system* "gem" "build" (first-matching-file "\\.gemspec$")))))
@@ -62,13 +70,16 @@ directory."
                     (first-matching-file "\\.gem$")))))
 
 (define %standard-phases
-  (alist-replace
-   'build build
+  (alist-cons-after
+   'unpack 'gitify gitify
    (alist-replace
-    'install install
+    'build build
     (alist-replace
-     'check check
-     (alist-delete 'configure gnu:%standard-phases)))))
+     'install install
+     (alist-replace
+      'check check
+      (alist-delete
+       'configure gnu:%standard-phases))))))
 
 (define* (ruby-build #:key inputs (phases %standard-phases)
                      #:allow-other-keys #:rest args)
-- 
2.1.4


[-- Attachment #3: Type: text/plain, Size: 136 bytes --]


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

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

* Re: [PATCH] build: ruby: Add gitify phase.
  2015-02-25  3:20 [PATCH] build: ruby: Add gitify phase David Thompson
@ 2015-02-28 20:48 ` David Thompson
  2015-03-02  9:29   ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: David Thompson @ 2015-02-28 20:48 UTC (permalink / raw)
  To: guix-devel

David Thompson <dthompson2@worcester.edu> writes:

> This patch solves a blocking issue for packaging a very large number of
> Ruby gems, which is that the build process assumes you are working out
> of a git repository.

Bump.  I'm going to push this with the other Ruby related patches I've
made recently if there are no objections.

-- 
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] 3+ messages in thread

* Re: [PATCH] build: ruby: Add gitify phase.
  2015-02-28 20:48 ` David Thompson
@ 2015-03-02  9:29   ` Ludovic Courtès
  0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2015-03-02  9:29 UTC (permalink / raw)
  To: David Thompson; +Cc: guix-devel

David Thompson <dthompson2@worcester.edu> skribis:

> David Thompson <dthompson2@worcester.edu> writes:
>
>> This patch solves a blocking issue for packaging a very large number of
>> Ruby gems, which is that the build process assumes you are working out
>> of a git repository.
>
> Bump.  I'm going to push this with the other Ruby related patches I've
> made recently if there are no objections.

Sure, LGTM.

Ludo’.

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

end of thread, other threads:[~2015-03-02  9:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-25  3:20 [PATCH] build: ruby: Add gitify phase David Thompson
2015-02-28 20:48 ` David Thompson
2015-03-02  9:29   ` Ludovic Courtès

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