Re: [PATCH] Update Ruby to 2.3.0 (was Re: Freezing core-updates soon)

2016-01-08 Thread Ben Woodcroft



On 06/01/16 08:24, Ludovic Courtès wrote:

Ben Woodcroft  skribis:


I had some trouble downloading dependencies because of inability to
download sources e.g. http://graphviz.org/ seems to be down. Ruby
seems to build though, can we just review as normal and then push to
core-updates?

I did rebuild all the packages in ruby.scm, and out of these about 1/3
of packages failed to build, because at least these three packages'
tests fail
* yard
* power_assert
* minitest_tu_shim

The first two presumably will be fixed upstream soon, but the third
hasn't seen a release since Aug 2013, and the homepage listed on
rubygems is dead. I guess we just have to encourage the only package
we have packaged that uses tu_shim (term-ansicolor) to stop relying on
it.

OK, thanks for testing this thoroughly.  It would be good to fix these 3
packages sometime before core-updates is merged.
In the attached patches I've disabled the failing test in both yard and 
power_assert. There's no fix for yard in upstream. For power_assert 
there is a fix, but unfortunately it seems Ruby packages cannot be 
patched in the usual way because .gem files are archives of archives so 
the unpacking/patch/repacking fails. I guess we fix that in future.


Turns out fixing minitest_tu_shim (and others) was easier than I thought 
as the problem was some hardcoded ruby 2.2 paths in package definitions. 
I created a new procedure to remove the hard-coding so the update to 2.4 
will work too, WDYT?


After all that, everything in gnu/packages/ruby.scm builds.

