1 |
commit: ffd45776bb13d8ee7140fd5499413a7ffa873798 |
2 |
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Dec 9 06:17:53 2018 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 9 06:35:53 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ffd45776 |
7 |
|
8 |
sys-devel/distcc: improve init.d script, secure pidfile handling |
9 |
|
10 |
removed unneeded start/stop functions |
11 |
|
12 |
removed gcc spec/path loading, it's useless because |
13 |
path whitelist is handled by compiler-shadow and we no longer |
14 |
use gcc specs. |
15 |
|
16 |
pidfile is now owned by root and created by s-s-d |
17 |
pidfile path is now controlled by service name (/run/distccd.pid) |
18 |
initfile no longer runs chmod on pidfile and parent directory. |
19 |
|
20 |
Bug: https://bugs.gentoo.org/650854 |
21 |
Package-Manager: Portage-2.3.52, Repoman-2.3.12 |
22 |
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> |
23 |
|
24 |
sys-devel/distcc/distcc-3.3.2-r1.ebuild | 196 ++++++++++++++++++++++++++++++++ |
25 |
sys-devel/distcc/files/distccd.confd | 37 ++++++ |
26 |
sys-devel/distcc/files/distccd.initd | 13 +++ |
27 |
3 files changed, 246 insertions(+) |
28 |
|
29 |
diff --git a/sys-devel/distcc/distcc-3.3.2-r1.ebuild b/sys-devel/distcc/distcc-3.3.2-r1.ebuild |
30 |
new file mode 100644 |
31 |
index 00000000000..100daf4ce2c |
32 |
--- /dev/null |
33 |
+++ b/sys-devel/distcc/distcc-3.3.2-r1.ebuild |
34 |
@@ -0,0 +1,196 @@ |
35 |
+# Copyright 1999-2018 Gentoo Authors |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI=6 |
39 |
+ |
40 |
+PYTHON_COMPAT=( python3_{5,6} ) |
41 |
+ |
42 |
+inherit autotools flag-o-matic python-single-r1 systemd \ |
43 |
+ toolchain-funcs user xdg-utils prefix |
44 |
+ |
45 |
+DESCRIPTION="Distribute compilation of C code across several machines on a network" |
46 |
+HOMEPAGE="http://distcc.org/" |
47 |
+SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.gz" |
48 |
+ |
49 |
+LICENSE="GPL-2+" |
50 |
+SLOT="0" |
51 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" |
52 |
+IUSE="gnome gssapi gtk hardened ipv6 selinux xinetd zeroconf" |
53 |
+ |
54 |
+RESTRICT="test" |
55 |
+ |
56 |
+CDEPEND="${PYTHON_DEPS} |
57 |
+ dev-libs/popt |
58 |
+ gnome? ( |
59 |
+ >=gnome-base/libgnome-2 |
60 |
+ >=gnome-base/libgnomeui-2 |
61 |
+ x11-libs/gtk+:2 |
62 |
+ x11-libs/pango |
63 |
+ ) |
64 |
+ gssapi? ( net-libs/libgssglue ) |
65 |
+ gtk? ( x11-libs/gtk+:2 ) |
66 |
+ zeroconf? ( >=net-dns/avahi-0.6[dbus] ) |
67 |
+" |
68 |
+DEPEND="${CDEPEND} |
69 |
+ sys-libs/binutils-libs |
70 |
+ virtual/pkgconfig" |
71 |
+RDEPEND="${CDEPEND} |
72 |
+ !net-misc/pump |
73 |
+ dev-util/shadowman |
74 |
+ >=sys-devel/gcc-config-1.4.1 |
75 |
+ selinux? ( sec-policy/selinux-distcc ) |
76 |
+ xinetd? ( sys-apps/xinetd )" |
77 |
+ |
78 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
79 |
+ |
80 |
+S="${WORKDIR}/distcc" |
81 |
+ |
82 |
+pkg_setup() { |
83 |
+ enewuser distcc 240 -1 -1 daemon |
84 |
+ python-single-r1_pkg_setup |
85 |
+} |
86 |
+ |
87 |
+src_prepare() { |
88 |
+ eapply "${FILESDIR}/${PN}-3.0-xinetd.patch" |
89 |
+ # bug #255188 |
90 |
+ eapply "${FILESDIR}/${PN}-3.3.2-freedesktop.patch" |
91 |
+ # SOCKSv5 support needed for Portage, bug #537616 |
92 |
+ eapply "${FILESDIR}/${PN}-3.2_rc1-socks5.patch" |
93 |
+ eapply_user |
94 |
+ |
95 |
+ # Bugs #120001, #167844 and probably more. See patch for description. |
96 |
+ use hardened && eapply "${FILESDIR}/distcc-hardened.patch" |
97 |
+ |
98 |
+ sed -i \ |
99 |
+ -e "/PATH/s:\$distcc_location:${EPREFIX}/usr/lib/distcc/bin:" \ |
100 |
+ -e "s:@PYTHON@:${EPYTHON}:" \ |
101 |
+ pump.in || die "sed failed" |
102 |
+ |
103 |
+ sed \ |
104 |
+ -e "s:@EPREFIX@:${EPREFIX:-/}:" \ |
105 |
+ -e "s:@libdir@:/usr/lib:" \ |
106 |
+ "${FILESDIR}/3.2/distcc-config" > "${T}/distcc-config" || die |
107 |
+ |
108 |
+ hprefixify update-distcc-symlinks.py src/{serve,daemon}.c |
109 |
+ python_fix_shebang update-distcc-symlinks.py "${T}/distcc-config" |
110 |
+ eautoreconf |
111 |
+} |
112 |
+ |
113 |
+src_configure() { |
114 |
+ local myconf=( |
115 |
+ --disable-Werror |
116 |
+ $(use_enable ipv6 rfc2553) |
117 |
+ $(use_with gtk) |
118 |
+ $(use_with gnome) |
119 |
+ $(use_with gssapi auth) |
120 |
+ $(use_with zeroconf avahi) |
121 |
+ ) |
122 |
+ |
123 |
+ econf "${myconf[@]}" |
124 |
+} |
125 |
+ |
126 |
+src_install() { |
127 |
+ # override GZIP_BIN to stop it from compressing manpages |
128 |
+ emake DESTDIR="${D}" GZIP_BIN=false install |
129 |
+ python_optimize |
130 |
+ |
131 |
+ newinitd "${FILESDIR}/distccd.initd" distccd |
132 |
+ systemd_dounit "${FILESDIR}/distccd.service" |
133 |
+ systemd_install_serviced "${FILESDIR}/distccd.service.conf" |
134 |
+ |
135 |
+ cp "${FILESDIR}/distccd.confd" "${T}/distccd" || die |
136 |
+ if use zeroconf; then |
137 |
+ cat >> "${T}/distccd" <<-EOF || die |
138 |
+ |
139 |
+ # Enable zeroconf support in distccd |
140 |
+ DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf" |
141 |
+ EOF |
142 |
+ |
143 |
+ sed -i '/ExecStart/ s|$| --zeroconf|' "${D}$(systemd_get_systemunitdir)"/distccd.service || die |
144 |
+ fi |
145 |
+ doconfd "${T}/distccd" |
146 |
+ |
147 |
+ newenvd - 02distcc <<-EOF || die |
148 |
+ # This file is managed by distcc-config; use it to change these settings. |
149 |
+ # DISTCC_LOG and DISTCC_DIR should not be set. |
150 |
+ DISTCC_VERBOSE="${DISTCC_VERBOSE:-0}" |
151 |
+ DISTCC_FALLBACK="${DISTCC_FALLBACK:-1}" |
152 |
+ DISTCC_SAVE_TEMPS="${DISTCC_SAVE_TEMPS:-0}" |
153 |
+ DISTCC_TCP_CORK="${DISTCC_TCP_CORK}" |
154 |
+ DISTCC_SSH="${DISTCC_SSH}" |
155 |
+ UNCACHED_ERR_FD="${UNCACHED_ERR_FD}" |
156 |
+ DISTCC_ENABLE_DISCREPANCY_EMAIL="${DISTCC_ENABLE_DISCREPANCY_EMAIL}" |
157 |
+ DCC_EMAILLOG_WHOM_TO_BLAME="${DCC_EMAILLOG_WHOM_TO_BLAME}" |
158 |
+ EOF |
159 |
+ |
160 |
+ keepdir /usr/lib/distcc |
161 |
+ |
162 |
+ dobin "${T}/distcc-config" |
163 |
+ |
164 |
+ if use gnome || use gtk; then |
165 |
+ einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui" |
166 |
+ einfo "This is to have a little sensability in naming schemes between distccmon programs" |
167 |
+ mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die |
168 |
+ dosym distccmon-gui /usr/bin/distccmon-gnome |
169 |
+ fi |
170 |
+ |
171 |
+ if use xinetd; then |
172 |
+ insinto /etc/xinetd.d |
173 |
+ newins "doc/example/xinetd" distcc |
174 |
+ fi |
175 |
+ |
176 |
+ insinto /usr/share/shadowman/tools |
177 |
+ newins - distcc <<<"${EPREFIX}/usr/lib/distcc/bin" |
178 |
+ newins - distccd <<<"${EPREFIX}/usr/lib/distcc" |
179 |
+ |
180 |
+ rm -r "${ED}/etc/default" || die |
181 |
+ rm "${ED}/etc/distcc/clients.allow" || die |
182 |
+ rm "${ED}/etc/distcc/commands.allow.sh" || die |
183 |
+} |
184 |
+ |
185 |
+pkg_postinst() { |
186 |
+ # remove the old paths when switching from libXX to lib |
187 |
+ if [[ $(get_libdir) != lib && ${SYMLINK_LIB} != yes && \ |
188 |
+ -d ${EROOT%/}/usr/$(get_libdir)/distcc ]]; then |
189 |
+ rm -r -f "${EROOT%/}/usr/$(get_libdir)/distcc" || die |
190 |
+ fi |
191 |
+ |
192 |
+ if [[ ${ROOT} == / ]]; then |
193 |
+ eselect compiler-shadow update distcc |
194 |
+ eselect compiler-shadow update distccd |
195 |
+ fi |
196 |
+ |
197 |
+ use gnome && xdg_desktop_database_update |
198 |
+ |
199 |
+ elog |
200 |
+ elog "Tips on using distcc with Gentoo can be found at" |
201 |
+ elog "https://wiki.gentoo.org/wiki/Distcc" |
202 |
+ elog |
203 |
+ elog "distcc-pump is known to cause breakage with multiple packages." |
204 |
+ elog "Do NOT enable it globally." |
205 |
+ elog |
206 |
+ elog "To use the distccmon programs with Gentoo you should use this command:" |
207 |
+ elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-text 5" |
208 |
+ |
209 |
+ if use gnome || use gtk; then |
210 |
+ elog "Or:" |
211 |
+ elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-gnome" |
212 |
+ fi |
213 |
+ |
214 |
+ elog |
215 |
+ elog "***SECURITY NOTICE***" |
216 |
+ elog "Since distcc-3.3, whitelist is used for what distccd could execute. The whilelist" |
217 |
+ elog "has been generated by compiler-shadow distccd. To revert to the old behavior, " |
218 |
+ elog "you need to pass --make-me-a-botnet to distccd in /etc/conf.d/distccd." |
219 |
+ elog "Cf. https://github.com/distcc/distcc/pull/243." |
220 |
+} |
221 |
+ |
222 |
+pkg_prerm() { |
223 |
+ if [[ -z ${REPLACED_BY_VERSION} && ${ROOT} == / ]]; then |
224 |
+ eselect compiler-shadow remove distcc |
225 |
+ fi |
226 |
+} |
227 |
+ |
228 |
+pkg_postrm() { |
229 |
+ use gnome && xdg_desktop_database_update |
230 |
+} |
231 |
|
232 |
diff --git a/sys-devel/distcc/files/distccd.confd b/sys-devel/distcc/files/distccd.confd |
233 |
new file mode 100644 |
234 |
index 00000000000..bc08d40777d |
235 |
--- /dev/null |
236 |
+++ b/sys-devel/distcc/files/distccd.confd |
237 |
@@ -0,0 +1,37 @@ |
238 |
+# /etc/conf.d/distccd: config file for /etc/init.d/distccd |
239 |
+ |
240 |
+DISTCCD_OPTS="" |
241 |
+ |
242 |
+# this is the distccd executable |
243 |
+DISTCCD_EXEC="/usr/bin/distccd" |
244 |
+ |
245 |
+# set this option to run distccd with extra parameters |
246 |
+# Default port is 3632. For most people the default is okay. |
247 |
+DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632" |
248 |
+ |
249 |
+# Logging |
250 |
+# You can change some logging options here: |
251 |
+# --log-file FILE |
252 |
+# --log-level LEVEL [critical,error,warning, notice, info, debug] |
253 |
+# |
254 |
+# Leaving --log-file blank will log to syslog |
255 |
+# example: --log-file /dev/null --log-level warning |
256 |
+# example: --log-level critical |
257 |
+ |
258 |
+DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical" |
259 |
+ |
260 |
+# SECURITY NOTICE: |
261 |
+# It is HIGHLY recommended that you use the --listen option |
262 |
+# for increased security. You can specify an IP to permit connections |
263 |
+# from or a CIDR mask |
264 |
+# --listen accepts only a single IP |
265 |
+# --allow is now mandatory as of distcc-2.18. |
266 |
+# example: --allow 192.168.0.0/24 |
267 |
+# example: --allow 192.168.0.5 --allow 192.168.0.150 |
268 |
+# example: --listen 192.168.0.2 |
269 |
+DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.0/24" |
270 |
+#DISTCCD_OPTS="${DISTCCD_OPTS} --listen 192.168.0.2" |
271 |
+ |
272 |
+# set this for niceness |
273 |
+# Default is 15 |
274 |
+DISTCCD_OPTS="${DISTCCD_OPTS} -N 15" |
275 |
|
276 |
diff --git a/sys-devel/distcc/files/distccd.initd b/sys-devel/distcc/files/distccd.initd |
277 |
new file mode 100644 |
278 |
index 00000000000..7673ff2cf42 |
279 |
--- /dev/null |
280 |
+++ b/sys-devel/distcc/files/distccd.initd |
281 |
@@ -0,0 +1,13 @@ |
282 |
+#!/sbin/openrc-run |
283 |
+# Copyright 1999-2018 Gentoo Authors |
284 |
+# Distributed under the terms of the GNU General Public License v2 |
285 |
+ |
286 |
+depend() { |
287 |
+ need net |
288 |
+ use avahi-daemon ypbind |
289 |
+} |
290 |
+ |
291 |
+command="${DISTCCD_EXEC:-usr/bin/distccd}" |
292 |
+command_args="--user distcc --daemon --no-detach ${DISTCCD_OPTS}" |
293 |
+command_background="true" |
294 |
+pidfile="/run/${RC_SVCNAME}.pid" |