Gentoo Archives: gentoo-commits

From: "Manuel Rüger" <mrueg@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, 04 May 2016 13:31:23
Message-Id: 1462368589.14dae191e1885e3dff62be4ec912e85b8b0c691e.mrueg@gentoo
1 commit: 14dae191e1885e3dff62be4ec912e85b8b0c691e
2 Author: Manuel Rüger <mrueg <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 4 13:29:49 2016 +0000
4 Commit: Manuel Rüger <mrueg <AT> gentoo <DOT> org>
5 CommitDate: Wed May 4 13:29:49 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14dae191
7
8 www-servers/thin: Use openrc-run instead of runscript
9
10 Package-Manager: portage-2.2.28
11
12 www-servers/thin/files/thin.initd-r4 | 88 +++++++++++++++++++++++++++++++++++
13 www-servers/thin/thin-1.6.4-r2.ebuild | 84 +++++++++++++++++++++++++++++++++
14 2 files changed, 172 insertions(+)
15
16 diff --git a/www-servers/thin/files/thin.initd-r4 b/www-servers/thin/files/thin.initd-r4
17 new file mode 100644
18 index 0000000..0b82884
19 --- /dev/null
20 +++ b/www-servers/thin/files/thin.initd-r4
21 @@ -0,0 +1,88 @@
22 +#!/sbin/openrc-run
23 +# Copyright 1999-2016 Gentoo Foundation
24 +# Distributed under the terms of the GNU General Public License v2
25 +# $Id$
26 +
27 +SERVER=${SVCNAME#*.}
28 +if [ ${SERVER} != thin ]; then
29 + CONFIG=${CONFIG:-/etc/thin/${SERVER}.yml}
30 +else
31 + CONFIG=${CONFIG:-/etc/thin/}
32 +fi
33 +NOCONFIG=${NOCONFIG:-0}
34 +RUBY=${RUBY:-/usr/bin/ruby}
35 +DO_BUNDLER=${DO_BUNDLER:-0}
36 +CHDIR=${CHDIR:-}
37 +THIN_USER=${THIN_USER:-root}
38 +THIN_GROUP=${THIN_GROUP:-root}
39 +THIN_PID=${THIN_PID:-/var/run/thin/thin.pid}
40 +THIN_OPTS=${THIN_OPTS:-}
41 +
42 +depend() {
43 + need localmount
44 +}
45 +
46 +checkconfig() {
47 + if [ -n ${CHDIR} ]; then
48 + cd "${CHDIR}"
49 +
50 + if [ $? -ne 0 ]; then
51 + eerror "Cannot cd into requested directory"
52 + return 1
53 + fi
54 + fi
55 +
56 + [ ${SERVER} = thin -o ${NOCONFIG} != 0 ] && return 0
57 +
58 + if [ ! -f ${CONFIG} ]; then
59 + eerror "Unable to find the server configuration."
60 + eerror "Please set the CONFIG variable in /etc/conf.d/${SVCNAME} or"
61 + eerror "set NOCONFIG there to 1 to disable looking for a config file."
62 + return 1
63 + fi
64 +}
65 +
66 +buildargs() {
67 + if [ ${NOCONFIG} = 0 -a ${SERVER} != thin ]; then
68 + echo -n "-C ${CONFIG} "
69 + fi
70 +
71 + echo -n "${THIN_OPTS}"
72 +}
73 +
74 +action() {
75 + checkconfig || return 1
76 +
77 + [ ${DO_BUNDLER} -ne 0 ] && RUBY="${RUBY} /usr/bin/bundle exec"
78 +
79 + if [ ${SERVER} = thin ]; then
80 + ebegin "$2 all thin servers in ${CONFIG}"
81 + ${RUBY} /usr/bin/thin $1 $(buildargs) --all ${CONFIG}
82 + eend $?
83 + else
84 + ebegin "$2 thin server ${SERVER}"
85 + ${RUBY} /usr/bin/thin $(buildargs) --tag ${SERVER} $1
86 + eend $?
87 + fi
88 +}
89 +
90 +start() {
91 + action start 'Starting'
92 +}
93 +
94 +stop() {
95 + action stop 'Stopping'
96 +}
97 +
98 +restart() {
99 + action restart 'Restarting'
100 +}
101 +
102 +start_pre() {
103 + # If the path to the pidfile is /var/run/thin/foo/thin.pid
104 + # then checkpath will fail if /var/run/thin/ does not exist.
105 + # This caught infra...
106 + d=$(dirname ${THIN_PID})
107 + mkdir -p "$d"
108 + checkpath -d -m 0775 -o ${THIN_USER}:${THIN_GROUP} "$d"
109 +}
110
111 diff --git a/www-servers/thin/thin-1.6.4-r2.ebuild b/www-servers/thin/thin-1.6.4-r2.ebuild
112 new file mode 100644
113 index 0000000..9efac81
114 --- /dev/null
115 +++ b/www-servers/thin/thin-1.6.4-r2.ebuild
116 @@ -0,0 +1,84 @@
117 +# Copyright 1999-2016 Gentoo Foundation
118 +# Distributed under the terms of the GNU General Public License v2
119 +# $Id$
120 +
121 +EAPI=5
122 +
123 +USE_RUBY="ruby20 ruby21"
124 +
125 +RUBY_FAKEGEM_TASK_TEST="spec:main spec:group:0 spec:group:1 spec:group:2"
126 +
127 +RUBY_FAKEGEM_GEMSPEC="${PN}.gemspec"
128 +
129 +inherit ruby-fakegem
130 +
131 +DESCRIPTION="A fast and very simple Ruby web server"
132 +HOMEPAGE="http://code.macournoyer.com/thin/"
133 +SRC_URI="https://github.com/macournoyer/thin/archive/v${PV}.tar.gz -> ${P}.tar.gz"
134 +
135 +LICENSE="Ruby"
136 +SLOT="0"
137 +KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
138 +IUSE="doc test"
139 +
140 +DEPEND="${DEPEND}
141 + dev-util/ragel"
142 +RDEPEND="${RDEPEND}"
143 +
144 +# The runtime dependencies are used at build-time as well since the
145 +# Rakefile loads thin!
146 +mydeps=">=dev-ruby/daemons-1.0.9
147 + >=dev-ruby/rack-1.0.0:*
148 + >=dev-ruby/eventmachine-1.0.4:0
149 + virtual/ruby-ssl"
150 +
151 +ruby_add_rdepend "${mydeps}"
152 +ruby_add_bdepend "${mydeps}
153 + dev-ruby/rake-compiler
154 + test? ( dev-ruby/rspec:0 )"
155 +
156 +all_ruby_prepare() {
157 + # Fix Ragel-based parser generation (uses a *very* old syntax that
158 + # is not supported in Gentoo)
159 + sed -i -e 's: | rlgen-cd::' Rakefile || die
160 +
161 + # Fix specs' dependencies so that the extension is not rebuilt
162 + # when running tests
163 + sed -i -e '/:spec =>/s:^:#:' tasks/spec.rake || die
164 +
165 + # Fix rspec version to allow newer 1.x versions
166 + sed -i -e '/gem "rspec"/ s/1.2.9/1.0/' tasks/spec.rake spec/spec_helper.rb || die
167 +
168 + # Avoid CLEAN since it may not be available and we don't need it.
169 + sed -i -e '/CLEAN/ s:^:#:' tasks/*.rake || die
170 +
171 + # Disable a test that is known for freezing the testsuite,
172 + # reported upstream. In thin 1.5.1 this just fails.
173 + sed -i \
174 + -e '/should force kill process in pid file/,/^ end/ s:^:#:' \
175 + spec/daemonizing_spec.rb || die
176 +
177 + # nasty but too complex to fix up for now :(
178 + use doc || rm tasks/rdoc.rake
179 + use test || rm tasks/spec.rake
180 +}
181 +
182 +each_ruby_compile() {
183 + ${RUBY} -S rake compile || die "rake compile failed"
184 +}
185 +
186 +all_ruby_install() {
187 + all_fakegem_install
188 +
189 + keepdir /etc/thin
190 + newinitd "${FILESDIR}"/${PN}.initd-r4 ${PN}
191 + newconfd "${FILESDIR}"/${PN}.confd-2 ${PN}
192 +
193 + einfo
194 + elog "Thin is now shipped with init scripts."
195 + elog "The default script (/etc/init.d/thin) will start all servers that have"
196 + elog "configuration files in /etc/thin/. You can symlink the init script to"
197 + elog "files of the format 'thin.SERVER' to be able to start individual servers."
198 + elog "See /etc/conf.d/thin for more configuration options."
199 + einfo
200 +}