unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#34385] [PATCH 0/2] Ruby build system improvements
@ 2019-02-08 10:24 Christopher Baines
  2019-02-08 10:35 ` [bug#34385] [PATCH 1/2] gnu: ruby-build-system: Change extract-gemspec to always return #t Christopher Baines
  2019-02-08 19:56 ` [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t Christopher Baines
  0 siblings, 2 replies; 10+ messages in thread
From: Christopher Baines @ 2019-02-08 10:24 UTC (permalink / raw)
  To: 34385

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

A couple of improvements to the Ruby build system.

Christopher Baines (2):
  gnu: ruby-build-system: Change extract-gemspec to always return #t.
  guix: ruby-build-system: Do gem install --verbose.

 guix/build/ruby-build-system.scm | 46 +++++++++++++++++---------------
 1 file changed, 24 insertions(+), 22 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#34385] [PATCH 1/2] gnu: ruby-build-system: Change extract-gemspec to always return #t.
  2019-02-08 10:24 [bug#34385] [PATCH 0/2] Ruby build system improvements Christopher Baines
@ 2019-02-08 10:35 ` Christopher Baines
  2019-02-08 10:35   ` [bug#34385] [PATCH 2/2] guix: ruby-build-system: Do gem install --verbose Christopher Baines
  2019-02-08 19:56 ` [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t Christopher Baines
  1 sibling, 1 reply; 10+ messages in thread
From: Christopher Baines @ 2019-02-08 10:35 UTC (permalink / raw)
  To: 34385

* 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 3a658e2557..cdabd829e2 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."
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#34385] [PATCH 2/2] guix: ruby-build-system: Do gem install --verbose.
  2019-02-08 10:35 ` [bug#34385] [PATCH 1/2] gnu: ruby-build-system: Change extract-gemspec to always return #t Christopher Baines
@ 2019-02-08 10:35   ` Christopher Baines
  0 siblings, 0 replies; 10+ messages in thread
From: Christopher Baines @ 2019-02-08 10:35 UTC (permalink / raw)
  To: 34385

This is helpful as it displays more information about what gem install is
doing, especially for packages with native extensions.

* guix/build/ruby-build-system.scm (install): Add --verbose to gem install command.
---
 guix/build/ruby-build-system.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm
index cdabd829e2..64b4400f1a 100644
--- a/guix/build/ruby-build-system.scm
+++ b/guix/build/ruby-build-system.scm
@@ -144,6 +144,7 @@ GEM-FLAGS are passed to the 'gem' invokation, if present."
 
     (or (zero?
          (apply system* "gem" "install" gem-file
+                "--verbose"
                 "--local" "--ignore-dependencies" "--vendor"
                 ;; Executables should go into /bin, not
                 ;; /lib/ruby/gems.
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t.
  2019-02-08 10:24 [bug#34385] [PATCH 0/2] Ruby build system improvements Christopher Baines
  2019-02-08 10:35 ` [bug#34385] [PATCH 1/2] gnu: ruby-build-system: Change extract-gemspec to always return #t Christopher Baines
@ 2019-02-08 19:56 ` Christopher Baines
  2019-02-08 19:56   ` [bug#34385] [PATCH v2 2/3] guix: ruby-build-system: Do gem install --verbose Christopher Baines
                     ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Christopher Baines @ 2019-02-08 19:56 UTC (permalink / raw)
  To: 34385

* 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 3a658e2557..cdabd829e2 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."
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#34385] [PATCH v2 2/3] guix: ruby-build-system: Do gem install --verbose.
  2019-02-08 19:56 ` [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t Christopher Baines
@ 2019-02-08 19:56   ` Christopher Baines
  2019-02-13 20:47     ` Björn Höfling
  2019-02-08 19:56   ` [bug#34385] [PATCH v2 3/3] guix: ruby-build-system: Fix removal of extension related files Christopher Baines
  2019-02-13 20:46   ` [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t Björn Höfling
  2 siblings, 1 reply; 10+ messages in thread
From: Christopher Baines @ 2019-02-08 19:56 UTC (permalink / raw)
  To: 34385

This is helpful as it displays more information about what gem install is
doing, especially for packages with native extensions.

* guix/build/ruby-build-system.scm (install): Add --verbose to gem install command.
---
 guix/build/ruby-build-system.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm
index cdabd829e2..64b4400f1a 100644
--- a/guix/build/ruby-build-system.scm
+++ b/guix/build/ruby-build-system.scm
@@ -144,6 +144,7 @@ GEM-FLAGS are passed to the 'gem' invokation, if present."
 
     (or (zero?
          (apply system* "gem" "install" gem-file
+                "--verbose"
                 "--local" "--ignore-dependencies" "--vendor"
                 ;; Executables should go into /bin, not
                 ;; /lib/ruby/gems.
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#34385] [PATCH v2 3/3] guix: ruby-build-system: Fix removal of extension related files.
  2019-02-08 19:56 ` [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t Christopher Baines
  2019-02-08 19:56   ` [bug#34385] [PATCH v2 2/3] guix: ruby-build-system: Do gem install --verbose Christopher Baines
@ 2019-02-08 19:56   ` Christopher Baines
  2019-02-13 20:48     ` Björn Höfling
  2019-02-13 20:46   ` [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t Björn Höfling
  2 siblings, 1 reply; 10+ messages in thread
From: Christopher Baines @ 2019-02-08 19:56 UTC (permalink / raw)
  To: 34385

This functionality was broken, possibly to do with the vendor related changes
in the ruby build system. These changes restore the file removal functionality
at the end of the install phase.

* guix/build/ruby-build-system.scm (install): Fix removal of files related to
native extensions.
---
 guix/build/ruby-build-system.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/guix/build/ruby-build-system.scm b/guix/build/ruby-build-system.scm
index 64b4400f1a..ba0de1259e 100644
--- a/guix/build/ruby-build-system.scm
+++ b/guix/build/ruby-build-system.scm
@@ -139,7 +139,8 @@ GEM-FLAGS are passed to the 'gem' invokation, if present."
          (gem-file-basename (basename gem-file))
          (gem-name (substring gem-file-basename
                               0
-                              (- (string-length gem-file-basename) 4))))
+                              (- (string-length gem-file-basename) 4)))
+         (gem-dir (string-append vendor-dir "/gems/" gem-name)))
     (setenv "GEM_VENDOR" vendor-dir)
 
     (or (zero?
@@ -165,7 +166,7 @@ GEM-FLAGS are passed to the 'gem' invokation, if present."
     ;; For gems with native extensions, several Makefile-related files
     ;; are created that contain timestamps or other elements making
     ;; them not reproducible.  They are unnecessary so we remove them.
-    (when (file-exists? (string-append vendor-dir "/ext"))
+    (when (file-exists? (string-append gem-dir "/ext"))
       (for-each (lambda (file)
                   (log-file-deletion file)
                   (delete-file file))
@@ -174,7 +175,7 @@ GEM-FLAGS are passed to the 'gem' invokation, if present."
                              "page-Makefile.ri")
                  (find-files (string-append vendor-dir "/extensions")
                              "gem_make.out")
-                 (find-files (string-append vendor-dir "/ext")
+                 (find-files (string-append gem-dir "/ext")
                              "Makefile"))))
 
     #t))
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t.
  2019-02-08 19:56 ` [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t Christopher Baines
  2019-02-08 19:56   ` [bug#34385] [PATCH v2 2/3] guix: ruby-build-system: Do gem install --verbose Christopher Baines
  2019-02-08 19:56   ` [bug#34385] [PATCH v2 3/3] guix: ruby-build-system: Fix removal of extension related files Christopher Baines
@ 2019-02-13 20:46   ` Björn Höfling
  2 siblings, 0 replies; 10+ messages in thread
From: Björn Höfling @ 2019-02-13 20:46 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 34385

[-- Attachment #1: Type: text/plain, Size: 324 bytes --]

On Fri,  8 Feb 2019 19:56:40 +0000
Christopher Baines <mail@cbaines.net> wrote:

> * 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

LGTM.

Thank you,

Björn

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#34385] [PATCH v2 2/3] guix: ruby-build-system: Do gem install --verbose.
  2019-02-08 19:56   ` [bug#34385] [PATCH v2 2/3] guix: ruby-build-system: Do gem install --verbose Christopher Baines
@ 2019-02-13 20:47     ` Björn Höfling
  0 siblings, 0 replies; 10+ messages in thread
From: Björn Höfling @ 2019-02-13 20:47 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 34385

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

On Fri,  8 Feb 2019 19:56:41 +0000
Christopher Baines <mail@cbaines.net> wrote:

> This is helpful as it displays more information about what gem
> install is doing, especially for packages with native extensions.
> 
> * guix/build/ruby-build-system.scm (install): Add --verbose to gem
> install command. ---

LGTM.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#34385] [PATCH v2 3/3] guix: ruby-build-system: Fix removal of extension related files.
  2019-02-08 19:56   ` [bug#34385] [PATCH v2 3/3] guix: ruby-build-system: Fix removal of extension related files Christopher Baines
@ 2019-02-13 20:48     ` Björn Höfling
  2019-02-14 19:30       ` bug#34385: " Christopher Baines
  0 siblings, 1 reply; 10+ messages in thread
From: Björn Höfling @ 2019-02-13 20:48 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 34385

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

On Fri,  8 Feb 2019 19:56:42 +0000
Christopher Baines <mail@cbaines.net> wrote:

> This functionality was broken, possibly to do with the vendor related
> changes in the ruby build system. These changes restore the file
> removal functionality at the end of the install phase.
> 
> * guix/build/ruby-build-system.scm (install): Fix removal of files
> related to native extensions.

LGTM.

In particular, the ruby-idn-ruby package is now reproducible.

Thanks,

Björn

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#34385: [PATCH v2 3/3] guix: ruby-build-system: Fix removal of extension related files.
  2019-02-13 20:48     ` Björn Höfling
@ 2019-02-14 19:30       ` Christopher Baines
  0 siblings, 0 replies; 10+ messages in thread
From: Christopher Baines @ 2019-02-14 19:30 UTC (permalink / raw)
  To: Björn Höfling; +Cc: 34385-done

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]


Björn Höfling <bjoern.hoefling@bjoernhoefling.de> writes:

> On Fri,  8 Feb 2019 19:56:42 +0000
> Christopher Baines <mail@cbaines.net> wrote:
>
>> This functionality was broken, possibly to do with the vendor related
>> changes in the ruby build system. These changes restore the file
>> removal functionality at the end of the install phase.
>>
>> * guix/build/ruby-build-system.scm (install): Fix removal of files
>> related to native extensions.
>
> LGTM.
>
> In particular, the ruby-idn-ruby package is now reproducible.

Great, I've pushed these patches to staging now. Thanks for taking a
look :)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-02-14 19:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-08 10:24 [bug#34385] [PATCH 0/2] Ruby build system improvements Christopher Baines
2019-02-08 10:35 ` [bug#34385] [PATCH 1/2] gnu: ruby-build-system: Change extract-gemspec to always return #t Christopher Baines
2019-02-08 10:35   ` [bug#34385] [PATCH 2/2] guix: ruby-build-system: Do gem install --verbose Christopher Baines
2019-02-08 19:56 ` [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t Christopher Baines
2019-02-08 19:56   ` [bug#34385] [PATCH v2 2/3] guix: ruby-build-system: Do gem install --verbose Christopher Baines
2019-02-13 20:47     ` Björn Höfling
2019-02-08 19:56   ` [bug#34385] [PATCH v2 3/3] guix: ruby-build-system: Fix removal of extension related files Christopher Baines
2019-02-13 20:48     ` Björn Höfling
2019-02-14 19:30       ` bug#34385: " Christopher Baines
2019-02-13 20:46   ` [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to always return #t Björn Höfling

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).