Patchwork [4/4] gnu: Add ruby-concurrent.

login
register
mail settings
Submitter Ben Woodcroft
Date June 5, 2016, 1 p.m.
Message ID <1465131653-28176-5-git-send-email-donttrustben@gmail.com>
Download mbox | patch
Permalink /patch/12779/
State New
Headers show

Comments

Ben Woodcroft - June 5, 2016, 1 p.m.
* gnu/packages/ruby.scm (ruby-concurrent): New variable.
* gnu/packages/patches/ruby-concurrent-ignore-broken-test.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                       |  1 +
 .../ruby-concurrent-ignore-broken-test.patch       | 37 ++++++++++++++
 gnu/packages/ruby.scm                              | 58 ++++++++++++++++++++++
 3 files changed, 96 insertions(+)
 create mode 100644 gnu/packages/patches/ruby-concurrent-ignore-broken-test.patch
David Thompson - June 5, 2016, 2:02 p.m.
On Sun, Jun 5, 2016 at 9:00 AM, Ben Woodcroft <donttrustben@gmail.com> wrote:
> * gnu/packages/ruby.scm (ruby-concurrent): New variable.
> * gnu/packages/patches/ruby-concurrent-ignore-broken-test.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> ---
>  gnu/local.mk                                       |  1 +
>  .../ruby-concurrent-ignore-broken-test.patch       | 37 ++++++++++++++
>  gnu/packages/ruby.scm                              | 58 ++++++++++++++++++++++
>  3 files changed, 96 insertions(+)
>  create mode 100644 gnu/packages/patches/ruby-concurrent-ignore-broken-test.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index c3a3ea4..65146db 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -731,6 +731,7 @@ dist_patch_DATA =                                           \
>    %D%/packages/patches/ripperx-missing-file.patch              \
>    %D%/packages/patches/rpm-CVE-2014-8118.patch                 \
>    %D%/packages/patches/rsem-makefile.patch                     \
> +  %D%/packages/patches/ruby-concurrent-ignore-broken-test.patch        \
>    %D%/packages/patches/ruby-symlinkfix.patch                    \
>    %D%/packages/patches/rush-CVE-2013-6889.patch                        \
>    %D%/packages/patches/sed-hurd-path-max.patch                 \
> diff --git a/gnu/packages/patches/ruby-concurrent-ignore-broken-test.patch b/gnu/packages/patches/ruby-concurrent-ignore-broken-test.patch
> new file mode 100644
> index 0000000..803d8a8
> --- /dev/null
> +++ b/gnu/packages/patches/ruby-concurrent-ignore-broken-test.patch
> @@ -0,0 +1,37 @@
> +diff --git a/spec/concurrent/channel_spec.rb b/spec/concurrent/channel_spec.rb
> +index d70fba8..f1bcc0a 100644
> +--- a/spec/concurrent/channel_spec.rb
> ++++ b/spec/concurrent/channel_spec.rb
> +@@ -598,19 +598,19 @@ module Concurrent
> +           }.to raise_error(ArgumentError)
> +         end
> +
> +-        it 'loops until the block returns false' do
> +-          actual = 0
> +-          expected = 3
> +-          latch = Concurrent::CountDownLatch.new(expected)
> +-          Channel.go_loop do
> +-            actual += 1
> +-            latch.count_down
> +-            actual < expected
> +-          end
> +-
> +-          latch.wait(10)
> +-          expect(actual).to eq expected
> +-        end
> ++        # it 'loops until the block returns false' do
> ++        #   actual = 0
> ++        #   expected = 3
> ++        #   latch = Concurrent::CountDownLatch.new(expected)
> ++        #   Channel.go_loop do
> ++        #     actual += 1
> ++        #     latch.count_down
> ++        #     actual < expected
> ++        #   end
> ++
> ++        #   latch.wait(10)
> ++        #   expect(actual).to eq expected
> ++        # end
> +       end

