Remove old distcc

This commit is contained in:
Sam Therapy 2023-11-08 23:44:47 +01:00
parent 7cf6522090
commit d33aedfdb1
Signed by: sam
GPG key ID: 4D8B07C18F31ACBD
11 changed files with 0 additions and 828 deletions

View file

@ -1,11 +0,0 @@
AUX distcc-3.0-xinetd.patch 558 BLAKE2B a381f2282c71f0eb28dc218cd57a2a914f02ffedad068c8cb7a510ae0cbf0a200de38e2bb31918ce5e10960359e1452365f36393c804984db1054410156e4b61 SHA512 1c0aa31606e1ce828ad52c9fff672d9e13a00494b8a3441095aca101d76f0f296308e359330a85745e2c60533eb1dcf82cea3feff2d0a3154b204d56735f0d14
AUX distcc-3.2_rc1-socks5.patch 5462 BLAKE2B 5c18de909306bf0fa24690fae618c193396f5d27ef77cb9341bda69e3f8319f3b779c760af27cb19e9a6f88a46f02fe888d4bf4fbaef6419beae239964c4ee47 SHA512 707b6ad02bb7ff1507cfbfbb4cee673d5f0dc776006e9b7e801deabccf05c6057b33ea43c6a3ddd1756b8d07ff1d5e3087b635f15285195ba795b8679ebdc860
AUX distcc-3.4-pump-tests.patch 5922 BLAKE2B 17e755c3a6c04465a6c0be1e2657eb92d3a25e871eb62750d4a379290c01c6939ad55feb76a76b35b66d366aedaa64e4b7d63143be412a93a22448d33c819271 SHA512 8d2a6e5a5ac219fad327919344d68274243337fabd6361ee6355be658e2503d6d3657d8adb285dc40105b0916096bb9b21e93f544fb7342dcf9ac03c70c6a4fc
AUX distcc-config 5218 BLAKE2B 41d483481e483217ed6313b4f82ed66c4f006070c269bc5ee1283db9c000d12ab29a90d1813df2a590f87c02520e312c35901a7d3f1364480b68bb02d668d51d SHA512 fe3dee7a89ec16e103b52d3555d483b42e4cbe716e3e77f792c543fb2c82eca5f6b8e0d2809f16c805d55263471108ff2dea1f4a5d55826f67f8b94239aca946
AUX distcc-hardened.patch 1084 BLAKE2B 4b78fce2ab19b3832006a8b0092d3d38df07ce8225eb367c90256a158a41121e09269cd4bf59a1fc450db58eafe09e757f6e3ca4ae074a4567676701228c8289 SHA512 d1150dc83bf89c332f8c0bd01e15f52f95d71868733bd2e5430a5377f1a4aaa2b5b6e0cd488d33d9b94ce18b0eeeadf4af719db536b001b50e4d482b35c7e057
AUX distccd.confd 1328 BLAKE2B d6a4756afbe7813733227091028e1db570371750bd22dedbfb66e4d86e995138cdc3a63c853b5674c8678bf0475d7276c45f74b40ac916d060760f06ac3fdf73 SHA512 e6ff0547892b9e7a255afeb56eb07516e4b328d86d5d987872f1bf24a973132544e9f17195e5f8827305218429adb1c5290cde3ef1c094efd035592cbdde7eec
AUX distccd.initd 374 BLAKE2B 48011f19225536311701250470011bc1c1be16f2400831964dd5e28920d4a0c955565a15b5014118e6fa65f4ac12c99d2f2dc6a63c1aa5863b0ef9633953ff82 SHA512 f707bdb15066e4eab4481c6be7e482e81f58586456123b42ddc3e92b0d7973b81975e3670166e20d0814b0c0d7441bec7788e9bd16af5fa9746380895b23bf65
AUX distccd.service-1 234 BLAKE2B 0ab7f90e6f7274fd9fe72df6a58e5323b2d65e91ca8805c549f9f92fa41a3099ea3f0a422270ca0ffe37d682d435da513552e6b7c33617c767909577cc83f85a SHA512 c2aa1b5e0d34c6b8c20d3fb83b8328e6859cefc9f3f98130701f7448fe896f5c80e29091fc4bbab01d1f600c0258b790571d86e7057dc4cfe799b53aef92a1bc
AUX distccd.service.conf 186 BLAKE2B b3776e30ded7777be2610f07acec0f70a3cfb7718be149ad5bebd58538add7efead69368020c30610ec33a87ab4d3b3f0123d347f6d0d4abd74f3c714b039955 SHA512 19bf25757ba724ba4e728797b8c6fccabb8b95d2945f0e3c216303a04a4e7470507dcf8535657954f265ed5f067f32dcb3fb6558e9958a86de76b1e66e2b31b6
DIST distcc-3.4.tar.gz 1239519 BLAKE2B 8dc9baa6b1f65f2bb3621e4e643d7d15d55e2338de4d6a7f20a572d9ec280925b4421a294f40c9fcfba8d4193a6bd1871eb8caf13dd2c2a8a81834671f6bc8bc SHA512 de09329fdfa25e08a9b9529190ddaa9ceccb34c8655692edb86f367a8db4a71b750c6e928cb8e5a670f51fbbc02fd1c8524f72e01b3ebaacc1106dc676d18eef
EBUILD distcc-3.4-r2.ebuild 5225 BLAKE2B e7dfb48db5ffb6b98ba76947e5a4046702917aedbc76a3d75d1b0682d8954bb0417cab17e4d59c613bfcf3b00c9825185c44ecec92c839393de79dc8fd937fa1 SHA512 4969e8006a6818b290a76657b213f6fca1165c26e547e660f9e114d1714e2bdf327202b8bb3979f033f013478c478146f4729f12d2fb9c0d8be3804e4d527de5

