GNU bug report logs - #34385
[PATCH 0/2] Ruby build system improvements

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Fri, 8 Feb 2019 10:25:01 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34385 in the body.
You can then email your comments to 34385 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#34385; Package guix-patches. (Fri, 08 Feb 2019 10:25:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Baines <mail <at> cbaines.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 08 Feb 2019 10:25:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/2] Ruby build system improvements
Date: Fri, 08 Feb 2019 10:24:40 +0000
[Message part 1 (text/plain, inline)]
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(-)
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#34385; Package guix-patches. (Fri, 08 Feb 2019 10:36:01 GMT) Full text and rfc822 format available.

Message #8 received at 34385 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 34385 <at> debbugs.gnu.org
Subject: [PATCH 2/2] guix: ruby-build-system: Do gem install --verbose.
Date: Fri,  8 Feb 2019 10:35:52 +0000
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





Information forwarded to guix-patches <at> gnu.org:
bug#34385; Package guix-patches. (Fri, 08 Feb 2019 10:36:02 GMT) Full text and rfc822 format available.

Message #11 received at 34385 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 34385 <at> debbugs.gnu.org
Subject: [PATCH 1/2] gnu: ruby-build-system: Change extract-gemspec to always
 return #t.
Date: Fri,  8 Feb 2019 10:35:51 +0000
* 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





Information forwarded to guix-patches <at> gnu.org:
bug#34385; Package guix-patches. (Fri, 08 Feb 2019 19:57:01 GMT) Full text and rfc822 format available.

Message #14 received at 34385 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 34385 <at> debbugs.gnu.org
Subject: [PATCH v2 3/3] guix: ruby-build-system: Fix removal of extension
 related files.
Date: Fri,  8 Feb 2019 19:56:42 +0000
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





Information forwarded to guix-patches <at> gnu.org:
bug#34385; Package guix-patches. (Fri, 08 Feb 2019 19:57:02 GMT) Full text and rfc822 format available.

Message #17 received at 34385 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 34385 <at> debbugs.gnu.org
Subject: [PATCH v2 2/3] guix: ruby-build-system: Do gem install --verbose.
Date: Fri,  8 Feb 2019 19:56:41 +0000
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





Information forwarded to guix-patches <at> gnu.org:
bug#34385; Package guix-patches. (Fri, 08 Feb 2019 19:57:02 GMT) Full text and rfc822 format available.

Message #20 received at 34385 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 34385 <at> debbugs.gnu.org
Subject: [PATCH v2 1/3] gnu: ruby-build-system: Change extract-gemspec to
 always return #t.
Date: Fri,  8 Feb 2019 19:56:40 +0000
* 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





Information forwarded to guix-patches <at> gnu.org:
bug#34385; Package guix-patches. (Wed, 13 Feb 2019 20:47:02 GMT) Full text and rfc822 format available.

Message #23 received at 34385 <at> debbugs.gnu.org (full text, mbox):

From: Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 34385 <at> debbugs.gnu.org
Subject: Re: [bug#34385] [PATCH v2 1/3] gnu: ruby-build-system: Change
 extract-gemspec to always return #t.
Date: Wed, 13 Feb 2019 21:46:17 +0100
[Message part 1 (text/plain, inline)]
On Fri,  8 Feb 2019 19:56:40 +0000
Christopher Baines <mail <at> 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
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#34385; Package guix-patches. (Wed, 13 Feb 2019 20:48:01 GMT) Full text and rfc822 format available.

Message #26 received at 34385 <at> debbugs.gnu.org (full text, mbox):

From: Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 34385 <at> debbugs.gnu.org
Subject: Re: [bug#34385] [PATCH v2 2/3] guix: ruby-build-system: Do gem
 install --verbose.
Date: Wed, 13 Feb 2019 21:47:42 +0100
[Message part 1 (text/plain, inline)]
On Fri,  8 Feb 2019 19:56:41 +0000
Christopher Baines <mail <at> 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.

[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#34385; Package guix-patches. (Wed, 13 Feb 2019 20:49:02 GMT) Full text and rfc822 format available.

Message #29 received at 34385 <at> debbugs.gnu.org (full text, mbox):

From: Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 34385 <at> debbugs.gnu.org
Subject: Re: [bug#34385] [PATCH v2 3/3] guix: ruby-build-system: Fix removal
 of extension related files.
Date: Wed, 13 Feb 2019 21:48:49 +0100
[Message part 1 (text/plain, inline)]
On Fri,  8 Feb 2019 19:56:42 +0000
Christopher Baines <mail <at> 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
[Message part 2 (application/pgp-signature, inline)]

Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Thu, 14 Feb 2019 19:31:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Baines <mail <at> cbaines.net>:
bug acknowledged by developer. (Thu, 14 Feb 2019 19:31:02 GMT) Full text and rfc822 format available.

Message #34 received at 34385-done <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
Cc: 34385-done <at> debbugs.gnu.org
Subject: Re: [bug#34385] [PATCH v2 3/3] guix: ruby-build-system: Fix removal
 of extension related files.
Date: Thu, 14 Feb 2019 19:30:51 +0000
[Message part 1 (text/plain, inline)]
Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de> writes:

> On Fri,  8 Feb 2019 19:56:42 +0000
> Christopher Baines <mail <at> 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 :)
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 15 Mar 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.