guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: gnu: ruby-build-system: Change extract-gemspec to always return #


From: guix-commits
Subject: 01/03: gnu: ruby-build-system: Change extract-gemspec to always return #t.
Date: Thu, 14 Feb 2019 14:30:26 -0500 (EST)

cbaines pushed a commit to branch staging
in repository guix.

commit ab149c6ba0d19dfd6e15f2324cf9e3d6e2944ac5
Author: Christopher Baines <address@hidden>
Date:   Fri Feb 8 10:20:53 2019 +0000

    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.
---
 guix/build/ruby-build-system.scm | 45 ++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm
index 3a658e2..cdabd82 100644
--- a/guix/build/ruby-build-system.scm
+++ b/guix/build/ruby-build-system.scm
@@ -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.
 This avoids issues with upstream gemspecs requiring tools such as git to
 generate the files list."
-  (when (gem-archive? source)
-    (let ((gemspec (or (false-if-exception (first-gemspec))
-                       ;; Make new gemspec if one wasn't shipped.
-                       ".gemspec")))
-
-      (when (file-exists? gemspec) (delete-file gemspec))
-
-      ;; Extract gemspec from source gem.
-      (let ((pipe (open-pipe* OPEN_READ "gem" "spec" "--ruby" source)))
-        (dynamic-wind
-          (const #t)
-          (lambda ()
-            (call-with-output-file gemspec
-              (lambda (out)
-                ;; 'gem spec' writes to stdout, but 'gem build' only reads
-                ;; gemspecs from a file, so we redirect the output to a file.
-                (while (not (eof-object? (peek-char pipe)))
-                  (write-char (read-char pipe) out))))
-            #t)
-          (lambda ()
-            (close-pipe pipe)))))
-    #t))
+  (if (gem-archive? source)
+      (let ((gemspec (or (false-if-exception (first-gemspec))
+                         ;; Make new gemspec if one wasn't shipped.
+                         ".gemspec")))
+
+        (when (file-exists? gemspec) (delete-file gemspec))
+
+        ;; Extract gemspec from source gem.
+        (let ((pipe (open-pipe* OPEN_READ "gem" "spec" "--ruby" source)))
+          (dynamic-wind
+            (const #t)
+            (lambda ()
+              (call-with-output-file gemspec
+                (lambda (out)
+                  ;; 'gem spec' writes to stdout, but 'gem build' only reads
+                  ;; gemspecs from a file, so we redirect the output to a file.
+                  (while (not (eof-object? (peek-char pipe)))
+                    (write-char (read-char pipe) out))))
+              #t)
+            (lambda ()
+              (close-pipe pipe)))))
+      (display "extract-gemspec: skipping as source is not a gem archive\n"))
+  #t)
 
 (define* (build #:key source #:allow-other-keys)
   "Build a new gem using the gemspec from the SOURCE gem."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]