Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/thin/, www-servers/thin/files/
Date: Wed, 01 Sep 2021 22:46:08
Message-Id: 1630536360.a6c02ef72c512b3d54a9af7e5fa7429f84f593d9.robbat2@gentoo
1 commit: a6c02ef72c512b3d54a9af7e5fa7429f84f593d9
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 1 21:27:56 2021 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 1 22:46:00 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6c02ef7
7
8 www-servers/thin: upstream supports thin again
9
10 Merged from infra overlay.
11
12 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
13
14 www-servers/thin/Manifest | 2 +
15 www-servers/thin/files/thin.confd-2 | 43 ++++++++++++++++++
16 www-servers/thin/files/thin.initd-r4 | 88 ++++++++++++++++++++++++++++++++++++
17 www-servers/thin/metadata.xml | 16 +++++++
18 www-servers/thin/thin-1.8.1.ebuild | 88 ++++++++++++++++++++++++++++++++++++
19 5 files changed, 237 insertions(+)
20
21 diff --git a/www-servers/thin/Manifest b/www-servers/thin/Manifest
22 new file mode 100644
23 index 00000000000..b09108e30fd
24 --- /dev/null
25 +++ b/www-servers/thin/Manifest
26 @@ -0,0 +1,2 @@
27 +DIST thin-1.7.2.tar.gz 180169 BLAKE2B fe902b76cbffbad739327754c14dcc46372d412c607f852a4f52554ec8e41e38a07f211c28751b3528fd53c7eb30eb0f8130e3bc0877996187a3d755ccfbc17f SHA512 2c3c831eed4444d42fc88fc2c46e557284748b6b6bf331d6fd827073918cc3a869e5a60bf7db19ba82add28e07c8a8c92dac609a56cda82b41b37ddfb247e7bf
28 +DIST thin-1.8.1.tar.gz 181377 BLAKE2B 883a35d60d5845defa1f20a85b90269838a1b1ebeb4d4f32561af061cdac05b545c254fe65cca828ccfed033ad934ad3b72f1795407734d3b377a6022b57397f SHA512 221ef0c0369c449f2ca121c435ffebed318d6179a3b5d52e24d2bd80212df9cac35db39d156275c915c24550f6d8ded9f29616785d0a38e85cd13a1702e31298
29
30 diff --git a/www-servers/thin/files/thin.confd-2 b/www-servers/thin/files/thin.confd-2
31 new file mode 100644
32 index 00000000000..a5e5da829e1
33 --- /dev/null
34 +++ b/www-servers/thin/files/thin.confd-2
35 @@ -0,0 +1,43 @@
36 +# /etc/conf.d/thin: Configuration for /etc/init.d/thin*
37 +# Copy this file to /etc/conf.d/thin.SERVERNAME for server specific options.
38 +
39 +# Set the configuration file location.
40 +# In start-all mode (/etc/init.d/thin), this must point to the directory where
41 +# all the thin configurations are located.
42 +# When starting a specific server (/etc/init.d/thin.SERVER), point to the exact
43 +# location of the .yml configuration file.
44 +# CONFIG="/etc/thin/${SVCNAME#*.}.yml"
45 +
46 +# Disable looking for a configuration file.
47 +# You can use THIN_OPTS instead for setting command line options.
48 +# NOCONFIG=0
49 +
50 +# Set the Ruby interpreter to use.
51 +# RUBY="/usr/bin/ruby"
52 +
53 +# Whether to start thin using `bundle exec'
54 +# DO_BUNDLER=0
55 +
56 +# What directory to cd into before starting thin
57 +# (useful for DO_BUNDLER)
58 +# CHDIR=
59 +
60 +# Set the user for this instance.
61 +# (Should mirror "user" value in /etc/thin/${SVCNAME#*.}.yml)
62 +# THIN_USER=
63 +
64 +# Set the group for this instance.
65 +# (Should mirror "group" value in /etc/thin/${SVCNAME#*.}.yml)
66 +# THIN_GROUP=
67 +
68 +# Set the pidfile for this instance.
69 +# (Should mirror "pid" value in /etc/thin/${SVCNAME#*.}.yml)
70 +# THIN_PID=
71 +
72 +# Set command line options to pass to thin.
73 +# In specific server mode, '--tag SERVER_NAME' is automatically appended.
74 +# THIN_OPTS=
75 +
76 +# Thin binary
77 +# THIN=thin # use bundled thin
78 +# THIN=usr/bin/thin # use system thin
79
80 diff --git a/www-servers/thin/files/thin.initd-r4 b/www-servers/thin/files/thin.initd-r4
81 new file mode 100644
82 index 00000000000..960d100b596
83 --- /dev/null
84 +++ b/www-servers/thin/files/thin.initd-r4
85 @@ -0,0 +1,88 @@
86 +#!/sbin/openrc-run
87 +# Copyright 1999-2019 Gentoo Authors
88 +# Distributed under the terms of the GNU General Public License v2
89 +
90 +SERVER=${SVCNAME#*.}
91 +if [ ${SERVER} != thin ]; then
92 + CONFIG=${CONFIG:-/etc/thin/${SERVER}.yml}
93 +else
94 + CONFIG=${CONFIG:-/etc/thin/}
95 +fi
96 +NOCONFIG=${NOCONFIG:-0}
97 +RUBY=${RUBY:-/usr/bin/ruby}
98 +DO_BUNDLER=${DO_BUNDLER:-0}
99 +CHDIR=${CHDIR:-}
100 +THIN=${THIN:-/usr/bin/thin}
101 +THIN_USER=${THIN_USER:-root}
102 +THIN_GROUP=${THIN_GROUP:-root}
103 +THIN_PID=${THIN_PID:-/var/run/thin/thin.pid}
104 +THIN_OPTS=${THIN_OPTS:-}
105 +
106 +depend() {
107 + need localmount
108 +}
109 +
110 +checkconfig() {
111 + if [ -n ${CHDIR} ]; then
112 + cd "${CHDIR}"
113 +
114 + if [ $? -ne 0 ]; then
115 + eerror "Cannot cd into requested directory"
116 + return 1
117 + fi
118 + fi
119 +
120 + [ ${SERVER} = thin -o ${NOCONFIG} != 0 ] && return 0
121 +
122 + if [ ! -f ${CONFIG} ]; then
123 + eerror "Unable to find the server configuration."
124 + eerror "Please set the CONFIG variable in /etc/conf.d/${SVCNAME} or"
125 + eerror "set NOCONFIG there to 1 to disable looking for a config file."
126 + return 1
127 + fi
128 +}
129 +
130 +buildargs() {
131 + if [ ${NOCONFIG} = 0 -a ${SERVER} != thin ]; then
132 + echo -n "-C ${CONFIG} "
133 + fi
134 +
135 + echo -n "${THIN_OPTS}"
136 +}
137 +
138 +action() {
139 + checkconfig || return 1
140 +
141 + [ ${DO_BUNDLER} -ne 0 ] && RUBY="${RUBY} /usr/bin/bundle exec"
142 +
143 + if [ ${SERVER} = thin ]; then
144 + ebegin "$2 all thin servers in ${CONFIG}"
145 + ${RUBY} ${THIN} $1 $(buildargs) --all ${CONFIG}
146 + eend $?
147 + else
148 + ebegin "$2 thin server ${SERVER}"
149 + ${RUBY} ${THIN} $(buildargs) --tag ${SERVER} $1
150 + eend $?
151 + fi
152 +}
153 +
154 +start() {
155 + action start 'Starting'
156 +}
157 +
158 +stop() {
159 + action stop 'Stopping'
160 +}
161 +
162 +restart() {
163 + action restart 'Restarting'
164 +}
165 +
166 +start_pre() {
167 + # If the path to the pidfile is /var/run/thin/foo/thin.pid
168 + # then checkpath will fail if /var/run/thin/ does not exist.
169 + # This caught infra...
170 + d=$(dirname ${THIN_PID})
171 + mkdir -p "$d"
172 + checkpath -d -m 0775 -o ${THIN_USER}:${THIN_GROUP} "$d"
173 +}
174
175 diff --git a/www-servers/thin/metadata.xml b/www-servers/thin/metadata.xml
176 new file mode 100644
177 index 00000000000..70ae99a48a2
178 --- /dev/null
179 +++ b/www-servers/thin/metadata.xml
180 @@ -0,0 +1,16 @@
181 +<?xml version="1.0" encoding="UTF-8"?>
182 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
183 +<pkgmetadata>
184 + <maintainer type="project">
185 + <email>ruby@g.o</email>
186 + <name>Gentoo Ruby Project</name>
187 + </maintainer>
188 + <longdescription>
189 +Thin is a very simple web server written in Ruby. It's single-threaded, which
190 +means it can only serve one request at a time. This simplicity affords increased
191 +speed and decreased memory usage for singled-threaded framework like Rails.
192 +</longdescription>
193 + <upstream>
194 + <remote-id type="github">macournoyer/thin</remote-id>
195 + </upstream>
196 +</pkgmetadata>
197
198 diff --git a/www-servers/thin/thin-1.8.1.ebuild b/www-servers/thin/thin-1.8.1.ebuild
199 new file mode 100644
200 index 00000000000..d9b781364f1
201 --- /dev/null
202 +++ b/www-servers/thin/thin-1.8.1.ebuild
203 @@ -0,0 +1,88 @@
204 +# Copyright 1999-2021 Gentoo Authors
205 +# Distributed under the terms of the GNU General Public License v2
206 +
207 +EAPI=7
208 +
209 +USE_RUBY="ruby25 ruby26"
210 +
211 +RUBY_FAKEGEM_RECIPE_TEST="rspec"
212 +RUBY_FAKEGEM_GEMSPEC="${PN}.gemspec"
213 +
214 +inherit ruby-fakegem
215 +
216 +DESCRIPTION="A fast and very simple Ruby web server"
217 +HOMEPAGE="http://code.macournoyer.com/thin/"
218 +SRC_URI="https://github.com/macournoyer/thin/archive/v${PV}.tar.gz -> ${P}.tar.gz"
219 +
220 +LICENSE="Ruby"
221 +SLOT="0"
222 +KEYWORDS="~amd64 ~ppc64 ~x86"
223 +IUSE="doc test"
224 +
225 +DEPEND="${DEPEND}
226 + dev-util/ragel"
227 +RDEPEND="${RDEPEND}"
228 +
229 +# The runtime dependencies are used at build-time as well since the
230 +# Rakefile loads thin!
231 +mydeps=">=dev-ruby/daemons-1.0.9
232 + >=dev-ruby/rack-1.0.0:* <dev-ruby/rack-3:*
233 + >=dev-ruby/eventmachine-1.0.4:0
234 + virtual/ruby-ssl"
235 +
236 +ruby_add_rdepend "${mydeps}"
237 +ruby_add_bdepend "${mydeps}
238 + dev-ruby/rake-compiler"
239 +
240 +all_ruby_prepare() {
241 + # Fix Ragel-based parser generation (uses a *very* old syntax that
242 + # is not supported in Gentoo)
243 + sed -i -e 's: | rlgen-cd::' Rakefile || die
244 +
245 + # Fix specs' dependencies so that the extension is not rebuilt
246 + # when running tests
247 + rm tasks/spec.rake || die
248 +
249 + # Fix rspec version to allow newer 2.x versions
250 + sed -i -e '/gem "rspec"/ s/1.2.9/2.0/' spec/spec_helper.rb || die
251 +
252 + # Avoid CLEAN since it may not be available and we don't need it.
253 + sed -i -e '/CLEAN/ s:^:#:' tasks/*.rake || die
254 +
255 + # Disable a test that is known for freezing the testsuite,
256 + # reported upstream. In thin 1.5.1 this just fails.
257 + sed -i \
258 + -e '/should force kill process in pid file/,/^ end/ s:^:#:' \
259 + spec/daemonizing_spec.rb || die
260 +
261 + sed -i \
262 + -e '/tracing routines (with NO custom logger)/,/^ end/ s:^:#:'\
263 + spec/logging_spec.rb || die
264 +
265 + find spec/perf -name "*_spec.rb" -exec \
266 + sed -i '/be_faster_then/ i \ pending' {} \;
267 +
268 + sed -i -e "s/Spec::Runner/Rspec/" spec/spec_helper.rb || die
269 + # nasty but too complex to fix up for now :(
270 + use doc || rm tasks/rdoc.rake
271 +}
272 +
273 +each_ruby_compile() {
274 + ${RUBY} -S rake compile || die "rake compile failed"
275 +}
276 +
277 +all_ruby_install() {
278 + all_fakegem_install
279 +
280 + keepdir /etc/thin
281 + newinitd "${FILESDIR}"/${PN}.initd-r4 ${PN}
282 + newconfd "${FILESDIR}"/${PN}.confd-2 ${PN}
283 +
284 + einfo
285 + elog "Thin is now shipped with init scripts."
286 + elog "The default script (/etc/init.d/thin) will start all servers that have"
287 + elog "configuration files in /etc/thin/. You can symlink the init script to"
288 + elog "files of the format 'thin.SERVER' to be able to start individual servers."
289 + elog "See /etc/conf.d/thin for more configuration options."
290 + einfo
291 +}