+   (modify-phases %standard-phases
+ (add-before 'configure 'replace-bin-sh
+   (lambda _
+ (substitute* '("Makefile.in"
+"ext/pty/pty.c"
+"io.c"
+"lib/mkmf.rb"
+"process.c"
+"test/rubygems/test_gem_ext_configure_builder.rb"
+"test/rdoc/test_rdoc_parser.rb"
+"test/ruby/test_rubyoptions.rb"
+"test/ruby/test_process.rb"
+"test/ruby/test_system.rb"
+"tool/rbinstall.rb")
+   (("/bin/sh") (which "sh")))
+ (substitute* "ext/fiddle/libffi-3.2.1/configure"
+   (("SHELL = /bin/sh")
+(string-append "SHELL = " (which "sh"
+ #t)
+(inputs
+ `(("readline" ,readline)
+   ("openssl" ,openssl)
+   ("libffi" ,libffi)
+   ("gdbm" ,gdbm)
+   ("zlib" ,zlib)))
+(native-search-paths
+ (list (search-path-specification
+(variable "GEM_PATH")
+(files (list (string-append "lib/ruby/gems/"
+(version-major+minor version)
+".0"))

This seems to be shared with 2.2.  Is it possible to avoid duplication
using something like:

   (define ruby
 (package
   (inherit ruby-2.2)
   (version "2.3.4")
   ;; …
   ))

?

[..]

Yes, I did this but forgot to delete some/most duplication. Now after 
the final patch ruby-2.2 inherits from ruby (not vice-versa as you 
suggest) as this was the previous convention in ruby.scm. I checked that 
the hashes in the store names for ruby 2.2, 2.1 and 1.8 did not change 
after applying the patch.


Better? Thanks for the review.
ben
>From 910c98d233a271bf4ee74ee9edf4c42fb090afd5 Mon Sep 17 00:00:00 2001
From: Ben Woodcroft 
Date: Wed, 6 Jan 2016 21:23:15 +1000
Subject: [PATCH 1/4] gnu: ruby-power-assert: Disable failing test.

* gnu/packages/ruby.scm (ruby-power-assert)[arguments]: Disable test which
fails on Ruby 2.3.0.
---
 gnu/packages/ruby.scm | 12 
 1 file changed, 12 insertions(+)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 47ac392..9706ec7 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -1067,6 +1067,18 @@ using Net::HTTP, supporting reconnection and retry according to RFC 2616.")
(base32
 "0gbj379jhnff8rbb6m3kzdm282szjz1a021xzxa38d1bnswj2jx3"
 (build-system ruby-build-system)
+(arguments
+ '(#:phases
+   (modify-phases %standard-phases
+ (add-before 'check 'patch-test
+   ;; Disable test that fails on Ruby 2.3.  This has been fixed
+   ;; upstream but the fix has not been released.
+   (lambda _
+ (substitute*
+ "test/test_power_assert.rb"
+   (("def test_inspection_failure")
+"def dont_test_inspection_failure"))
+ #t)
 (native-inputs
  `(("bundler" ,bundler)))
 (synopsis "Assert library with descriptive assertion messages")
-- 
2.6.3

>From 207d2fa7769a4fea5a3a32a7227b2c7a2e0293bb Mon Sep 17 00:00:00 2001
From: Ben Woodcroft 
Date: Wed, 6 Jan 2016 21:57:44 +1000
Subject: [PATCH 2/4] gnu: ruby-yard: Disable failing test.

* gnu/packages/ruby.sc

Re: [PATCH] Update Ruby to 2.3.0 (was Re: Freezing core-updates soon)

2016-01-05 Thread Ludovic Courtès
Ben Woodcroft  skribis:

> I had some trouble downloading dependencies because of inability to
> download sources e.g. http://graphviz.org/ seems to be down. Ruby
> seems to build though, can we just review as normal and then push to
> core-updates?
>
> I did rebuild all the packages in ruby.scm, and out of these about 1/3
> of packages failed to build, because at least these three packages'
> tests fail
> * yard
> * power_assert
> * minitest_tu_shim
>
> The first two presumably will be fixed upstream soon, but the third
> hasn't seen a release since Aug 2013, and the homepage listed on
> rubygems is dead. I guess we just have to encourage the only package
> we have packaged that uses tu_shim (term-ansicolor) to stop relying on
> it.

OK, thanks for testing this thoroughly.  It would be good to fix these 3
packages sometime before core-updates is merged.

> From cd8c4e078cb930d1ce928b3c614b2081ec6719ac Mon Sep 17 00:00:00 2001
> From: Ben Woodcroft 
> Date: Mon, 4 Jan 2016 09:38:42 +1000
> Subject: [PATCH] gnu: ruby: Update to 2.3.0.
>
> * gnu/packages/ruby.scm (ruby): Update to 2.3.0.
> (ruby-2.2): New variable.

[...]

> +   (modify-phases %standard-phases
> + (add-before 'configure 'replace-bin-sh
> +   (lambda _
> + (substitute* '("Makefile.in"
> +"ext/pty/pty.c"
> +"io.c"
> +"lib/mkmf.rb"
> +"process.c"
> +"test/rubygems/test_gem_ext_configure_builder.rb"
> +"test/rdoc/test_rdoc_parser.rb"
> +"test/ruby/test_rubyoptions.rb"
> +"test/ruby/test_process.rb"
> +"test/ruby/test_system.rb"
> +"tool/rbinstall.rb")
> +   (("/bin/sh") (which "sh")))
> + (substitute* "ext/fiddle/libffi-3.2.1/configure"
> +   (("SHELL = /bin/sh")
> +(string-append "SHELL = " (which "sh"
> + #t)
> +(inputs
> + `(("readline" ,readline)
> +   ("openssl" ,openssl)
> +   ("libffi" ,libffi)
> +   ("gdbm" ,gdbm)
> +   ("zlib" ,zlib)))
> +(native-search-paths
> + (list (search-path-specification
> +(variable "GEM_PATH")
> +(files (list (string-append "lib/ruby/gems/"
> +(version-major+minor version)
> +".0"))

This seems to be shared with 2.2.  Is it possible to avoid duplication
using something like:

  (define ruby
(package
  (inherit ruby-2.2)
  (version "2.3.4")
  ;; …
  ))

?

Thanks,
Ludo’.