From 7e7c6a1ac06a8e04acbdc9bbfe9ccc039d188977 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 23 Feb 2015 18:18:59 -0500 Subject: 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/ruby-build-system.scm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'guix/build/ruby-build-system.scm') diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm index 2b3ba7c8cd..933788cf90 100644 --- a/guix/build/ruby-build-system.scm +++ b/guix/build/ruby-build-system.scm @@ -39,6 +39,14 @@ (define (first-matching-file pattern) ((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 @@ (define* (install #:key source inputs outputs #:allow-other-keys) (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) -- cgit v1.2.3