1 |
commit: 319deed791230fa6ad3d6a7443d400e1caa7409b |
2 |
Author: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jan 28 06:55:19 2018 +0000 |
4 |
Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jan 28 06:55:19 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=319deed7 |
7 |
|
8 |
app-admin/puppet: fix puppetmaster with recent ruby |
9 |
|
10 |
Backport upstream fix to make puppetmaster work on |
11 |
ruby 2.3.6 and 2.4.3 again. |
12 |
|
13 |
Package-Manager: Portage-2.3.19, Repoman-2.3.6 |
14 |
|
15 |
app-admin/puppet/files/puppet-4-webrick-ruby.patch | 53 ++++++ |
16 |
app-admin/puppet/puppet-4.10.9-r1.ebuild | 199 +++++++++++++++++++++ |
17 |
2 files changed, 252 insertions(+) |
18 |
|
19 |
diff --git a/app-admin/puppet/files/puppet-4-webrick-ruby.patch b/app-admin/puppet/files/puppet-4-webrick-ruby.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..ce4b055644f |
22 |
--- /dev/null |
23 |
+++ b/app-admin/puppet/files/puppet-4-webrick-ruby.patch |
24 |
@@ -0,0 +1,53 @@ |
25 |
+From a358d5ec01c6f87b39e5bfbab7a35582624fdbf7 Mon Sep 17 00:00:00 2001 |
26 |
+From: Josh Cooper <josh@××××××.com> |
27 |
+Date: Fri, 12 Jan 2018 15:30:38 -0800 |
28 |
+Subject: [PATCH] (PUP-8297) Don't accept already connected socket |
29 |
+ |
30 |
+Webrick's start method yields an already connected socket, so it is not |
31 |
+necessary to call accept on the socket. In ruby versions prior to 2.3.6 and |
32 |
+2.4.3, the accept call was a noop. |
33 |
+ |
34 |
+In 2.3.6 and 2.4.3, it is an error, because ruby those versions use a |
35 |
+non-blocking accept to handle clients that make an TCP connection, but |
36 |
+are slow to negotiate the TLS handshake[1,2]. On these versions, puppet |
37 |
+master would report: |
38 |
+ |
39 |
+ SSL_accept returned=1 errno=0 state=unknown state: unexpected record |
40 |
+ |
41 |
+Remove the call to Socket#accept. |
42 |
+ |
43 |
+[1] https://bugs.ruby-lang.org/issues/14005 |
44 |
+[2] https://github.com/ruby/ruby/commit/2e728d51e70ed3756ad760c687a08b8487b0112f |
45 |
+--- |
46 |
+ lib/puppet/network/http/webrick.rb | 1 - |
47 |
+ spec/unit/network/http/webrick_spec.rb | 5 +++++ |
48 |
+ 2 files changed, 5 insertions(+), 1 deletion(-) |
49 |
+ |
50 |
+diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb |
51 |
+index 9ebf1763be5..3ac2ff40650 100644 |
52 |
+--- a/lib/puppet/network/http/webrick.rb |
53 |
++++ b/lib/puppet/network/http/webrick.rb |
54 |
+@@ -29,7 +29,6 @@ def listen(address, port) |
55 |
+ if ! IO.select([sock],nil,nil,timeout) |
56 |
+ raise "Client did not send data within %.1f seconds of connecting" % timeout |
57 |
+ end |
58 |
+- sock.accept |
59 |
+ @server.run(sock) |
60 |
+ end |
61 |
+ end |
62 |
+diff --git a/spec/unit/network/http/webrick_spec.rb b/spec/unit/network/http/webrick_spec.rb |
63 |
+index a90fc3f3378..843b0d54c8a 100644 |
64 |
+--- a/spec/unit/network/http/webrick_spec.rb |
65 |
++++ b/spec/unit/network/http/webrick_spec.rb |
66 |
+@@ -92,6 +92,11 @@ |
67 |
+ expect(server).to be_listening |
68 |
+ end |
69 |
+ |
70 |
++ it "is passed an already connected socket" do |
71 |
++ socket.expects(:accept).never |
72 |
++ server.listen(address, port) |
73 |
++ end |
74 |
++ |
75 |
+ describe "when the REST protocol is requested" do |
76 |
+ it "should register the REST handler at /" do |
77 |
+ # We don't care about the options here. |
78 |
|
79 |
diff --git a/app-admin/puppet/puppet-4.10.9-r1.ebuild b/app-admin/puppet/puppet-4.10.9-r1.ebuild |
80 |
new file mode 100644 |
81 |
index 00000000000..c404e787afc |
82 |
--- /dev/null |
83 |
+++ b/app-admin/puppet/puppet-4.10.9-r1.ebuild |
84 |
@@ -0,0 +1,199 @@ |
85 |
+# Copyright 1999-2018 Gentoo Foundation |
86 |
+# Distributed under the terms of the GNU General Public License v2 |
87 |
+ |
88 |
+EAPI="6" |
89 |
+ |
90 |
+USE_RUBY="ruby22 ruby23 ruby24" |
91 |
+ |
92 |
+#RUBY_FAKEGEM_RECIPE_TEST="rspec3" |
93 |
+ |
94 |
+RUBY_FAKEGEM_EXTRAINSTALL="locales" |
95 |
+ |
96 |
+inherit xemacs-elisp-common eutils user ruby-fakegem versionator |
97 |
+ |
98 |
+DESCRIPTION="A system automation and configuration management software." |
99 |
+HOMEPAGE="http://puppetlabs.com/" |
100 |
+SRC_URI="http://downloads.puppetlabs.com/puppet/${P}.tar.gz" |
101 |
+ |
102 |
+LICENSE="Apache-2.0 GPL-2" |
103 |
+SLOT="0" |
104 |
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86" |
105 |
+IUSE="augeas diff doc emacs experimental ldap rrdtool selinux shadow sqlite vim-syntax xemacs" |
106 |
+RESTRICT="test" |
107 |
+ |
108 |
+ruby_add_rdepend " |
109 |
+ >=dev-ruby/gettext-setup-0.10:0 |
110 |
+ >=dev-ruby/hiera-2.0 |
111 |
+ >=dev-ruby/locale-2.1 |
112 |
+ >=dev-ruby/rgen-0.6.5 |
113 |
+ dev-ruby/json:= |
114 |
+ >=dev-ruby/facter-3.0.0 |
115 |
+ augeas? ( dev-ruby/ruby-augeas ) |
116 |
+ diff? ( dev-ruby/diff-lcs ) |
117 |
+ doc? ( dev-ruby/rdoc ) |
118 |
+ ldap? ( dev-ruby/ruby-ldap ) |
119 |
+ shadow? ( dev-ruby/ruby-shadow ) |
120 |
+ sqlite? ( dev-ruby/sqlite3 ) |
121 |
+ virtual/ruby-ssl" |
122 |
+ |
123 |
+# ruby_add_bdepend " |
124 |
+# test? ( |
125 |
+# dev-ruby/mocha:0.14 |
126 |
+# =dev-ruby/rack-1* |
127 |
+# dev-ruby/rspec-its |
128 |
+# dev-ruby/rspec-collection_matchers |
129 |
+# >=dev-ruby/vcr-2.9:2 |
130 |
+# >=dev-ruby/webmock-1.24:0 |
131 |
+# )" |
132 |
+ |
133 |
+DEPEND+=" ${DEPEND} |
134 |
+ xemacs? ( app-editors/xemacs )" |
135 |
+RDEPEND+=" ${RDEPEND} |
136 |
+ rrdtool? ( >=net-analyzer/rrdtool-1.2.23[ruby] ) |
137 |
+ selinux? ( |
138 |
+ sys-libs/libselinux[ruby] |
139 |
+ sec-policy/selinux-puppet |
140 |
+ ) |
141 |
+ vim-syntax? ( >=app-vim/puppet-syntax-3.0.1 ) |
142 |
+ >=app-portage/eix-0.18.0" |
143 |
+PDEPEND="emacs? ( >=app-emacs/puppet-mode-0.3-r1 )" |
144 |
+ |
145 |
+SITEFILE="50${PN}-mode-gentoo.el" |
146 |
+ |
147 |
+pkg_setup() { |
148 |
+ enewgroup puppet |
149 |
+ enewuser puppet -1 -1 /var/lib/puppet puppet |
150 |
+} |
151 |
+ |
152 |
+all_ruby_prepare() { |
153 |
+ # Avoid spec that require unpackaged json-schema. |
154 |
+ rm spec/lib/matchers/json.rb $( grep -Rl matchers/json spec) || die |
155 |
+ |
156 |
+ # can't be run within portage. |
157 |
+ epatch "${FILESDIR}/puppet-fix-tests-4.7.0.patch" |
158 |
+ |
159 |
+ # fix systemd path |
160 |
+ epatch "${FILESDIR}/puppet-systemd.patch" |
161 |
+ |
162 |
+ if use experimental; then |
163 |
+ epatch "${FILESDIR}/43e2c935252b995134ce353e5e6312cf77aea480.patch" |
164 |
+ fi |
165 |
+ |
166 |
+ # fix compatibility with ruby 2.3.6/2.4.3 webrick |
167 |
+ epatch "${FILESDIR}/puppet-4-webrick-ruby.patch" |
168 |
+ |
169 |
+ # Use working version of mocha |
170 |
+ sed -i -e '1igem "mocha", "~>0.14.0"; gem "rack", "~>1.0"' spec/spec_helper.rb || die |
171 |
+ |
172 |
+ # Avoid specs that can only run in the puppet.git repository. This |
173 |
+ # should be narrowed down to the specific specs. |
174 |
+ rm spec/integration/parser/compiler_spec.rb || die |
175 |
+ |
176 |
+ # Avoid failing specs that need further investigation. |
177 |
+ sed -i -e '/should resolve external facts/,/^ end/ s:^:#:' \ |
178 |
+ spec/integration/indirector/facts/facter_spec.rb || die |
179 |
+ sed -i -e "/describe 'cfacter'/,/^ end/ s:^:#:" spec/unit/defaults_spec.rb || die |
180 |
+ rm -f spec/unit/indirector/ldap_spec.rb \ |
181 |
+ spec/unit/parser/functions/create_resources_spec.rb || die |
182 |
+ |
183 |
+ # Avoid specs that rely on tools from other OSs |
184 |
+ rm -f spec/unit/provider/package/{dnf,tdnf,yum}_spec.rb \ |
185 |
+ spec/unit/provider/user/directoryservice_spec.rb || die |
186 |
+ |
187 |
+ # Avoid specs that depend on hiera-eyaml to avoid circular |
188 |
+ # dependencies |
189 |
+ rm -f spec/unit/functions/lookup_spec.rb || die |
190 |
+ |
191 |
+ # Avoid specs that fail due to an unpackaged file |
192 |
+ sed -i -e '/when loading pp resource types using auto loading/,/^ end/ s:^:#:' spec/unit/pops/loaders/loaders_spec.rb || die |
193 |
+} |
194 |
+ |
195 |
+all_ruby_compile() { |
196 |
+ if use xemacs ; then |
197 |
+ # Create a separate version for xemacs to be able to install |
198 |
+ # emacs and xemacs in parallel. |
199 |
+ mkdir ext/xemacs |
200 |
+ cp ext/emacs/* ext/xemacs/ |
201 |
+ xemacs-elisp-compile ext/xemacs/puppet-mode.el |
202 |
+ fi |
203 |
+} |
204 |
+ |
205 |
+each_ruby_install() { |
206 |
+ each_fakegem_install |
207 |
+# dosym "/usr/$(get_libdir)/ruby/gems/$(ruby_get_version)/gems/${P}" "/usr/$(get_libdir)/ruby/gems/$(ruby_get_version)/gems/${PN}" |
208 |
+} |
209 |
+ |
210 |
+all_ruby_install() { |
211 |
+ all_fakegem_install |
212 |
+ |
213 |
+ # systemd stuffs |
214 |
+ insinto /usr/lib/systemd/system |
215 |
+ doins "${WORKDIR}/all/${P}/ext/systemd/puppet.service" |
216 |
+ |
217 |
+ # tmpfiles stuff |
218 |
+ insinto /usr/lib/tmpfiles.d |
219 |
+ newins "${FILESDIR}/tmpfiles.d" "puppet.conf" |
220 |
+ |
221 |
+ # openrc init stuff |
222 |
+ newinitd "${FILESDIR}"/puppet.init-4.x puppet |
223 |
+ newinitd "${FILESDIR}"/puppetmaster.init-4.x puppetmaster |
224 |
+ newconfd "${FILESDIR}"/puppetmaster.confd puppetmaster |
225 |
+ |
226 |
+ keepdir /etc/puppetlabs/puppet/ssl |
227 |
+ |
228 |
+ keepdir /var/lib/puppet/facts |
229 |
+ keepdir /var/lib/puppet/files |
230 |
+ fowners -R puppet:puppet /var/lib/puppet |
231 |
+ |
232 |
+ fperms 0750 /var/lib/puppet |
233 |
+ |
234 |
+ fperms 0750 /etc/puppetlabs |
235 |
+ fperms 0750 /etc/puppetlabs/puppet |
236 |
+ fperms 0750 /etc/puppetlabs/puppet/ssl |
237 |
+ fowners -R :puppet /etc/puppetlabs |
238 |
+ fowners -R :puppet /var/lib/puppet |
239 |
+ |
240 |
+ if use xemacs ; then |
241 |
+ xemacs-elisp-install ${PN} ext/xemacs/puppet-mode.el* |
242 |
+ xemacs-elisp-site-file-install "${FILESDIR}/${SITEFILE}" |
243 |
+ fi |
244 |
+ |
245 |
+ if use ldap ; then |
246 |
+ insinto /etc/openldap/schema; doins ext/ldap/puppet.schema |
247 |
+ fi |
248 |
+ |
249 |
+ # ext and examples files |
250 |
+ for f in $(find ext examples -type f) ; do |
251 |
+ docinto "$(dirname ${f})"; dodoc "${f}" |
252 |
+ done |
253 |
+} |
254 |
+ |
255 |
+pkg_postinst() { |
256 |
+ elog |
257 |
+ elog "Please, *don't* include the --ask option in EMERGE_EXTRA_OPTS as this could" |
258 |
+ elog "cause puppet to hang while installing packages." |
259 |
+ elog |
260 |
+ elog "Portage Puppet module with Gentoo-specific resources:" |
261 |
+ elog "http://forge.puppetlabs.com/gentoo/portage" |
262 |
+ elog |
263 |
+ |
264 |
+ local v |
265 |
+ for v in ${REPLACING_VERSIONS}; do |
266 |
+ if [ "$(get_major_version $v)" = "3" ]; then |
267 |
+ elog |
268 |
+ elog "If you're upgrading from 3.x then please move everything in /etc/puppet to" |
269 |
+ elog "/etc/puppetlabs/puppet" |
270 |
+ elog "Also, puppet now uses config directories for modules and manifests." |
271 |
+ elog "See https://docs.puppetlabs.com/puppet/4.0/reference/upgrade_agent.html" |
272 |
+ elog "and https://docs.puppetlabs.com/puppet/4.0/reference/upgrade_server.html" |
273 |
+ elog "for more information." |
274 |
+ elog |
275 |
+ fi |
276 |
+ done |
277 |
+ |
278 |
+ use xemacs && xemacs-elisp-site-regen |
279 |
+} |
280 |
+ |
281 |
+pkg_postrm() { |
282 |
+ use xemacs && xemacs-elisp-site-regen |
283 |
+} |