View file

@ -1,181 +0,0 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..11} )
inherit autotools flag-o-matic prefix python-single-r1 systemd
DESCRIPTION="Distribute compilation of C code across several machines on a network"
HOMEPAGE="https://github.com/distcc/distcc"
SRC_URI="https://github.com/distcc/distcc/releases/download/v${PV}/${P}.tar.gz"
LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
IUSE="gssapi gtk hardened ipv6 selinux xinetd zeroconf"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RDEPEND="${PYTHON_DEPS}
dev-libs/popt
gssapi? ( net-libs/libgssglue )
gtk? ( x11-libs/gtk+:3 )
zeroconf? ( >=net-dns/avahi-0.6[dbus] )
"
DEPEND="${RDEPEND}
sys-libs/binutils-libs"
BDEPEND="
sys-devel/autoconf-archive
virtual/pkgconfig"
RDEPEND+="
acct-user/distcc
dev-util/shadowman
>=sys-devel/gcc-config-1.4.1
selinux? ( sec-policy/selinux-distcc )
xinetd? ( sys-apps/xinetd )"
src_prepare() {
eapply "${FILESDIR}/${PN}-3.0-xinetd.patch"
# SOCKSv5 support needed for Portage, bug #537616
eapply "${FILESDIR}/${PN}-3.2_rc1-socks5.patch"
eapply "${FILESDIR}/${PN}-3.4-pump-tests.patch"
eapply_user
# Bugs #120001, #167844 and probably more. See patch for description.
use hardened && eapply "${FILESDIR}/distcc-hardened.patch"
sed -i \
-e "/PATH/s:\$distcc_location:${EPREFIX}/usr/lib/distcc/bin:" \
-e "s:@PYTHON@:${EPYTHON}:" \
pump.in || die "sed failed"
sed \
-e "s:@EPREFIX@:${EPREFIX:-/}:" \
-e "s:@libdir@:/usr/lib:" \
"${FILESDIR}/distcc-config" > "${T}/distcc-config" || die
# TODO: gdb tests fail due to gdb failing to find .c file
sed -i -e '/Gdb.*Case,/d' test/testdistcc.py || die
hprefixify update-distcc-symlinks.py src/{serve,daemon}.c
python_fix_shebang update-distcc-symlinks.py "${T}/distcc-config"
eautoreconf
}
src_configure() {
# https://github.com/distcc/distcc/issues/454
append-cppflags -DPY_SSIZE_T_CLEAN
local myconf=(
--disable-Werror
--libdir="${EPREFIX}"/usr/lib
$(use_enable ipv6 rfc2553)
$(use_with gtk)
--without-gnome
$(use_with gssapi auth)
$(use_with zeroconf avahi)
)
econf "${myconf[@]}"
}
src_test() {
# sandbox breaks some tests, and hangs some too
# retest once #590084 is fixed
local -x SANDBOX_ON=0
emake -j1 check
}
src_install() {
# override GZIP_BIN to stop it from compressing manpages
emake -j1 DESTDIR="${D}" GZIP_BIN=false install
python_optimize
newinitd "${FILESDIR}/distccd.initd" distccd
systemd_newunit "${FILESDIR}/distccd.service-1" distccd.service
systemd_install_serviced "${FILESDIR}/distccd.service.conf"
cp "${FILESDIR}/distccd.confd" "${T}/distccd" || die
if use zeroconf; then
cat >> "${T}/distccd" <<-EOF || die
# Enable zeroconf support in distccd
DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf"
EOF
sed -i '/ExecStart/ s|$| --zeroconf|' "${D}$(systemd_get_systemunitdir)"/distccd.service || die
fi
doconfd "${T}/distccd"
newenvd - 02distcc <<-EOF || die
# This file is managed by distcc-config; use it to change these settings.
# DISTCC_LOG and DISTCC_DIR should not be set.
DISTCC_VERBOSE="${DISTCC_VERBOSE:-0}"
DISTCC_FALLBACK="${DISTCC_FALLBACK:-1}"
DISTCC_SAVE_TEMPS="${DISTCC_SAVE_TEMPS:-0}"
DISTCC_TCP_CORK="${DISTCC_TCP_CORK}"
DISTCC_SSH="${DISTCC_SSH}"
UNCACHED_ERR_FD="${UNCACHED_ERR_FD}"
DISTCC_ENABLE_DISCREPANCY_EMAIL="${DISTCC_ENABLE_DISCREPANCY_EMAIL}"
DCC_EMAILLOG_WHOM_TO_BLAME="${DCC_EMAILLOG_WHOM_TO_BLAME}"
EOF
keepdir /usr/lib/distcc
dobin "${T}/distcc-config"
if use gtk; then
einfo "Renaming /usr/bin/distccmon-gnome to /usr/bin/distccmon-gui"
einfo "This is to have a little sensability in naming schemes between distccmon programs"
mv "${ED}/usr/bin/distccmon-gnome" "${ED}/usr/bin/distccmon-gui" || die
dosym distccmon-gui /usr/bin/distccmon-gnome
fi
if use xinetd; then
insinto /etc/xinetd.d
newins "doc/example/xinetd" distcc
fi
insinto /usr/share/shadowman/tools
newins - distcc <<<"${EPREFIX}/usr/lib/distcc/bin"
newins - distccd <<<"${EPREFIX}/usr/lib/distcc"
rm -r "${ED}/etc/default" || die
rm "${ED}/etc/distcc/clients.allow" || die
rm "${ED}/etc/distcc/commands.allow.sh" || die
}
pkg_postinst() {
# remove the old paths when switching from libXX to lib
if [[ $(get_libdir) != lib && ${SYMLINK_LIB} != yes && \
-d ${EROOT}/usr/$(get_libdir)/distcc ]]; then
rm -r -f "${EROOT}/usr/$(get_libdir)/distcc" || die
fi
if [[ -z ${ROOT} ]]; then
eselect compiler-shadow update distcc
eselect compiler-shadow update distccd
fi
elog
elog "Tips on using distcc with Gentoo can be found at"
elog "https://wiki.gentoo.org/wiki/Distcc"
elog
elog "distcc-pump is known to cause breakage with multiple packages."
elog "Do NOT enable it globally."
elog
elog "To use the distccmon programs with Gentoo you should use this command:"
elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-text 5"
if use gtk; then
elog "Or:"
elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-gnome"
fi
}
pkg_prerm() {
if [[ -z ${REPLACED_BY_VERSION} && -z ${ROOT} ]]; then
eselect compiler-shadow remove distcc
fi
}