Instead of commenting out the test, just change "it" to "xit" to mark
the test as pending.

> +
> +       context '.go_loop_via' do
> diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
> index 71b13e4..e761062 100644
> --- a/gnu/packages/ruby.scm
> +++ b/gnu/packages/ruby.scm
> @@ -4005,4 +4005,62 @@ provides a unified method to mock @code{Time.now}, @code{Date.today}, and
>      (home-page "https://github.com/travisjeffery/timecop")
>      (license license:expat)))
>
> +(define-public ruby-concurrent
> +  (package
> +    (name "ruby-concurrent")
> +    (version "1.0.2")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       ;; Download from GitHub because the rubygems version does not contain
> +       ;; Rakefile.
> +       (uri (string-append
> +             "https://github.com/ruby-concurrency/concurrent-ruby/archive/v"
> +             version
> +             ".tar.gz"))
> +       (file-name (string-append name "-" version ".tar.gz"))
> +       (sha256
> +        (base32
> +         "1x3g2admp14ykwfxidsicqbhlfsnxh9wyc806np4i15hws4if1d8"))
> +       ;; Exclude failing test reported at
> +       ;; https://github.com/ruby-concurrency/concurrent-ruby/issues/534
> +       (patches (search-patches "ruby-concurrent-ignore-broken-test.patch"))))
> +    (build-system ruby-build-system)
> +    (arguments
> +     `(#:test-target "spec"
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-before 'build 'remove-git-lsfiles-and-extra-gemspecs
> +           (lambda _
> +             (for-each (lambda (file)
> +                         (substitute* file
> +                           (("git ls-files") "find *")))
> +                       (list "concurrent-ruby.gemspec"
> +                             "concurrent-ruby-edge.gemspec"
> +                             "support/file_map.rb"))
> +             #t))
> +         (add-before 'build 'remove-extra-gemspecs
> +           (lambda _
> +             ;; Delete extra gemspec files so 'first-gemspec' chooses the
> +             ;; correct one.
> +             (delete-file "concurrent-ruby-edge.gemspec")

Since you delete this gemspec, is it really necessary to patch it in
the prior phase?

> +             (delete-file "concurrent-ruby-ext.gemspec")
> +             #t))
> +         (add-before 'check 'rake-compile
> +           ;; Fix the test error described at
> +           ;; https://github.com/ruby-concurrency/concurrent-ruby/pull/408
> +           (lambda _ (zero? (system* "rake" "compile")))))))
> +    (native-inputs
> +     `(("ruby-rake-compiler" ,ruby-rake-compiler)
> +       ("ruby-yard" ,ruby-yard)
> +       ("ruby-rspec" ,ruby-rspec)
> +       ("ruby-timecop" ,ruby-timecop)))
> +    (synopsis "Concurrency tools for Ruby")
> +    (description
> +     "This library provides modern concurrency tools including agents,
> +futures, promises, thread pools, actors, supervisors, and more.  It is
> +inspired by Erlang, Clojure, Go, JavaScript, actors and classic concurrency
> +patterns.")
> +    (home-page "http://www.concurrent-ruby.com")
> +    (license license:expat)))
>
> --
> 2.7.4
>
>

- Dave

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index c3a3ea4..65146db 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -731,6 +731,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/ripperx-missing-file.patch		\
   %D%/packages/patches/rpm-CVE-2014-8118.patch			\
   %D%/packages/patches/rsem-makefile.patch			\
+  %D%/packages/patches/ruby-concurrent-ignore-broken-test.patch	\
   %D%/packages/patches/ruby-symlinkfix.patch                    \
   %D%/packages/patches/rush-CVE-2013-6889.patch			\
   %D%/packages/patches/sed-hurd-path-max.patch			\
