gnu: ruby-build-system: Change extract-gemspec to always return #t.

* guix/build/ruby-build-system.scm (extract-gemspec): Return #t right at the
end, rather than returning #<unspecified> when not handling a gem archive.
This commit is contained in:
Christopher Baines 2019-02-08 10:20:53 +00:00
parent b5c2e72051
commit ab149c6ba0
No known key found for this signature in database
GPG Key ID: 5E28A33B0B84F577
1 changed files with 21 additions and 20 deletions

View File

@ -86,28 +86,29 @@ operation is not deterministic, we replace it with `find`."
"Remove the original gemspec, if present, and replace it with a new one. "Remove the original gemspec, if present, and replace it with a new one.
This avoids issues with upstream gemspecs requiring tools such as git to This avoids issues with upstream gemspecs requiring tools such as git to
generate the files list." generate the files list."
(when (gem-archive? source) (if (gem-archive? source)
(let ((gemspec (or (false-if-exception (first-gemspec)) (let ((gemspec (or (false-if-exception (first-gemspec))
;; Make new gemspec if one wasn't shipped. ;; Make new gemspec if one wasn't shipped.
".gemspec"))) ".gemspec")))
(when (file-exists? gemspec) (delete-file gemspec)) (when (file-exists? gemspec) (delete-file gemspec))
;; Extract gemspec from source gem. ;; Extract gemspec from source gem.
(let ((pipe (open-pipe* OPEN_READ "gem" "spec" "--ruby" source))) (let ((pipe (open-pipe* OPEN_READ "gem" "spec" "--ruby" source)))
(dynamic-wind (dynamic-wind
(const #t) (const #t)
(lambda () (lambda ()
(call-with-output-file gemspec (call-with-output-file gemspec
(lambda (out) (lambda (out)
;; 'gem spec' writes to stdout, but 'gem build' only reads ;; 'gem spec' writes to stdout, but 'gem build' only reads
;; gemspecs from a file, so we redirect the output to a file. ;; gemspecs from a file, so we redirect the output to a file.
(while (not (eof-object? (peek-char pipe))) (while (not (eof-object? (peek-char pipe)))
(write-char (read-char pipe) out)))) (write-char (read-char pipe) out))))
#t) #t)
(lambda () (lambda ()
(close-pipe pipe))))) (close-pipe pipe)))))
#t)) (display "extract-gemspec: skipping as source is not a gem archive\n"))
#t)
(define* (build #:key source #:allow-other-keys) (define* (build #:key source #:allow-other-keys)
"Build a new gem using the gemspec from the SOURCE gem." "Build a new gem using the gemspec from the SOURCE gem."