From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Thompson Subject: [PATCH] build: ruby: Add gitify phase. Date: Tue, 24 Feb 2015 22:20:27 -0500 Message-ID: <8761aqad8k.fsf@fsf.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQSWU-0005X8-SB for guix-devel@gnu.org; Tue, 24 Feb 2015 22:20:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQSWT-0003Gd-Gp for guix-devel@gnu.org; Tue, 24 Feb 2015 22:20:30 -0500 Received: from mail.fsf.org ([208.118.235.13]:59124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQSWS-0003GV-Pj for guix-devel@gnu.org; Tue, 24 Feb 2015 22:20:29 -0500 Received: from 209-6-40-86.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.40.86]:43863 helo=izanagi) by mail.fsf.org with esmtpsa (TLS-1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1YQSWS-0007uB-8z for guix-devel@gnu.org; Tue, 24 Feb 2015 22:20:28 -0500 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-build-ruby-Add-gitify-phase.patch >From 7828651066c6a6eb338ca5343456228f0edbeafa Mon Sep 17 00:00:00 2001 From: David Thompson 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 --=-=-= Content-Type: text/plain -- David Thompson Web Developer - Free Software Foundation - http://fsf.org GPG Key: 0FF1D807 Support the FSF: https://fsf.org/donate --=-=-=--