diff --git a/gnu/packages/patches/ruby-concurrent-ignore-broken-test.patch b/gnu/packages/patches/ruby-concurrent-ignore-broken-test.patch
new file mode 100644
index 0000000..803d8a8
--- /dev/null
+++ b/gnu/packages/patches/ruby-concurrent-ignore-broken-test.patch
@@ -0,0 +1,37 @@ 
+diff --git a/spec/concurrent/channel_spec.rb b/spec/concurrent/channel_spec.rb
+index d70fba8..f1bcc0a 100644
+--- a/spec/concurrent/channel_spec.rb
++++ b/spec/concurrent/channel_spec.rb
+@@ -598,19 +598,19 @@ module Concurrent
+           }.to raise_error(ArgumentError)
+         end
+ 
+-        it 'loops until the block returns false' do
+-          actual = 0
+-          expected = 3
+-          latch = Concurrent::CountDownLatch.new(expected)
+-          Channel.go_loop do
+-            actual += 1
+-            latch.count_down
+-            actual < expected
+-          end
+-
+-          latch.wait(10)
+-          expect(actual).to eq expected
+-        end
++        # it 'loops until the block returns false' do
++        #   actual = 0
++        #   expected = 3
++        #   latch = Concurrent::CountDownLatch.new(expected)
++        #   Channel.go_loop do
++        #     actual += 1
++        #     latch.count_down
++        #     actual < expected
++        #   end
++
++        #   latch.wait(10)
++        #   expect(actual).to eq expected
++        # end
+       end
+ 
+       context '.go_loop_via' do
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 71b13e4..e761062 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -4005,4 +4005,62 @@  provides a unified method to mock @code{Time.now}, @code{Date.today}, and
     (home-page "https://github.com/travisjeffery/timecop")
     (license license:expat)))
 
+(define-public ruby-concurrent
+  (package
+    (name "ruby-concurrent")
+    (version "1.0.2")
+    (source
+     (origin
+       (method url-fetch)
+       ;; Download from GitHub because the rubygems version does not contain
+       ;; Rakefile.
+       (uri (string-append
+             "https://github.com/ruby-concurrency/concurrent-ruby/archive/v"
+             version
+             ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "1x3g2admp14ykwfxidsicqbhlfsnxh9wyc806np4i15hws4if1d8"))
+       ;; Exclude failing test reported at
+       ;; https://github.com/ruby-concurrency/concurrent-ruby/issues/534
+       (patches (search-patches "ruby-concurrent-ignore-broken-test.patch"))))
+    (build-system ruby-build-system)
+    (arguments
+     `(#:test-target "spec"
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'remove-git-lsfiles-and-extra-gemspecs
+           (lambda _
+             (for-each (lambda (file)
+                         (substitute* file
+                           (("git ls-files") "find *")))
+                       (list "concurrent-ruby.gemspec"
+                             "concurrent-ruby-edge.gemspec"
+                             "support/file_map.rb"))
+             #t))
+         (add-before 'build 'remove-extra-gemspecs
+           (lambda _
+             ;; Delete extra gemspec files so 'first-gemspec' chooses the
+             ;; correct one.
+             (delete-file "concurrent-ruby-edge.gemspec")
+             (delete-file "concurrent-ruby-ext.gemspec")
+             #t))
+         (add-before 'check 'rake-compile
+           ;; Fix the test error described at
+           ;; https://github.com/ruby-concurrency/concurrent-ruby/pull/408
+           (lambda _ (zero? (system* "rake" "compile")))))))
+    (native-inputs
+     `(("ruby-rake-compiler" ,ruby-rake-compiler)
+       ("ruby-yard" ,ruby-yard)
+       ("ruby-rspec" ,ruby-rspec)
+       ("ruby-timecop" ,ruby-timecop)))
+    (synopsis "Concurrency tools for Ruby")
+    (description
+     "This library provides modern concurrency tools including agents,
+futures, promises, thread pools, actors, supervisors, and more.  It is
+inspired by Erlang, Clojure, Go, JavaScript, actors and classic concurrency
+patterns.")
+    (home-page "http://www.concurrent-ruby.com")
+    (license license:expat)))