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.
This commit is contained in:
David Thompson 2015-02-23 18:18:59 -05:00
parent 927ff2c379
commit 7e7c6a1ac0
2 changed files with 33 additions and 20 deletions

View File

@ -43,6 +43,7 @@
(define private-keywords
'(#:source #:target #:ruby #:inputs #:native-inputs))
(let ((version-control (resolve-interface '(gnu packages version-control))))
(and (not target) ;XXX: no cross-compilation
(bag
(name name)
@ -55,10 +56,11 @@
;; 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)))))
(arguments (strip-keyword-arguments private-keywords arguments))))))
(define* (ruby-build store name inputs
#:key

View File

@ -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-cons-after
'unpack 'gitify gitify
(alist-replace
'build build
(alist-replace
'install install
(alist-replace
'check check
(alist-delete 'configure gnu:%standard-phases)))))
(alist-delete
'configure gnu:%standard-phases))))))
(define* (ruby-build #:key inputs (phases %standard-phases)
#:allow-other-keys #:rest args)