commit:     316d122abda56fb4f51ad05b21ecec9983aa8f06
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  9 02:28:08 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr  9 02:28:48 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=316d122a

dev-ruby/async: add 1.31.0

Bug: https://bugs.gentoo.org/761550
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-ruby/async/Manifest                            |  1 +
 dev-ruby/async/async-1.31.0.ebuild                 | 44 +++++++++++++++++++
 .../async-1.31.0-improve-robustness-test.patch     | 49 ++++++++++++++++++++++
 3 files changed, 94 insertions(+)

diff --git a/dev-ruby/async/Manifest b/dev-ruby/async/Manifest
index 311f37c156ba..40f23794f4f6 100644
--- a/dev-ruby/async/Manifest
+++ b/dev-ruby/async/Manifest
@@ -1,3 +1,4 @@
 DIST async-1.30.3.tar.gz 92599 BLAKE2B 
69db66676adf2dd0f77142bffc55b1e90a6983c53c7fac444f72b9365f6907e4d2ec45579ea267f3a8f31fc45af63c3517908c353749b288d1873e2cf720f96b
 SHA512 
337a51ca8fd0e6685528e2eca9b584344ba583f7254f2600110ee62da6e4ccabeb471e7d94f36ab6f8d0eb3eada9e23335a262a50c8d035f67708fce0a590e5e
+DIST async-1.31.0.tar.gz 92889 BLAKE2B 
b573e3106243fd0934387254b302f541a9ebbcd34bd451562bab1d39bcd37c593e2290667b524db7bc862268812a0932a644c670cbaf2a4a5ee240a866e08726
 SHA512 
f60fb9f4e95d1f579ce5f664abfe96b7196e3e47baf2856b7e97815107e0aa2e807c969839d118b6144372443687568488749547d762863b31d82c8d7e5d45ac
 DIST async-2.2.1.tar.gz 75671 BLAKE2B 
a652bbb99d49c569fd864015059391a013f35c888be1e3b32ae06900bb861274390543c64ac9687689cb012c9b4c82df7764e4aaa50d2e76b595fdc7736ec8f5
 SHA512 
329862fa30f56371092666bef199b949e6325d99696a7ef2029cf9524a5cea31fc361cfaf438e15731c8e09c06ca47261fd3fcdce306a464332def9897c8dec5
 DIST async-2.5.0.tar.gz 84307 BLAKE2B 
0aa9042e6e63087c08def6a5bd66f51565addaf8caf1db3ce5cc94afd397e164dfd0e7af40d4f55d05b0bb08cec3c98dc89b5e4345ff053f06617a8ba6a9b0c8
 SHA512 
caa16d07b2863f236bdd31fc87aa29216a5e32c8182a6e6bf9fd5203cd223350bb1746be02a617f8930c31f2941ce4204f01c5f2fd902c215a1898192afd01c3

diff --git a/dev-ruby/async/async-1.31.0.ebuild 
b/dev-ruby/async/async-1.31.0.ebuild
new file mode 100644
index 000000000000..dc72364d8657
--- /dev/null
+++ b/dev-ruby/async/async-1.31.0.ebuild
@@ -0,0 +1,44 @@
+# Copyright 2022-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+USE_RUBY="ruby27 ruby30 ruby31"
+
+RUBY_FAKEGEM_RECIPE_TEST="rspec3"
+RUBY_FAKEGEM_EXTRADOC="README.md"
+RUBY_FAKEGEM_GEMSPEC="${PN}.gemspec"
+
+inherit ruby-fakegem
+
+DESCRIPTION="A concurrency framework for Ruby"
+HOMEPAGE="https://github.com/socketry/async";
+SRC_URI="https://github.com/socketry/async/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="$(ver_cut 1)"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE=""
+
+ruby_add_rdepend ">=dev-ruby/console-1.10:1
+       >=dev-ruby/nio4r-2.3:2
+       >=dev-ruby/timers-4.1:4"
+
+ruby_add_bdepend "test? (
+       >=dev-ruby/async-rspec-1.1:1
+       dev-ruby/benchmark-ips
+)"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-improve-robustness-test.patch
+)
+
+all_ruby_prepare() {
+       sed -i -E 's/require_relative "(.+)"/require File.expand_path("\1")/g' 
"${RUBY_FAKEGEM_GEMSPEC}" || die
+
+       # Avoid network tests
+       sed -i -e '/can fetch website using Net::HTTP/askip "requires network"' 
spec/async/scheduler_spec.rb || die
+
+       # Avoid test dependency on unpackaged covered
+       sed -i -e '/covered/ s:^:#:' spec/spec_helper.rb || die
+}

diff --git a/dev-ruby/async/files/async-1.31.0-improve-robustness-test.patch 
b/dev-ruby/async/files/async-1.31.0-improve-robustness-test.patch
new file mode 100644
index 000000000000..240fe060e224
--- /dev/null
+++ b/dev-ruby/async/files/async-1.31.0-improve-robustness-test.patch
@@ -0,0 +1,49 @@
+https://github.com/socketry/async/commit/8f590415c08943372e0227f01d3c32e92dbcbed0
+https://github.com/socketry/async/issues/218
+
+From 8f590415c08943372e0227f01d3c32e92dbcbed0 Mon Sep 17 00:00:00 2001
+From: Samuel Williams <samuel.willi...@oriontransfer.co.nz>
+Date: Sun, 12 Mar 2023 20:33:48 +1300
+Subject: [PATCH] Improve robustness of test, fixes #218.
+
+--- a/spec/async/semaphore_spec.rb
++++ b/spec/async/semaphore_spec.rb
+@@ -62,7 +62,7 @@
+                       3.times.map do |i|
+                               semaphore.async do |task|
+                                       order << i
+-                                      task.sleep(0.1)
++                                      task.yield
+                                       order << i
+                               end
+                       end.collect(&:result)
+@@ -72,17 +72,22 @@
+               
+               it 'allows tasks to execute concurrently' do
+                       semaphore = Async::Semaphore.new(3)
+-                      order = []
++                      concurrency = 0
++                      latch = Async::Condition.new
+                       
+                       3.times.map do |i|
+                               semaphore.async do |task|
+-                                      order << i
+-                                      task.sleep(0.1)
+-                                      order << i
++                                      concurrency += 1
++                                      
++                                      if concurrency == 3
++                                              latch.signal
++                                      else
++                                              latch.wait
++                                      end
+                               end
+-                      end.collect(&:result)
++                      end.each(&:wait)
+                       
+-                      expect(order).to be == [0, 1, 2, 0, 1, 2]
++                      expect(concurrency).to be == 3
+               end
+       end
+       
+

Reply via email to