1 |
commit: 657fe39493c136eb4cc66121f4b15cd6adbf84cb |
2 |
Author: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Apr 29 18:15:44 2019 +0000 |
4 |
Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Apr 29 18:33:35 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=657fe394 |
7 |
|
8 |
www-servers/puma: add ruby26 |
9 |
|
10 |
Backport upstream patch to fix compatibility with ruby 2.6. |
11 |
|
12 |
Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org> |
13 |
Package-Manager: Portage-2.3.62, Repoman-2.3.11 |
14 |
|
15 |
.../puma/files/puma-3.12.1-ruby26-waitpid.patch | 47 +++++++++++++++ |
16 |
www-servers/puma/puma-3.12.1-r1.ebuild | 69 ++++++++++++++++++++++ |
17 |
2 files changed, 116 insertions(+) |
18 |
|
19 |
diff --git a/www-servers/puma/files/puma-3.12.1-ruby26-waitpid.patch b/www-servers/puma/files/puma-3.12.1-ruby26-waitpid.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..b28c69fa4d4 |
22 |
--- /dev/null |
23 |
+++ b/www-servers/puma/files/puma-3.12.1-ruby26-waitpid.patch |
24 |
@@ -0,0 +1,47 @@ |
25 |
+From b94c3e34faff024a5b1930af36e4d64bd6dde57f Mon Sep 17 00:00:00 2001 |
26 |
+From: MSP-Greg <MSP-Greg@××××××××××××××××××××.com> |
27 |
+Date: Fri, 15 Mar 2019 17:26:20 -0500 |
28 |
+Subject: [PATCH] Puma::Cluster#stop_workers - use WNOHANG with nil return |
29 |
+ tests |
30 |
+ |
31 |
+Ruby 2.6 introduced a bug that affects worker shutdown (waitpid). |
32 |
+ |
33 |
+Added code using Process::WNOHANG along with needed logic. Adds worker status (via $?) and total shutdown time to log. |
34 |
+ |
35 |
+Co-authored-by: MSP-Greg <greg.mpls@×××××.com> |
36 |
+Co-authored-by: guilleiguaran <guilleiguaran@×××××.com> |
37 |
+--- |
38 |
+ lib/puma/cluster.rb | 20 +++++++++++++++++++- |
39 |
+ 1 file changed, 19 insertions(+), 1 deletion(-) |
40 |
+ |
41 |
+diff --git a/lib/puma/cluster.rb b/lib/puma/cluster.rb |
42 |
+index 93d65131..0879c96c 100644 |
43 |
+--- a/lib/puma/cluster.rb |
44 |
++++ b/lib/puma/cluster.rb |
45 |
+@@ -37,7 +37,25 @@ def stop_workers |
46 |
+ @workers.each { |x| x.term } |
47 |
+ |
48 |
+ begin |
49 |
+- @workers.each { |w| Process.waitpid(w.pid) } |
50 |
++ if RUBY_VERSION < '2.6' |
51 |
++ @workers.each { |w| Process.waitpid(w.pid) } |
52 |
++ else |
53 |
++ # below code is for a bug in Ruby 2.6+, above waitpid call hangs |
54 |
++ t_st = Process.clock_gettime(Process::CLOCK_MONOTONIC) |
55 |
++ pids = @workers.map(&:pid) |
56 |
++ loop do |
57 |
++ pids.reject! do |w_pid| |
58 |
++ if Process.waitpid(w_pid, Process::WNOHANG) |
59 |
++ log " worker status: #{$?}" |
60 |
++ true |
61 |
++ end |
62 |
++ end |
63 |
++ break if pids.empty? |
64 |
++ sleep 0.5 |
65 |
++ end |
66 |
++ t_end = Process.clock_gettime(Process::CLOCK_MONOTONIC) |
67 |
++ log format(" worker shutdown time: %6.2f", t_end - t_st) |
68 |
++ end |
69 |
+ rescue Interrupt |
70 |
+ log "! Cancelled waiting for workers" |
71 |
+ end |
72 |
|
73 |
diff --git a/www-servers/puma/puma-3.12.1-r1.ebuild b/www-servers/puma/puma-3.12.1-r1.ebuild |
74 |
new file mode 100644 |
75 |
index 00000000000..4c27201eb9d |
76 |
--- /dev/null |
77 |
+++ b/www-servers/puma/puma-3.12.1-r1.ebuild |
78 |
@@ -0,0 +1,69 @@ |
79 |
+# Copyright 1999-2019 Gentoo Authors |
80 |
+# Distributed under the terms of the GNU General Public License v2 |
81 |
+ |
82 |
+EAPI=6 |
83 |
+ |
84 |
+USE_RUBY="ruby24 ruby25 ruby26" |
85 |
+ |
86 |
+RUBY_FAKEGEM_RECIPE_DOC="rdoc" |
87 |
+ |
88 |
+inherit multilib ruby-fakegem |
89 |
+ |
90 |
+DESCRIPTION="a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack" |
91 |
+HOMEPAGE="https://puma.io/" |
92 |
+SRC_URI="https://github.com/puma/puma/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
93 |
+ |
94 |
+LICENSE="BSD" |
95 |
+SLOT="3" |
96 |
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86" |
97 |
+IUSE="" |
98 |
+ |
99 |
+DEPEND+=" dev-libs/openssl:0 test? ( net-misc/curl )" |
100 |
+RDEPEND+=" dev-libs/openssl:0" |
101 |
+ |
102 |
+ruby_add_bdepend "virtual/ruby-ssl |
103 |
+ test? ( dev-ruby/rack >=dev-ruby/minitest-5.9:5 >=dev-ruby/test-unit-3.0:2 )" |
104 |
+ |
105 |
+all_ruby_prepare() { |
106 |
+ eapply "${FILESDIR}/${P}-ruby26-waitpid.patch" |
107 |
+ |
108 |
+ sed -i -e '/bundler/ s:^:#:' test/helper.rb || die |
109 |
+ |
110 |
+ # Avoid test failing inconsistently |
111 |
+ sed -i -e '/phased_restart_via_pumactl/,/^ end/ s:^:#:' test/test_integration.rb || die |
112 |
+ |
113 |
+ # Avoid test that trigger a bug in ruby very easily and lead to |
114 |
+ # failure. This affects all current puma versions in combination |
115 |
+ # with the latest ruby versions, so we add this new version anyway |
116 |
+ # while allowing these tests to fail. |
117 |
+ # https://github.com/puma/puma/pull/1345 |
118 |
+ rm -f test/test_puma_server_ssl.rb || die |
119 |
+ |
120 |
+ # Use correct ruby version |
121 |
+ sed -i -e 's/ruby -rrubygems/#{Gem.ruby} -rrubygems/' test/shell/t{1,3}.rb || die |
122 |
+} |
123 |
+ |
124 |
+each_ruby_prepare() { |
125 |
+ sed -i -e 's:ruby -rubygems:'${RUBY}' -rubygems:' \ |
126 |
+ -e 's/localhost/127.0.0.1/' test/shell/* || die |
127 |
+ sed -i -e '1ilog_requests' test/shell/t{1,2}_conf.rb || die |
128 |
+} |
129 |
+ |
130 |
+each_ruby_configure() { |
131 |
+ ${RUBY} -Cext/puma_http11 extconf.rb || die |
132 |
+} |
133 |
+ |
134 |
+each_ruby_compile() { |
135 |
+ emake V=1 -Cext/puma_http11 |
136 |
+ cp ext/puma_http11/puma_http11$(get_modname) lib/puma/ || die |
137 |
+} |
138 |
+ |
139 |
+each_ruby_test() { |
140 |
+ einfo "Running test suite" |
141 |
+ ${RUBY} -Ilib:.:test -e "gem 'minitest', '~>5.9'; gem 'test-unit', '~>3.0'; require 'minitest/autorun'; Dir['test/**/*test_*.rb'].each{|f| require f}" || die |
142 |
+ |
143 |
+ einfo "Running integration tests" |
144 |
+ pushd test/shell |
145 |
+ #sh run.sh || die |
146 |
+ popd |
147 |
+} |