View file

@ -1,15 +0,0 @@
diff -Naur distcc-3.0.orig/doc/example/xinetd distcc-3.0/doc/example/xinetd
--- distcc-3.0.orig/doc/example/xinetd 2008-08-07 05:52:13.000000000 +0900
+++ distcc-3.0/doc/example/xinetd 2008-10-27 15:32:14.000000000 +0900
@@ -19,10 +19,6 @@
socket_type = stream
wait = no
user = distcc
- server = /usr/local/bin/distccd
+ server = /usr/bin/distccd
server_args = --inetd
-
- # This makes xinetd cope if there is no service listed in
- # /etc/services
- type = UNLISTED
}

View file

@ -1,191 +0,0 @@
From fdd93b1e9545b66d1b3a2a1ec24d4c8613ee43fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sat, 24 Jan 2015 23:59:21 +0100
Subject: [PATCH] Support SOCKSv5 proxy
Support using a SOCKSv5 proxy specified as DISTCC_SOCKS_PROXY.
The variable can either a hostname, a host:port pair or an absolute path
to a UNIX socket. When SOCKS is used, the hostname is passed to
the proxy and therefore the name resolution is done remotely.
---
src/clinet.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 135 insertions(+), 2 deletions(-)
diff --git a/src/clinet.c b/src/clinet.c
index 010a884..4773d8b 100644
--- a/src/clinet.c
+++ b/src/clinet.c
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stddef.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
@@ -42,8 +43,10 @@
#include <sys/types.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
+#include <sys/un.h>
#include <netdb.h>
@@ -161,7 +164,7 @@ out_failed:
/**
* Open a socket to a tcp remote host with the specified port.
**/
-int dcc_connect_by_name(const char *host, int port, int *p_fd)
+static int dcc_connect_by_name_real(const char *host, int port, int *p_fd)
{
struct addrinfo hints;
struct addrinfo *res;
@@ -201,7 +204,7 @@ int dcc_connect_by_name(const char *host, int port, int *p_fd)
*
* @todo Don't try for too long to connect.
**/
-int dcc_connect_by_name(const char *host, int port, int *p_fd)
+static int dcc_connect_by_name_real(const char *host, int port, int *p_fd)
{
struct sockaddr_in sock_out;
struct hostent *hp;
@@ -224,3 +227,133 @@ int dcc_connect_by_name(const char *host, int port, int *p_fd)
}
#endif /* not ENABLE_RFC2553 */
+
+static int dcc_connect_via_socks5(const char *host, int port, int *p_fd, const char *proxy)
+{
+ int ret;
+ char *proxy_host, *proxy_it;
+ int proxy_port;
+ char buf[262];
+ int host_length;
+ struct sockaddr_in addr_buf;
+ int skip_bytes;
+
+ host_length = strlen(host);
+ if (host_length > 255) {
+ rs_log_error("hostname \"%s\" too long for SOCKSv5 (over 255 chars)", host);
+ return EXIT_CONNECT_FAILED;
+ }
+
+ if (proxy[0] == '/') { /* UNIX socket */
+ struct sockaddr_un unix_addr;
+
+ if (strlen(proxy) >= sizeof(unix_addr.sun_path))
+ {
+ rs_log_error("UNIX socket path \"%s\" too long", proxy);
+ return EXIT_CONNECT_FAILED;
+ }
+
+ unix_addr.sun_family = AF_UNIX;
+ strcpy(unix_addr.sun_path, proxy);
+
+ ret = dcc_connect_by_addr((struct sockaddr *) &unix_addr,
+ offsetof(struct sockaddr_un, sun_path) + strlen(proxy) + 1,
+ p_fd);
+
+ } else { /* hostname? IP address? */
+ proxy_host = strdup(proxy);
+ if (proxy_host == NULL) return EXIT_OUT_OF_MEMORY;
+
+ proxy_it = strrchr(proxy_host, ':');
+ if (proxy_it) {
+ *(proxy_it++) = 0;
+ proxy_port = atoi(proxy_it);
+
+ if (proxy_port <= 0) {
+ rs_log_error("invalid proxy port \"%s\"", proxy_it);
+ free(proxy_host);
+ return EXIT_CONNECT_FAILED;
+ }
+ }
+ else
+ proxy_port = 1080;
+
+ ret = dcc_connect_by_name_real(proxy_host, proxy_port, p_fd);
+ free(proxy_host);
+ }
+
+ if (ret != 0)
+ return ret;
+
+ /* connected to proxy, now identifier/method selection */
+ buf[0] = 0x05; /* SOCKSv5 */
+ buf[1] = 0x01; /* one method */
+ buf[2] = 0x00; /* NO AUTHENTICATION REQUIRED */
+ ret = dcc_writex(*p_fd, buf, 3);
+ if (ret != 0)
+ return ret;
+
+ /* wait for method selection */
+ ret = dcc_readx(*p_fd, buf, 2);
+ if (ret != 0)
+ return ret;
+ if (buf[0] != 0x05 || buf[1] != 0x00) { /* version, method */
+ rs_log_error("invalid proxy reply (version 0x%02x, method 0x%02x)",
+ buf[0], buf[1]);
+ return EXIT_CONNECT_FAILED;
+ }
+
+ /* send connect request */
+ buf[0] = 0x05; /* SOCKSv5 */
+ buf[1] = 0x01; /* CONNECT command */
+ buf[2] = 0x00; /* reserved */
+ buf[3] = 0x03; /* DOMAINNAME address type */
+ buf[4] = host_length;
+ memcpy(&buf[5], host, host_length);
+ addr_buf.sin_port = htons(port);
+ memcpy(&buf[5 + host_length], &addr_buf.sin_port, 2);
+ ret = dcc_writex(*p_fd, buf, 7 + host_length);
+ if (ret != 0)
+ return ret;
+
+ /* wait for the connection */
+ /* read first 4 bytes of reply + 2 extra bytes we know will be there */
+ ret = dcc_readx(*p_fd, buf, 6);
+ if (ret != 0)
+ return ret;
+ if (buf[0] != 0x05 || buf[2] != 0x00) { /* version, reserved */
+ rs_log_error("invalid proxy reply (version 0x%02x, reserved 0x%02x)",
+ buf[0], buf[2]);
+ return EXIT_CONNECT_FAILED;
+ }
+ if (buf[1] != 0x00) { /* reply */
+ rs_log_error("proxy connection failed, reason=0x%02x", buf[1]);
+ return EXIT_CONNECT_FAILED;
+ }
+
+ /* now read the remaining (packet size - 6) bytes */
+ switch (buf[3]) { /* address type */
+ case 0x01: skip_bytes = 4; break; /* IPv4 */
+ case 0x03: skip_bytes = buf[4] + 1; break; /* hostname with length field */
+ case 0x04: skip_bytes = 16; break; /* IPv6 */
+ default:
+ rs_log_error("invalid proxy reply (address type 0x%02x)", buf[3]);
+ return EXIT_CONNECT_FAILED;
+ }
+ ret = dcc_readx(*p_fd, buf, skip_bytes);
+ if (ret != 0)
+ return ret;
+
+ return 0;
+}
+
+int dcc_connect_by_name(const char *host, int port, int *p_fd)
+{
+ const char *proxy;
+
+ proxy = getenv("DISTCC_SOCKS_PROXY");
+ if (proxy)
+ return dcc_connect_via_socks5(host, port, p_fd, proxy);
+ else
+ return dcc_connect_by_name_real(host, port, p_fd);
+}
--
2.3.0

View file

@ -1,153 +0,0 @@
https://github.com/distcc/distcc/pull/460
From 45d9c4a1ef66451ed45a6afdec7098ed02082390 Mon Sep 17 00:00:00 2001
From: Rosen Matev <rosen.matev@cern.ch>
Date: Fri, 29 Apr 2022 15:42:28 +0200
Subject: [PATCH] Fix tests in pump mode
`make check` is also running tests for the pump mode
(`pump-maintainer-check` target) but they were all falling back to
the usual preprocessor mode as the include server was not started.
This is solved by prepending `pump` to the distcc invocations and
also some trivially failing tests are fixed or disabled when they
make no sense in pump mode.
---
Makefile.in | 2 +-
pump.in | 13 +++++++++++--
test/testdistcc.py | 28 ++++++++++++++++++++++++----
3 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index f240ca6f..79e28380 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -583,7 +583,7 @@ distccmon-gnome@EXEEXT@: $(mon_obj) $(gnome_obj)
# the distcc version, the source location, the CPP flags (for location of the
# includes), and the build location.
include-server:
- if test -z "$(PYTHON)"; then \
+ @if test -z "$(PYTHON)"; then \
echo "Not building $@: No suitable python found"; \
else \
mkdir -p "$(include_server_builddir)" && \
diff --git a/pump.in b/pump.in
index 8e46f458..08a32c0e 100755
--- a/pump.in
+++ b/pump.in
@@ -218,7 +218,9 @@ PrintIncludeServerStatusMessage() {
}
Announce() {
- echo "__________Using distcc-pump from $DISTCC_LOCATION"
+ if [ "$verbose" = 1 ]; then
+ echo "__________Using distcc-pump from $DISTCC_LOCATION"
+ fi
}
# Starts up the include server. Sets $socket, $socket_dir, and
@@ -359,7 +361,9 @@ ShutDown() {
# Always -- at exit -- shut down include_server and remove $socket_dir
if [ -n "$include_server_pid" ] && \
ps -p "$include_server_pid" > /dev/null; then
- echo '__________Shutting down distcc-pump include server'
+ if [ "$verbose" = 1 ]; then
+ echo '__________Shutting down distcc-pump include server'
+ fi
kill $include_server_pid
# Wait until it's really dead. We need to do this because the
# include server may produce output after receiving SIGTERM.
@@ -508,6 +512,11 @@ Main() {
Initialize
+ # Do not write on stdout if we're testing pump mode
+ if [ "0$DISTCC_TESTING_INCLUDE_SERVER" -ne "0" ]; then
+ verbose=0
+ fi
+
case "$*" in
--startup)
# Don't put ordinary progress messages on stdout,
diff --git a/test/testdistcc.py b/test/testdistcc.py
index dfdf2f13..6377d0b6 100755
--- a/test/testdistcc.py
+++ b/test/testdistcc.py
@@ -258,7 +258,11 @@ def valgrind(self):
return _valgrind_command;
def distcc(self):
- return self.valgrind() + "distcc "
+ if "cpp" not in _server_options:
+ return self.valgrind() + "distcc "
+ else:
+ return "DISTCC_TESTING_INCLUDE_SERVER=1 " + self.valgrind() + "pump distcc "
+
def distccd(self):
return self.valgrind() + "distccd "
@@ -422,6 +426,11 @@ class BogusOption_Case(SimpleDistCC_Case):
Now that we support implicit compilers, this is passed to gcc,
which returns a non-zero status."""
def runtest(self):
+ # Disable the test in pump mode since the pump wrapper fails
+ # before we can run distcc.
+ if "cpp" in _server_options:
+ raise comfychair.NotRunError('pump wrapper expects DISTCC_HOSTS')
+
error_rc, _, _ = self.runcmd_unchecked(self._cc + " --bogus-option")
assert error_rc != 0
self.runcmd(self.distcc() + self._cc + " --bogus-option", error_rc)
@@ -432,7 +441,7 @@ def runtest(self):
class CompilerOptionsPassed_Case(SimpleDistCC_Case):
"""Test that options following the compiler name are passed to the compiler."""
def runtest(self):
- out, err = self.runcmd("DISTCC_HOSTS=localhost "
+ out, err = self.runcmd("DISTCC_HOSTS=localhost%s " % _server_options
+ self.distcc()
+ self._cc + " --help")
if re.search('distcc', out):
@@ -1422,7 +1431,8 @@ def source(self):
def setupEnv(self):
Compilation_Case.setupEnv(self)
- os.environ['DISTCC_HOSTS'] = '127.0.0.1:%d,lzo' % self.server_port
+ os.environ['DISTCC_HOSTS'] = (
+ '127.0.0.1:%d,lzo' % self.server_port + _server_options)
class DashONoSpace_Case(CompileHello_Case):
def compileCmd(self):
@@ -1525,6 +1535,11 @@ def source(self):
"""
def runtest(self):
+ # Disable the test in pump mode since the pump wrapper fails
+ # before we can run distcc.
+ if "cpp" in _server_options:
+ raise comfychair.NotRunError('pump wrapper expects DISTCC_HOSTS')
+
# -P means not to emit linemarkers
self.runcmd(self.distcc()
+ self._cc + " -E testtmp.c -o testtmp.out")
@@ -1828,7 +1843,7 @@ class NoServer_Case(CompileHello_Case):
"""Invalid server name"""
def setup(self):
self.stripEnvironment()
- os.environ['DISTCC_HOSTS'] = 'no.such.host.here'
+ os.environ['DISTCC_HOSTS'] = 'no.such.host.here' + _server_options
self.distcc_log = 'distcc.log'
os.environ['DISTCC_LOG'] = self.distcc_log
self.createSource()
@@ -1874,6 +1889,11 @@ class NoHosts_Case(CompileHello_Case):
We expect compilation to succeed, but with a warning that it was
run locally."""
def runtest(self):
+ # Disable the test in pump mode since the pump wrapper fails
+ # before we can run distcc.
+ if "cpp" in _server_options:
+ raise comfychair.NotRunError('pump wrapper expects DISTCC_HOSTS')
+
# WithDaemon_Case sets this to point to the local host, but we
# don't want that. Note that you cannot delete environment
# keys in Python1.5, so we need to just set them to the empty

View file

@ -1,180 +0,0 @@
#!/usr/bin/env python
# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import os, re, signal, subprocess, sys
options=[
'--get-hosts',
'--set-hosts',
'--get-verbose',
'--set-verbose',
'--get-log',
'--set-log',
'--update-masquerade',
'--update-masquerade-with-crossdev',
'--help',
'--get-env',
'--set-env'
]
tmpcmdline=sys.argv[1:]
cmdline=[]
eprefix = '@EPREFIX@'
bindir = os.path.join(eprefix, 'usr', 'bin')
sbindir = os.path.join(eprefix, 'usr', 'sbin')
libdir = os.path.join(eprefix, '@libdir@')
sysconfdir = os.path.join(eprefix, 'etc')
gcc_config = os.path.join(bindir, 'gcc-config')
env_update = os.path.join(sbindir, 'env-update')
envfile = os.path.join(sysconfdir, 'env.d', '02distcc')
default_distcc_dir = os.path.join(sysconfdir, 'distcc')
hostfile = os.path.join(default_distcc_dir, 'hosts')
distcc_path = os.path.join(bindir, 'distcc')
dccc_dir = os.path.join(libdir, 'distcc', 'bin')
def exithandler(foo,bar):
os.kill(0,signal.SIGKILL)
sys.exit(1)
signal.signal(signal.SIGINT,exithandler)
def isroot(ret=0):
if os.getuid() != 0:
if ret == 0:
print('!!! %s %s must be run as root' % (sys.argv[:1][0],tmpcmdline[0]))
sys.exit(1)
else:
retval = 0
else:
retval = 1
return retval
def writeenv(var,value):
isroot()
distcc_env = []
distcc_env = open(envfile, 'r').readlines()
distcc_env_new = open(envfile, 'w')
for i in range(len(distcc_env)):
if re.compile(var+'="(.*)"').match(distcc_env[i]):
distcc_env[i] = var+'="'+value+'"\n'
distcc_env_new.write(distcc_env[i])
#print('Set %s to: %s ' % (var,value))
subprocess.Popen(env_update, shell=True)
print('If you want to use these new settings in an existing shell,')
print('you need to "source /etc/profile" to get the changes.')
def readenv(var):
distcc_env = open(envfile, 'r').read()
match = re.compile(var+'="(.*)"').search(distcc_env)
if match:
print(var+'='+match.group(1))
else:
print(var,'not set.')
def installlink(chost='', version=''):
for file in ['gcc', 'cc', 'c++', 'g++']:
if not chost == '':
file = '%s-%s' % (chost,file)
if not version == '':
file = '%s-%s' % (file,version)
path = os.path.join(dccc_dir,file)
if os.path.exists(os.path.join(bindir,file)):
if not os.path.exists(path):
print('Creating %s symlink...' % (path))
os.symlink(distcc_path,path)
#else:
# print('Already exists. Skipping...')
def installlinks():
p = subprocess.Popen([gcc_config+" -C -l"], shell=True, stdout=subprocess.PIPE)
lines = p.stdout.read().decode().rstrip().split('\n')
for line in lines:
columns = line.split()
if len(columns) >= 2:
matches = re.match("(.*)-(.*)", columns[1])
chost = matches.group(1)
version = matches.group(2)
installlink(chost)
installlink(chost, version)
def uninstalllinks():
for root, dirs, files in os.walk(dccc_dir):
for file in files:
os.remove(os.path.join(root, file))
def createdistccdir(dir):
if not os.path.exists(dir):
os.mkdir(dir)
os.chmod(dir, 0o755)
for x in tmpcmdline:
if not x:
continue
if x[0:2]=="--":
if not x in options:
print("!!! Error: %s is an invalid option." % (x))
sys.exit(1)
else:
cmdline = x
if '--get-hosts' in tmpcmdline:
HOSTS_ENV = os.environ.get('DISTCC_HOSTS')
HOSTS_HOME = os.path.join(os.environ.get('HOME'), '.distcc', 'hosts')
if HOSTS_ENV:
print(HOSTS_ENV)
elif os.path.isfile(HOSTS_HOME) and os.path.getsize(HOSTS_HOME) != 0:
print(HOSTS_HOME)
elif os.path.exists(hostfile):
print(open(hostfile, 'r').read().rstrip())
else:
print('No configuration file found. Setup your hosts with --set-hosts.')
elif '--set-hosts' in tmpcmdline:
if isroot(1):
PATH = default_distcc_dir
else:
PATH = os.path.join(os.environ.get('HOME'), '.distcc')
createdistccdir(PATH)
open(os.path.join(PATH, 'hosts'), 'w').write(cmdline + '\n')
elif '--get-verbose' in tmpcmdline:
readenv('DISTCC_VERBOSE')
elif '--set-verbose' in tmpcmdline:
writeenv('DISTCC_VERBOSE',tmpcmdline[1])
elif '--get-log' in tmpcmdline:
readenv('DISTCC_LOG')
elif '--set-log' in tmpcmdline:
writeenv('DISTCC_LOG',tmpcmdline[1])
elif '--update-masquerade' in tmpcmdline:
isroot()
uninstalllinks()
print('Creating symlinks...')
installlink()
installlinks()
elif '--update-masquerade-with-crossdev' in tmpcmdline:
isroot()
uninstalllinks()
print('Creating symlinks...')
installlinks()
elif '--get-env' in tmpcmdline:
if len(tmpcmdline) == 1:
print(open(envfile, 'r').read().rstrip())
elif len(tmpcmdline) == 2:
readenv(tmpcmdline[1])
else:
print('!!! Error: Specify only one variable.')
elif '--set-env' in tmpcmdline:
if len(tmpcmdline) > 2 and len(tmpcmdline) <= 3:
isroot()
writeenv(tmpcmdline[1],tmpcmdline[2])
else:
print('!!! Error: Awaiting two parameters.')
else:
cmd = sys.argv[:1][0]
print('Usage: %s --set-hosts DISTCC_HOSTS | --get-hosts' % (cmd))
print(' %s --set-verbose { 0 | 1 } | --get-verbose' % (cmd))
print(' %s --set-log FILE | --get-log' % (cmd))
print(' %s --set-env VARIABLE VALUE | --get-env [VARIABLE]' % (cmd))
print(' %s --update-masquerade' % (cmd))
print(' %s --update-masquerade-with-crossdev' % (cmd))

View file

@ -1,24 +0,0 @@
From: Gordon Malm <gengor@gentoo.org>
Make distcc client pass -D__KERNEL__ macro. Hardened GCC uses this
macro to determine if code intended to be run in-kernel is being compiled.
If the code is kernel code, certain compile flags are not applied.
When using distcc to build kernel code (modules, etc.) without this patch,
the distccd host doesn't get passed -D__KERNEL__. Consequently, gcc on
the distccd host applies all kinds of flags that it shouldn't.
--- distcc-2.18.3/src/strip.c
+++ distcc-2.18.3-hardened/src/strip.c
@@ -73,7 +73,10 @@ int dcc_strip_local_args(char **from, ch
/* skip through argv, copying all arguments but skipping ones that
* ought to be omitted */
for (from_i = to_i = 0; from[from_i]; from_i++) {
- if (str_equal("-D", from[from_i])
+ if (str_equal("-D__KERNEL__", from[from_i])) {
+ to[to_i++] = from[from_i];
+ }
+ else if (str_equal("-D", from[from_i])
|| str_equal("-I", from[from_i])
|| str_equal("-U", from[from_i])
|| str_equal("-L", from[from_i])

View file

@ -1,42 +0,0 @@
# /etc/conf.d/distccd: config file for /etc/init.d/distccd
DISTCCD_OPTS=""
# this is the distccd executable
DISTCCD_EXEC="/usr/bin/distccd"
# set this option to run distccd with extra parameters
# Default port is 3632. For most people the default is okay.
DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632"
# Logging
# You can change some logging options here:
# --log-file FILE
# --log-level LEVEL [critical,error,warning, notice, info, debug]
#
# Leaving --log-file blank will log to syslog
# example: --log-file /dev/null --log-level warning
# example: --log-level critical
DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical"
# SECURITY NOTICE:
# It is HIGHLY recommended that you use the --listen option
# for increased security. You can specify an IP to permit connections
# from or a CIDR mask
# --listen accepts only a single IP
# --allow is now mandatory as of distcc-2.18.
# example: --allow 192.168.0.0/24
# example: --allow 192.168.0.5 --allow 192.168.0.150
# example: --listen 192.168.0.2
DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.0/24"
#DISTCCD_OPTS="${DISTCCD_OPTS} --listen 192.168.0.2"
# set this for niceness
# Default is 15
DISTCCD_OPTS="${DISTCCD_OPTS} -N 15"
# By default distccd stores temporary files in /tmp
# Make sure to give distcc user write permission to
# the given TMPDIR
#TMPDIR="/tmp"

View file

@ -1,15 +0,0 @@
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
depend() {
need net
use avahi-daemon ypbind
}
command="${DISTCCD_EXEC:-usr/bin/distccd}"
command_args="--user distcc --daemon --no-detach ${DISTCCD_OPTS}"
command_background="true"
pidfile="/run/${RC_SVCNAME}.pid"
export TMPDIR="${TMPDIR:-/tmp}"

View file

@ -1,10 +0,0 @@
[Unit]
Description=Distccd: A Distributed Compilation Server
After=network.target
[Service]
User=distcc
ExecStart=/usr/bin/distccd --no-detach --daemon --port 3632 -N 15 --allow $ALLOWED_SERVERS
[Install]
WantedBy=multi-user.target

View file

@ -1,6 +0,0 @@
# --allow is now mandatory as of distcc-2.18.
# example: --allow 192.168.0.0/24
# example: --allow 192.168.0.5 --allow 192.168.0.150
[Service]
Environment="ALLOWED_SERVERS=127.0.0.1"