1 |
commit: 20ea2072e04e1804fbe0b2c351b22167149ed272 |
2 |
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Dec 9 08:00:26 2018 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 9 08:04:01 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20ea2072 |
7 |
|
8 |
sys-devel/distcc: revbump, fix distcc-config py2<-> py3 errors |
9 |
|
10 |
error: |
11 |
Creating symlinks... |
12 |
Creating /usr/lib/distcc/bin/gcc symlink... |
13 |
Creating /usr/lib/distcc/bin/cc symlink... |
14 |
Creating /usr/lib/distcc/bin/c++ symlink... |
15 |
Creating /usr/lib/distcc/bin/g++ symlink... |
16 |
Traceback (most recent call last): |
17 |
File "/usr/bin/distcc-config", line 154, in <module> |
18 |
installlinks() |
19 |
File "/usr/bin/distcc-config", line 93, in installlinks |
20 |
lines = p.stdout.read().rstrip().split('\n') |
21 |
TypeError: a bytes-like object is required, not 'str' |
22 |
|
23 |
throw in extra .decode() to stdout.read() |
24 |
|
25 |
Package-Manager: Portage-2.3.52, Repoman-2.3.12 |
26 |
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> |
27 |
|
28 |
sys-devel/distcc/distcc-3.3.2-r2.ebuild | 196 ++++++++++++++++++++++++++++++++ |
29 |
sys-devel/distcc/files/distcc-config | 180 +++++++++++++++++++++++++++++ |
30 |
2 files changed, 376 insertions(+) |
31 |
|
32 |
diff --git a/sys-devel/distcc/distcc-3.3.2-r2.ebuild b/sys-devel/distcc/distcc-3.3.2-r2.ebuild |
33 |
new file mode 100644 |
34 |
index 00000000000..22f3c738ebd |
35 |
--- /dev/null |
36 |
+++ b/sys-devel/distcc/distcc-3.3.2-r2.ebuild |
37 |
@@ -0,0 +1,196 @@ |
38 |
+# Copyright 1999-2018 Gentoo Authors |
39 |
+# Distributed under the terms of the GNU General Public License v2 |
40 |
+ |
41 |
+EAPI=6 |
42 |
+ |
43 |
+PYTHON_COMPAT=( python3_{5,6} ) |
44 |
+ |
45 |
+inherit autotools flag-o-matic python-single-r1 systemd \ |
46 |
+ toolchain-funcs user xdg-utils prefix |
47 |
+ |
48 |
+DESCRIPTION="Distribute compilation of C code across several machines on a network" |
49 |
+HOMEPAGE="http://distcc.org/" |
50 |
+SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.gz" |
51 |
+ |
52 |
+LICENSE="GPL-2+" |
53 |
+SLOT="0" |
54 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" |
55 |
+IUSE="gnome gssapi gtk hardened ipv6 selinux xinetd zeroconf" |
56 |
+ |
57 |
+RESTRICT="test" |
58 |
+ |
59 |
+CDEPEND="${PYTHON_DEPS} |
60 |
+ dev-libs/popt |
61 |
+ gnome? ( |
62 |
+ >=gnome-base/libgnome-2 |
63 |
+ >=gnome-base/libgnomeui-2 |
64 |
+ x11-libs/gtk+:2 |
65 |
+ x11-libs/pango |
66 |
+ ) |
67 |
+ gssapi? ( net-libs/libgssglue ) |
68 |
+ gtk? ( x11-libs/gtk+:2 ) |
69 |
+ zeroconf? ( >=net-dns/avahi-0.6[dbus] ) |
70 |
+" |
71 |
+DEPEND="${CDEPEND} |
72 |
+ sys-libs/binutils-libs |
73 |
+ virtual/pkgconfig" |
74 |
+RDEPEND="${CDEPEND} |
75 |
+ !net-misc/pump |
76 |
+ dev-util/shadowman |
77 |
+ >=sys-devel/gcc-config-1.4.1 |
78 |
+ selinux? ( sec-policy/selinux-distcc ) |
79 |
+ xinetd? ( sys-apps/xinetd )" |
80 |
+ |
81 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
82 |
+ |
83 |
+S="${WORKDIR}/distcc" |
84 |
+ |
85 |
+pkg_setup() { |
86 |
+ enewuser distcc 240 -1 -1 daemon |
87 |
+ python-single-r1_pkg_setup |
88 |
+} |
89 |
+ |
90 |
+src_prepare() { |
91 |
+ eapply "${FILESDIR}/${PN}-3.0-xinetd.patch" |
92 |
+ # bug #255188 |
93 |
+ eapply "${FILESDIR}/${PN}-3.3.2-freedesktop.patch" |
94 |
+ # SOCKSv5 support needed for Portage, bug #537616 |
95 |
+ eapply "${FILESDIR}/${PN}-3.2_rc1-socks5.patch" |
96 |
+ eapply_user |
97 |
+ |
98 |
+ # Bugs #120001, #167844 and probably more. See patch for description. |
99 |
+ use hardened && eapply "${FILESDIR}/distcc-hardened.patch" |
100 |
+ |
101 |
+ sed -i \ |
102 |
+ -e "/PATH/s:\$distcc_location:${EPREFIX}/usr/lib/distcc/bin:" \ |
103 |
+ -e "s:@PYTHON@:${EPYTHON}:" \ |
104 |
+ pump.in || die "sed failed" |
105 |
+ |
106 |
+ sed \ |
107 |
+ -e "s:@EPREFIX@:${EPREFIX:-/}:" \ |
108 |
+ -e "s:@libdir@:/usr/lib:" \ |
109 |
+ "${FILESDIR}/distcc-config" > "${T}/distcc-config" || die |
110 |
+ |
111 |
+ hprefixify update-distcc-symlinks.py src/{serve,daemon}.c |
112 |
+ python_fix_shebang update-distcc-symlinks.py "${T}/distcc-config" |
113 |
+ eautoreconf |
114 |
+} |
115 |
+ |
116 |
+src_configure() { |
117 |
+ local myconf=( |
118 |
+ --disable-Werror |
119 |
+ $(use_enable ipv6 rfc2553) |
120 |
+ $(use_with gtk) |
121 |
+ $(use_with gnome) |
122 |
+ $(use_with gssapi auth) |
123 |
+ $(use_with zeroconf avahi) |
124 |
+ ) |
125 |
+ |
126 |
+ econf "${myconf[@]}" |
127 |
+} |
128 |
+ |
129 |
+src_install() { |
130 |
+ # override GZIP_BIN to stop it from compressing manpages |
131 |
+ emake DESTDIR="${D}" GZIP_BIN=false install |
132 |
+ python_optimize |
133 |
+ |
134 |
+ newinitd "${FILESDIR}/distccd.initd" distccd |
135 |
+ systemd_dounit "${FILESDIR}/distccd.service" |
136 |
+ systemd_install_serviced "${FILESDIR}/distccd.service.conf" |
137 |
+ |
138 |
+ cp "${FILESDIR}/distccd.confd" "${T}/distccd" || die |
139 |
+ if use zeroconf; then |
140 |
+ cat >> "${T}/distccd" <<-EOF || die |
141 |
+ |
142 |
+ # Enable zeroconf support in distccd |
143 |
+ DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf" |
144 |
+ EOF |
145 |
+ |
146 |
+ sed -i '/ExecStart/ s|$| --zeroconf|' "${D}$(systemd_get_systemunitdir)"/distccd.service || die |
147 |
+ fi |
148 |
+ doconfd "${T}/distccd" |
149 |
+ |
150 |
+ newenvd - 02distcc <<-EOF || die |
151 |
+ # This file is managed by distcc-config; use it to change these settings. |
152 |
+ # DISTCC_LOG and DISTCC_DIR should not be set. |
153 |
+ DISTCC_VERBOSE="${DISTCC_VERBOSE:-0}" |
154 |
+ DISTCC_FALLBACK="${DISTCC_FALLBACK:-1}" |
155 |
+ DISTCC_SAVE_TEMPS="${DISTCC_SAVE_TEMPS:-0}" |
156 |
+ DISTCC_TCP_CORK="${DISTCC_TCP_CORK}" |
157 |
+ DISTCC_SSH="${DISTCC_SSH}" |
158 |
+ UNCACHED_ERR_FD="${UNCACHED_ERR_FD}" |
159 |
+ DISTCC_ENABLE_DISCREPANCY_EMAIL="${DISTCC_ENABLE_DISCREPANCY_EMAIL}" |
160 |
+ DCC_EMAILLOG_WHOM_TO_BLAME="${DCC_EMAILLOG_WHOM_TO_BLAME}" |
161 |
+ EOF |
162 |
+ |
163 |
+ keepdir /usr/lib/distcc |
164 |
+ |
165 |
+ dobin "${T}/distcc-config" |
166 |
+ |
167 |
+ if use gnome || use gtk; then |
168 |
+ einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui" |
169 |
+ einfo "This is to have a little sensability in naming schemes between distccmon programs" |
170 |
+ mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die |
171 |
+ dosym distccmon-gui /usr/bin/distccmon-gnome |
172 |
+ fi |
173 |
+ |
174 |
+ if use xinetd; then |
175 |
+ insinto /etc/xinetd.d |
176 |
+ newins "doc/example/xinetd" distcc |
177 |
+ fi |
178 |
+ |
179 |
+ insinto /usr/share/shadowman/tools |
180 |
+ newins - distcc <<<"${EPREFIX}/usr/lib/distcc/bin" |
181 |
+ newins - distccd <<<"${EPREFIX}/usr/lib/distcc" |
182 |
+ |
183 |
+ rm -r "${ED}/etc/default" || die |
184 |
+ rm "${ED}/etc/distcc/clients.allow" || die |
185 |
+ rm "${ED}/etc/distcc/commands.allow.sh" || die |
186 |
+} |
187 |
+ |
188 |
+pkg_postinst() { |
189 |
+ # remove the old paths when switching from libXX to lib |
190 |
+ if [[ $(get_libdir) != lib && ${SYMLINK_LIB} != yes && \ |
191 |
+ -d ${EROOT%/}/usr/$(get_libdir)/distcc ]]; then |
192 |
+ rm -r -f "${EROOT%/}/usr/$(get_libdir)/distcc" || die |
193 |
+ fi |
194 |
+ |
195 |
+ if [[ ${ROOT} == / ]]; then |
196 |
+ eselect compiler-shadow update distcc |
197 |
+ eselect compiler-shadow update distccd |
198 |
+ fi |
199 |
+ |
200 |
+ use gnome && xdg_desktop_database_update |
201 |
+ |
202 |
+ elog |
203 |
+ elog "Tips on using distcc with Gentoo can be found at" |
204 |
+ elog "https://wiki.gentoo.org/wiki/Distcc" |
205 |
+ elog |
206 |
+ elog "distcc-pump is known to cause breakage with multiple packages." |
207 |
+ elog "Do NOT enable it globally." |
208 |
+ elog |
209 |
+ elog "To use the distccmon programs with Gentoo you should use this command:" |
210 |
+ elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-text 5" |
211 |
+ |
212 |
+ if use gnome || use gtk; then |
213 |
+ elog "Or:" |
214 |
+ elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-gnome" |
215 |
+ fi |
216 |
+ |
217 |
+ elog |
218 |
+ elog "***SECURITY NOTICE***" |
219 |
+ elog "Since distcc-3.3, whitelist is used for what distccd could execute. The whilelist" |
220 |
+ elog "has been generated by compiler-shadow distccd. To revert to the old behavior, " |
221 |
+ elog "you need to pass --make-me-a-botnet to distccd in /etc/conf.d/distccd." |
222 |
+ elog "Cf. https://github.com/distcc/distcc/pull/243." |
223 |
+} |
224 |
+ |
225 |
+pkg_prerm() { |
226 |
+ if [[ -z ${REPLACED_BY_VERSION} && ${ROOT} == / ]]; then |
227 |
+ eselect compiler-shadow remove distcc |
228 |
+ fi |
229 |
+} |
230 |
+ |
231 |
+pkg_postrm() { |
232 |
+ use gnome && xdg_desktop_database_update |
233 |
+} |
234 |
|
235 |
diff --git a/sys-devel/distcc/files/distcc-config b/sys-devel/distcc/files/distcc-config |
236 |
new file mode 100644 |
237 |
index 00000000000..974620d107f |
238 |
--- /dev/null |
239 |
+++ b/sys-devel/distcc/files/distcc-config |
240 |
@@ -0,0 +1,180 @@ |
241 |
+#!/usr/bin/env python |
242 |
+# Copyright 1999-2018 Gentoo Authors |
243 |
+# Distributed under the terms of the GNU General Public License v2 |
244 |
+ |
245 |
+import os, re, signal, subprocess, sys |
246 |
+ |
247 |
+options=[ |
248 |
+ '--get-hosts', |
249 |
+ '--set-hosts', |
250 |
+ '--get-verbose', |
251 |
+ '--set-verbose', |
252 |
+ '--get-log', |
253 |
+ '--set-log', |
254 |
+ '--update-masquerade', |
255 |
+ '--update-masquerade-with-crossdev', |
256 |
+ '--help', |
257 |
+ '--get-env', |
258 |
+ '--set-env' |
259 |
+] |
260 |
+ |
261 |
+tmpcmdline=sys.argv[1:] |
262 |
+cmdline=[] |
263 |
+ |
264 |
+eprefix = '@EPREFIX@' |
265 |
+bindir = os.path.join(eprefix, 'usr', 'bin') |
266 |
+sbindir = os.path.join(eprefix, 'usr', 'sbin') |
267 |
+libdir = os.path.join(eprefix, '@libdir@') |
268 |
+sysconfdir = os.path.join(eprefix, 'etc') |
269 |
+ |
270 |
+gcc_config = os.path.join(bindir, 'gcc-config') |
271 |
+env_update = os.path.join(sbindir, 'env-update') |
272 |
+envfile = os.path.join(sysconfdir, 'env.d', '02distcc') |
273 |
+default_distcc_dir = os.path.join(sysconfdir, 'distcc') |
274 |
+hostfile = os.path.join(default_distcc_dir, 'hosts') |
275 |
+distcc_path = os.path.join(bindir, 'distcc') |
276 |
+dccc_dir = os.path.join(libdir, 'distcc', 'bin') |
277 |
+ |
278 |
+def exithandler(foo,bar): |
279 |
+ os.kill(0,signal.SIGKILL) |
280 |
+ sys.exit(1) |
281 |
+ |
282 |
+signal.signal(signal.SIGINT,exithandler) |
283 |
+ |
284 |
+def isroot(ret=0): |
285 |
+ if os.getuid() != 0: |
286 |
+ if ret == 0: |
287 |
+ print('!!! %s %s must be run as root' % (sys.argv[:1][0],tmpcmdline[0])) |
288 |
+ sys.exit(1) |
289 |
+ else: |
290 |
+ retval = 0 |
291 |
+ else: |
292 |
+ retval = 1 |
293 |
+ return retval |
294 |
+ |
295 |
+def writeenv(var,value): |
296 |
+ isroot() |
297 |
+ distcc_env = [] |
298 |
+ distcc_env = open(envfile, 'r').readlines() |
299 |
+ distcc_env_new = open(envfile, 'w') |
300 |
+ for i in range(len(distcc_env)): |
301 |
+ if re.compile(var+'="(.*)"').match(distcc_env[i]): |
302 |
+ distcc_env[i] = var+'="'+value+'"\n' |
303 |
+ distcc_env_new.write(distcc_env[i]) |
304 |
+ #print('Set %s to: %s ' % (var,value)) |
305 |
+ subprocess.Popen(env_update, shell=True) |
306 |
+ print('If you want to use these new settings in an existing shell,') |
307 |
+ print('you need to "source /etc/profile" to get the changes.') |
308 |
+ |
309 |
+def readenv(var): |
310 |
+ distcc_env = open(envfile, 'r').read() |
311 |
+ match = re.compile(var+'="(.*)"').search(distcc_env) |
312 |
+ if match: |
313 |
+ print(var+'='+match.group(1)) |
314 |
+ else: |
315 |
+ print(var,'not set.') |
316 |
+ |
317 |
+def installlink(chost='', version=''): |
318 |
+ for file in ['gcc', 'cc', 'c++', 'g++']: |
319 |
+ if not chost == '': |
320 |
+ file = '%s-%s' % (chost,file) |
321 |
+ if not version == '': |
322 |
+ file = '%s-%s' % (file,version) |
323 |
+ path = os.path.join(dccc_dir,file) |
324 |
+ if os.path.exists(os.path.join(bindir,file)): |
325 |
+ if not os.path.exists(path): |
326 |
+ print('Creating %s symlink...' % (path)) |
327 |
+ os.symlink(distcc_path,path) |
328 |
+ #else: |
329 |
+ # print('Already exists. Skipping...') |
330 |
+ |
331 |
+def installlinks(): |
332 |
+ p = subprocess.Popen([gcc_config+" -C -l"], shell=True, stdout=subprocess.PIPE) |
333 |
+ lines = p.stdout.read().decode().rstrip().split('\n') |
334 |
+ for line in lines: |
335 |
+ columns = line.split() |
336 |
+ if len(columns) >= 2: |
337 |
+ matches = re.match("(.*)-(.*)", columns[1]) |
338 |
+ chost = matches.group(1) |
339 |
+ version = matches.group(2) |
340 |
+ installlink(chost) |
341 |
+ installlink(chost, version) |
342 |
+ |
343 |
+def uninstalllinks(): |
344 |
+ for root, dirs, files in os.walk(dccc_dir): |
345 |
+ for file in files: |
346 |
+ os.remove(os.path.join(root, file)) |
347 |
+ |
348 |
+def createdistccdir(dir): |
349 |
+ if not os.path.exists(dir): |
350 |
+ os.mkdir(dir) |
351 |
+ os.chmod(dir, 0o755) |
352 |
+ |
353 |
+for x in tmpcmdline: |
354 |
+ if not x: |
355 |
+ continue |
356 |
+ if x[0:2]=="--": |
357 |
+ if not x in options: |
358 |
+ print("!!! Error: %s is an invalid option." % (x)) |
359 |
+ sys.exit(1) |
360 |
+ else: |
361 |
+ cmdline = x |
362 |
+ |
363 |
+if '--get-hosts' in tmpcmdline: |
364 |
+ HOSTS_ENV = os.environ.get('DISTCC_HOSTS') |
365 |
+ HOSTS_HOME = os.path.join(os.environ.get('HOME'), '.distcc', 'hosts') |
366 |
+ if HOSTS_ENV: |
367 |
+ print(HOSTS_ENV) |
368 |
+ elif os.path.isfile(HOSTS_HOME) and os.path.getsize(HOSTS_HOME) != 0: |
369 |
+ print(HOSTS_HOME) |
370 |
+ elif os.path.exists(hostfile): |
371 |
+ print(open(hostfile, 'r').read().rstrip()) |
372 |
+ else: |
373 |
+ print('No configuration file found. Setup your hosts with --set-hosts.') |
374 |
+elif '--set-hosts' in tmpcmdline: |
375 |
+ if isroot(1): |
376 |
+ PATH = default_distcc_dir |
377 |
+ else: |
378 |
+ PATH = os.path.join(os.environ.get('HOME'), '.distcc') |
379 |
+ createdistccdir(PATH) |
380 |
+ open(os.path.join(PATH, 'hosts'), 'w').write(cmdline + '\n') |
381 |
+elif '--get-verbose' in tmpcmdline: |
382 |
+ readenv('DISTCC_VERBOSE') |
383 |
+elif '--set-verbose' in tmpcmdline: |
384 |
+ writeenv('DISTCC_VERBOSE',tmpcmdline[1]) |
385 |
+elif '--get-log' in tmpcmdline: |
386 |
+ readenv('DISTCC_LOG') |
387 |
+elif '--set-log' in tmpcmdline: |
388 |
+ writeenv('DISTCC_LOG',tmpcmdline[1]) |
389 |
+elif '--update-masquerade' in tmpcmdline: |
390 |
+ isroot() |
391 |
+ uninstalllinks() |
392 |
+ print('Creating symlinks...') |
393 |
+ installlink() |
394 |
+ installlinks() |
395 |
+elif '--update-masquerade-with-crossdev' in tmpcmdline: |
396 |
+ isroot() |
397 |
+ uninstalllinks() |
398 |
+ print('Creating symlinks...') |
399 |
+ installlinks() |
400 |
+elif '--get-env' in tmpcmdline: |
401 |
+ if len(tmpcmdline) == 1: |
402 |
+ print(open(envfile, 'r').read().rstrip()) |
403 |
+ elif len(tmpcmdline) == 2: |
404 |
+ readenv(tmpcmdline[1]) |
405 |
+ else: |
406 |
+ print('!!! Error: Specify only one variable.') |
407 |
+elif '--set-env' in tmpcmdline: |
408 |
+ if len(tmpcmdline) > 2 and len(tmpcmdline) <= 3: |
409 |
+ isroot() |
410 |
+ writeenv(tmpcmdline[1],tmpcmdline[2]) |
411 |
+ else: |
412 |
+ print('!!! Error: Awaiting two parameters.') |
413 |
+else: |
414 |
+ cmd = sys.argv[:1][0] |
415 |
+ print('Usage: %s --set-hosts DISTCC_HOSTS | --get-hosts' % (cmd)) |
416 |
+ print(' %s --set-verbose { 0 | 1 } | --get-verbose' % (cmd)) |
417 |
+ print(' %s --set-log FILE | --get-log' % (cmd)) |
418 |
+ print(' %s --set-env VARIABLE VALUE | --get-env [VARIABLE]' % (cmd)) |
419 |
+ print(' %s --update-masquerade' % (cmd)) |
420 |
+ print(' %s --update-masquerade-with-crossdev' % (cmd)) |