diff options
author | 2012-06-28 15:47:46 +0400 | |
---|---|---|
committer | 2012-06-28 15:47:46 +0400 | |
commit | b956f1626258686c5548c9d740d76d0b4675f7c6 (patch) | |
tree | 6cce77abc39d166649838f93efd0d8ba5a5599b9 /sys-devel | |
parent | svgalib: fix build with 3.4 kernels (diff) | |
download | bircoph-b956f1626258686c5548c9d740d76d0b4675f7c6.tar.gz bircoph-b956f1626258686c5548c9d740d76d0b4675f7c6.tar.bz2 bircoph-b956f1626258686c5548c9d740d76d0b4675f7c6.zip |
distcc: major ebuild update
This updates consists of three parts:
1) Compile and install cross-compilation helpers for x86<->amd64
transition. This includes additional daemons (and corresponding
configs for cross-compile gcc versions, helper scripts and program
for distcc servers and distcc-config update which regenerates
required links according to system gcc setup.
2) Security update, which enforces DISTCC_CMDLIST in order to allow
distcc server to serve only known and limited list of commands.
3) Various ebuild fixes and updates, including EAPI 4 change.
Diffstat (limited to 'sys-devel')
-rw-r--r-- | sys-devel/distcc/Manifest | 15 | ||||
-rw-r--r-- | sys-devel/distcc/distcc-3.2_rc1.ebuild | 138 | ||||
-rw-r--r-- | sys-devel/distcc/files/cc32_64/Makefile | 40 | ||||
-rw-r--r-- | sys-devel/distcc/files/cc32_64/c++.c | 2 | ||||
-rw-r--r-- | sys-devel/distcc/files/cc32_64/common.h | 24 | ||||
-rw-r--r-- | sys-devel/distcc/files/cc32_64/g++.c | 2 | ||||
-rw-r--r-- | sys-devel/distcc/files/cc32_64/gcc.c | 2 | ||||
-rw-r--r-- | sys-devel/distcc/files/distcc-config-3.2_rc1-v2 (renamed from sys-devel/distcc/files/distcc-config-3.2_rc1) | 89 | ||||
-rw-r--r-- | sys-devel/distcc/files/distccd.confd (renamed from sys-devel/distcc/files/3.0/conf) | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | sys-devel/distcc/files/distccd.initd (renamed from sys-devel/distcc/files/3.1/init) | 1 | ||||
-rw-r--r-- | sys-devel/distcc/metadata.xml | 2 |
11 files changed, 269 insertions, 50 deletions
diff --git a/sys-devel/distcc/Manifest b/sys-devel/distcc/Manifest index 2beec9c..8e6fc48 100644 --- a/sys-devel/distcc/Manifest +++ b/sys-devel/distcc/Manifest @@ -1,14 +1,19 @@ -AUX 3.0/conf 1286 RMD160 52f0fb469fc83b2f28f032c81515773d09add0d5 SHA1 4860a6e2eea10d918058b0cdcb76ac196a2d7992 SHA256 28fa9a9ce30c9f979eac3d5be3fc64f199ecffa9d7e38e02f11957019152dc46 -AUX 3.1/init 778 RMD160 4f8a3411315663074ef43a70e4ac8bbdebafc4b4 SHA1 87e7ef465be6b2c332c38a7f1c8e4ec5474c7d50 SHA256 f5c66a7212eb91f3dec55287a6c2b703b390c6894a933e51592f2762db7d2f73 +AUX cc32_64/Makefile 952 RMD160 26c0c1be1d4852a648e39ca297f1799e27a284fd SHA1 83b283ca9a591485a20aee5711504b42e057f645 SHA256 cb7dd6828ca450b314c13e0ae7a612fd8bae34aa7e60e58ca8cb0a7da8639ed9 +AUX cc32_64/c++.c 52 RMD160 c1582ed4aa5c26a83aaa09d6ce429a665132a266 SHA1 2b0e19a288ac12bece0592f9c1c207c650946f6e SHA256 0398246a6dd7088477fb551df67bb6d029f7a30f47a4f5d1bfc385de95d21579 +AUX cc32_64/common.h 698 RMD160 8aa348b3566d1fc00f999532d964103b4a05909b SHA1 5febc6acb9934306eefe7348ad124ec595678458 SHA256 b3bbcae7eab68aa73f211d4024da04dd1d12f627016759f37440213dfc9994a5 +AUX cc32_64/g++.c 52 RMD160 c6fb67725a94ad5b34150d711efc5490c52606ae SHA1 518de24dd2f46673e244975a0bae68d378d53f56 SHA256 2bd63b4051255a6015abdaac47b09e766adcb288a9afa500283abd9568e59669 +AUX cc32_64/gcc.c 52 RMD160 26df2796513102f731039ef86d92eba091297f59 SHA1 36815727da2b09baf9a75bc778c4030d440829f5 SHA256 c9b71b219600720f430175a9b473ea3a52fef75af47a4334279e3247a2b90a94 AUX distcc-3.0-fix-fortify.patch 313 RMD160 e5edc96a4bc4fe06a58878011cbb466184946b3e SHA1 386ee72a9d0b620dfc3aa75324060f764ed44e6d SHA256 7b57ae28dcef0c1ecd273a8a10dd1a16fa6a7af618d5438e1fe4398863fa8901 AUX distcc-3.0-xinetd.patch 558 RMD160 c69f8a379ec543972fac6ec3066989c5393223f3 SHA1 58d4393c6cdd3546f35efc57021de496c66c239d SHA256 9ef11743e91167548ac6324aa21608a62fd09149a8dbdbab32602f70804e0560 AUX distcc-3.2_rc1-crosscompile.patch 5029 RMD160 3b763c1b81390bd4565b50ec9426e3f0da967191 SHA1 5419d3effeadcecced0a735f637f1ceb71417406 SHA256 98f878fec98e19011505a4d43ee4719e615a76863af8d0e15c19784c9cd43fef AUX distcc-3.2_rc1-freedesktop.patch 3140 RMD160 7402c835493978e3a2e4b338bf783f1958f7694b SHA1 b117588006f1b3d6de3bb7034f0fa303c1957f1d SHA256 7ead1174fc170cee5c32ac183edf0c15ae35df56bedbbf6bc24c0099fe23b7f6 AUX distcc-3.2_rc1-gssapi.patch 1638 RMD160 88adbe60a6818075a7153ed99a638cb46418c86c SHA1 a911bdef83ca0d17dcbc7121e4dc71987c5fb6ce SHA256 2693fbf5b76ab64874e0a4bc1540067f402799dfabde5202a89ec045f1d88ea0 AUX distcc-3.2_rc1-python.patch 10592 RMD160 fd8af66d2470fd9a6823765fafd726d5a8a3b64c SHA1 21dba21ddd532c74f8ba337555bcb352b30c02be SHA256 935328943efe26f20bfb94952bc8bcb7f8536465db72411d81e6f3d1ade37989 -AUX distcc-config-3.2_rc1 5332 RMD160 5a51782d1dcff1fdb8af3deed6574869dbf36bd0 SHA1 5cc91a745b324a20230635685f5a670825f5a086 SHA256 b825a21dc43afe71f9c14697bd7070a3a6798a6b6089084bd6b26e0c4ea7c167 +AUX distcc-config-3.2_rc1-v2 7687 RMD160 2aa932ce472fa5027088f651341fcc90c95346de SHA1 ad251542f877739f6bc344ad5d13d5ef17f8df15 SHA256 272393da14729638b32e8e52a7c973d020a4ce84534fcf47ee81ae9250a057d9 AUX distcc-hardened.patch 1084 RMD160 0f11c9c8e8b56e91399b054fb57566e290a0baa5 SHA1 746f1905a9bc45ea7b71d71f4b1feba7d96d0f7f SHA256 dcf63f201cb7f4bf13eeb1485a5056c64370b9239d28e4acc77a47046dcda6cf +AUX distccd.confd 1292 RMD160 bf34ada03731828c0b499f6be309779b187a1d1e SHA1 975f873972aa09e530dc64bfbde621ad60944f85 SHA256 95c1118098be6e6594442ee841a0b58c1aa72d0059d91c10001bd449336fba2b +AUX distccd.initd 817 RMD160 c7f472435061117b274cc123b902901711820bef SHA1 da4be51473817ea804d12173240d9a06393fceea SHA256 c5b65cfe4ba84a0ba33a2b6bd3fa1abdff5591eaf596d4b65a7e39af22f23668 DIST distcc-3.2rc1.tar.bz2 609904 RMD160 505447b910d90ea403a98fe0d0a3a0fa92cd7039 SHA1 7564e4a4890ad6ff78ec0de620329b71179361e7 SHA256 311671e844625d7fdb18dd3d096cd855751cfe8de13827682bcb7beff9133b30 -EBUILD distcc-3.2_rc1.ebuild 5866 RMD160 661416401f534e4a616e1782edab3c96336412ca SHA1 2c6163befb66031637a16bdf7c8239465c7198fa SHA256 d2fcd69552e0807c8262f4e8f484bf45a021ac41af8bfbd4e6acfe6eab43d69e +EBUILD distcc-3.2_rc1.ebuild 7855 RMD160 048680fb461f5c234d8a30dde78bfe90ad9deb18 SHA1 065fd8b0f7477f1c6c95ccd5e25d0c69a070b5f5 SHA256 d0e3c426e81c0f369869f29c29120173d5dfe17e916fef95a4307a3be1cb7df1 MISC ChangeLog 39013 RMD160 ed5599776bf39550454122f8cfe6694df6161f75 SHA1 cc8d97d75c630738edaaf6c26985fa4b3f73f2f7 SHA256 14cb2096de869443987101c0540d479ab3554d9bfca2058579986048833a5e36 -MISC metadata.xml 546 RMD160 51a7caedb84842f9efa58ce9ec9da75b60e9378d SHA1 0d8767f8e7ca64a5c2c00eb4c20102955c2c12c1 SHA256 e94ab6ea446d8831bc33afa52dc75b25255bef5a05a1c2af22ba5b1ffc8d55d8 +MISC metadata.xml 881 RMD160 5eec7d92db605b2a18916a50346c6059f400b9dd SHA1 d4c4d42151af95f29e14e1e560a352ac66a53750 SHA256 d65af84bc59b5847e7a126d69160714fd49ef0d01838af2f6e60accb8d4a99fb diff --git a/sys-devel/distcc/distcc-3.2_rc1.ebuild b/sys-devel/distcc/distcc-3.2_rc1.ebuild index 88ba2d7..100b0f5 100644 --- a/sys-devel/distcc/distcc-3.2_rc1.ebuild +++ b/sys-devel/distcc/distcc-3.2_rc1.ebuild @@ -2,10 +2,10 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-devel/distcc/distcc-3.2_rc1.ebuild,v 1.3 2012/05/04 07:24:15 jdhore Exp $ -EAPI="3" +EAPI="4" PYTHON_DEPEND="2:2.5" -inherit autotools eutils fdo-mime flag-o-matic multilib python toolchain-funcs +inherit autotools eutils fdo-mime flag-o-matic multilib python toolchain-funcs user MY_P="${P/_}" DESCRIPTION="a program to distribute compilation of C code across several machines on a network" @@ -15,12 +15,16 @@ SRC_URI="http://distcc.googlecode.com/files/${MY_P}.tar.bz2" LICENSE="GPL-2" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" -IUSE="avahi crossdev gnome gssapi gtk hardened ipv6 selinux xinetd" +IUSE="avahi cc32_64 crossdev gnome gssapi gtk hardened ipv6 +secure selinux xinetd" RESTRICT="test" RDEPEND="dev-libs/popt avahi? ( >=net-dns/avahi-0.6[dbus] ) + cc32_64? ( + amd64? ( sys-devel/gcc[multilib] ) + x86? ( cross-x86_64-pc-linux-gnu/gcc ) + ) gnome? ( >=gnome-base/libgnome-2 >=gnome-base/libgnomeui-2 @@ -37,6 +41,13 @@ RDEPEND="${RDEPEND} selinux? ( sec-policy/selinux-distcc ) xinetd? ( sys-apps/xinetd )" +# crosscompilation requirements +REQUIRED_USE=" + cc32_64? ( + !crossdev + ^^ ( amd64 x86 ) + )" + S="${WORKDIR}/${MY_P}" DCCC_PATH="/usr/$(get_libdir)/distcc/bin" @@ -45,6 +56,11 @@ pkg_setup() { enewuser distcc 240 -1 -1 daemon python_set_active_version 2 python_pkg_setup + + if use cc32_64; then + use x86 && arch="amd64" + use amd64 && arch="x86" + fi } src_prepare() { @@ -72,10 +88,43 @@ src_prepare() { sed \ -e "s:@EPREFIX@:${EPREFIX:-/}:" \ -e "s:@libdir@:/usr/$(get_libdir):" \ - "${FILESDIR}/distcc-config-3.2_rc1" > "${T}/distcc-config" || die + "${FILESDIR}/distcc-config-3.2_rc1-v2" > "${T}/distcc-config" || die "sed failed" + + # prepare conf.d before we fork it + cp "${FILESDIR}/distccd.confd" "${T}/distccd.confd-base" || die "cp failed" + if use avahi; then + cat >> "${T}/distccd.confd" <<-EOF + + # Enable zeroconf support in distccd + DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf" + EOF + fi + + # conf.d and init.d arch deps + sed -e "s%@DCCBIN@%distccd%" \ + -e "s%@DCCPORT@%3632%" \ + "${T}/distccd.confd-base" > "${T}/distccd.confd" || die "sed failed" + + sed -e "s%@DCCPATH@%%" \ + "${FILESDIR}/distccd.initd" > "${T}/distccd.initd" || die "sed failed" + + # conf.d and init.d common deps + if use cc32_64; then + sed -e "s%@DCCBIN@%distccd-${arch}%" \ + -e "s%@DCCPORT@%3633%" \ + "${T}/distccd.confd-base" > "${T}/distccd-${arch}.confd" || die "sed failed" + + sed -e "s%@DCCPATH@%${EPREFIX}${DCCC_PATH}-${arch}:%" \ + "${FILESDIR}/distccd.initd" > "${T}/distccd-${arch}.initd" || die "sed failed" + fi eaclocal -Im4 --output=aclocal.m4 eautoconf + + if use cc32_64 && use amd64; then + mkdir "${S}/bin-i686" + cp "${FILESDIR}"/cc32_64/* "${S}/bin-i686" || die "helper cp failed" + fi } src_configure() { @@ -95,22 +144,25 @@ src_configure() { ${myconf} || die "econf failed" } -src_install() { - emake DESTDIR="${D}" install || die - - dobin "${FILESDIR}/3.0/distcc-config" || die +src_compile() { + default + use cc32_64 && use amd64 && emake -C "${S}/bin-i686" +} - newinitd "${FILESDIR}/3.1/init" distccd || die +src_install() { + emake DESTDIR="${D}" install - cp "${FILESDIR}/3.0/conf" "${T}/distccd" || die - if use avahi; then - cat >> "${T}/distccd" <<-EOF + if use cc32_64 && use amd64; then + insinto "${DCCC_PATH}-i686" + doins "${S}/{c++,g++,gcc}" + fi - # Enable zeroconf support in distccd - DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf" - EOF + newinitd "${T}/distccd.initd" distccd + newconfd "${T}/distccd.confd" distccd + if use cc32_64; then + newinitd "${T}/distccd-${arch}.initd" "distccd-${arch}" + newconfd "${T}/distccd-${arch}.confd" "distccd-${arch}" fi - doconfd "${T}/distccd" || die cat > "${T}/02distcc" <<-EOF # This file is managed by distcc-config; use it to change these settings. @@ -118,32 +170,39 @@ src_install() { DISTCC_VERBOSE="${DISTCC_VERBOSE:-0}" DISTCC_FALLBACK="${DISTCC_FALLBACK:-1}" DISTCC_SAVE_TEMPS="${DISTCC_SAVE_TEMPS:-0}" - DISTCC_TCP_CORK="${DISTCC_TCP_CORK}" + DISTCC_TCP_CORK="${DISTCC_TCP_CORK:-1}" 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 - doenvd "${T}/02distcc" || die + if use secure; then + cat >> "${T}/02distcc" <<-EOF + # Enable list of allowed commands + DISTCC_CMDLIST_NUMWORDS="1" + DISTCC_CMDLIST="${EPREFIX}/etc/distcc/commands.allow" + EOF + fi + doenvd "${T}/02distcc" - keepdir "${DCCC_PATH}" || die + keepdir "${DCCC_PATH}" - dobin "${T}/distcc-config" || die + dobin "${T}/distcc-config" # create the distccd pid directory - keepdir /var/run/distccd || die - fowners distcc:daemon /var/run/distccd || die + keepdir /var/run/distccd + fowners distcc:daemon /var/run/distccd if use gnome || 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 || die + dosym distccmon-gui /usr/bin/distccmon-gnome fi if use xinetd; then insinto /etc/xinetd.d || die - newins "doc/example/xinetd" distcc || die + newins "doc/example/xinetd" distcc fi rm -r "${ED}/etc/default" || die @@ -152,13 +211,7 @@ src_install() { } pkg_postinst() { - if [ -x "${EPREFIX}/usr/bin/distcc-config" ] ; then - if use crossdev; then - "${EPREFIX}/usr/bin/distcc-config" --update-masquerade-with-crossdev - else - "${EPREFIX}/usr/bin/distcc-config" --update-masquerade - fi - fi + pkg_config python_mod_optimize include_server use gnome && fdo-mime_desktop_database_update @@ -186,16 +239,37 @@ pkg_postinst() { elog "update your /etc/conf.d/distccd and /etc/init.d/distccd files with" elog "added security precautions (the --listen and --allow directives)" elog + + ewarn "On gcc version bump please do not forget to update distcc setup." + ewarn "You may do this by running emerge --config distcc" + ewarn } pkg_postrm() { # delete the masquerade directory if [ ! -f "${EPREFIX}/usr/bin/distcc" ] ; then einfo "Remove masquerade symbolic links." - rm "${EPREFIX}${DCCC_PATH}/"*{cc,c++,gcc,g++} + rm "${EPREFIX}${DCCC_PATH}/"*{cc,c++,gcc,g++}* rmdir "${EPREFIX}${DCCC_PATH}" fi python_mod_cleanup include_server use gnome && fdo-mime_desktop_database_update } + +pkg_config() { + if [ -x "${EPREFIX}/usr/bin/distcc-config" ] ; then + if use crossdev; then + "${EPREFIX}/usr/bin/distcc-config" --update-masquerade-with-crossdev + elif use cc32_64; then + "${EPREFIX}/usr/bin/distcc-config" --update-masquerade-with-cc32_64 + else + "${EPREFIX}/usr/bin/distcc-config" --update-masquerade + fi + + use secure && "${EPREFIX}/usr/bin/distcc-config" --generate-cmdlist + else + eerror "${EPREFIX}/usr/bin/distcc-config was not found!" + eerror "Your distcc installation is broken." + fi +} diff --git a/sys-devel/distcc/files/cc32_64/Makefile b/sys-devel/distcc/files/cc32_64/Makefile new file mode 100644 index 0000000..3a96b48 --- /dev/null +++ b/sys-devel/distcc/files/cc32_64/Makefile @@ -0,0 +1,40 @@ +# dist-utils Makefile +# Copyright © 2009 Andrew Savchenko +# +# This file is part of distcc-utils. +# +# distcc-utils is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3 as +# published by the Free Software Foundation +# +# distcc-utils is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License version 3 for more details. +# +# You should have received a copy of the GNU General Public License version 3 +# along with distcc-utils. If not, see <http://www.gnu.org/licenses/>. +# + +CC ?= gcc +CFLAGS += --std=gnu99 -Wall -D_GNU_SOURCE +LDFLAGS ?= -Wl,-O1 $(CFLAGS) + +SRCS = gcc.c g++.c c++.c + +BINS = $(SRCS:.c=) + +%.c: common.h + +all: $(BINS) + +tags: + ctags *.c + +clean: + rm -f $(BINS) + +distclean: clean + rm -f tags + +.PHONY: all tags clean distclean diff --git a/sys-devel/distcc/files/cc32_64/c++.c b/sys-devel/distcc/files/cc32_64/c++.c new file mode 100644 index 0000000..565ab4c --- /dev/null +++ b/sys-devel/distcc/files/cc32_64/c++.c @@ -0,0 +1,2 @@ +char *const bin="/usr/bin/c++"; +#include "common.h" diff --git a/sys-devel/distcc/files/cc32_64/common.h b/sys-devel/distcc/files/cc32_64/common.h new file mode 100644 index 0000000..8abbceb --- /dev/null +++ b/sys-devel/distcc/files/cc32_64/common.h @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +int main(const int argc, char *const argv[]) +{ + // + space for extra arguments and NULL terminator + char **const list = malloc(sizeof(char*) * (argc + 3)); + // extract file name, /usr/bin/name is assumed + list[0] = bin; + // architecture must be forced due to some buggy build systems + list[1] = "-m32"; + list[2] = "-march=i686"; + // copy all other options; + for (int i = 1; i < argc; i++) + list[i+2] = argv[i]; + // list must be NULL-terminated + list[argc + 2] = NULL; + // call actual compiler + execv(bin, list); + // we should be never here + perror("Failed to execv()"); + return 1; +} diff --git a/sys-devel/distcc/files/cc32_64/g++.c b/sys-devel/distcc/files/cc32_64/g++.c new file mode 100644 index 0000000..83c8ec2 --- /dev/null +++ b/sys-devel/distcc/files/cc32_64/g++.c @@ -0,0 +1,2 @@ +char *const bin="/usr/bin/g++"; +#include "common.h" diff --git a/sys-devel/distcc/files/cc32_64/gcc.c b/sys-devel/distcc/files/cc32_64/gcc.c new file mode 100644 index 0000000..312eaea --- /dev/null +++ b/sys-devel/distcc/files/cc32_64/gcc.c @@ -0,0 +1,2 @@ +char *const bin="/usr/bin/gcc"; +#include "common.h" diff --git a/sys-devel/distcc/files/distcc-config-3.2_rc1 b/sys-devel/distcc/files/distcc-config-3.2_rc1-v2 index 6d13810..fd0a3fe 100644 --- a/sys-devel/distcc/files/distcc-config-3.2_rc1 +++ b/sys-devel/distcc/files/distcc-config-3.2_rc1-v2 @@ -14,6 +14,8 @@ options=[ '--set-log', '--update-masquerade', '--update-masquerade-with-crossdev', + '--update-masquerade-with-cc32_64', + '--generate-cmdlist', '--help', '--get-env', '--set-env' @@ -22,16 +24,17 @@ options=[ tmpcmdline=sys.argv[1:] cmdline=[] -eprefix = '@EPREFIX@' +eprefix = '/' bindir = os.path.join(eprefix, 'usr', 'bin') sbindir = os.path.join(eprefix, 'usr', 'sbin') -libdir = os.path.join(eprefix, '@libdir@') +libdir = os.path.join(eprefix, '/usr/lib') 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') +cmdlist_file = os.path.join(default_distcc_dir, 'commands.allow') hostfile = os.path.join(default_distcc_dir, 'hosts') distcc_path = os.path.join(bindir, 'distcc') dccc_dir = os.path.join(libdir, 'distcc', 'bin') @@ -53,6 +56,11 @@ def isroot(ret=0): retval = 1 return retval +def run_env_update(): + 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 writeenv(var,value): isroot() distcc_env = [] @@ -63,9 +71,7 @@ def writeenv(var,value): 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.') + run_env_update() def readenv(var): distcc_env = open(envfile, 'r').read() @@ -75,8 +81,19 @@ def readenv(var): else: print(var,'not set.') -def installlink(chost='', version=''): +def installlink(chost='', version='', cc_arch=''): for file in ['gcc', 'cc', 'c++', 'g++']: + if cc_arch == '': + src_path = distcc_path + else: + if chost == '': + if file == 'cc': + src_path = 'gcc' + else: + src_path = os.path.join(bindir, cc_arch+'-pc-linux-gnu-'+file) + else: + src_path = file + if not chost == '': file = '%s-%s' % (chost,file) if not version == '': @@ -85,11 +102,20 @@ def installlink(chost='', version=''): 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) + os.symlink(src_path,path) #else: # print('Already exists. Skipping...') -def installlinks(): +def loopcc_links(chost, version, cc_arch): + installlink(chost, '', cc_arch) + installlink(chost, version, cc_arch) + +def loopcc_cmdlist(chost, version, cmdlist): + for name in ['gcc', 'c++', 'g++']: + cmdlist.append('%s-%s' % (chost, name)) + cmdlist.append('%s-%s-%s' % (chost, name, version)) + +def loopcc(cb, cc_arch=''): p = subprocess.Popen([gcc_config+" -C -l"], shell=True, stdout=subprocess.PIPE) lines = p.stdout.read().rstrip().split('\n') for line in lines: @@ -98,13 +124,17 @@ def installlinks(): matches = re.match("(.*)-(.*)", columns[1]) chost = matches.group(1) version = matches.group(2) - installlink(chost) - installlink(chost, version) + cb(chost, version, cc_arch) + +def installlinks(cc_arch=''): + loopcc(loopcc_links, cc_arch) def uninstalllinks(): for root, dirs, files in os.walk(dccc_dir): for file in files: - os.remove(os.path.join(root, file)) + path = os.path.join(root, file) + if os.path.islink(path): + os.remove(path) def createdistccdir(dir): if not os.path.exists(dir): @@ -158,6 +188,41 @@ elif '--update-masquerade-with-crossdev' in tmpcmdline: uninstalllinks() print('Creating symlinks...') installlinks() +elif '--update-masquerade-with-cc32_64' in tmpcmdline: + isroot() + arch_curr = os.uname()[4] + arch_supp = set(['i686', 'amd64']) + if not arch_curr in arch_supp: + print('Architecure %s is not supported for cross-compilation i68<->amd64 setup' % (arch)) + sys.exit(1) + + # normal setup + uninstalllinks() + print('Creating symlinks for host arch...') + createdistccdir(dccc_dir) + installlink() + installlinks() + + # cross-compile helpers + cc_arch = (arch_supp - set([arch_curr])).pop() + dccc_dir = os.path.join(libdir, 'distcc', 'bin-'+cc_arch) + uninstalllinks() + print('Creating symlinks for cross-compile arch...') + createdistccdir(dccc_dir) + installlink('', '', arch_curr) + installlinks(arch_curr) +elif '--generate-cmdlist' in tmpcmdline: + isroot() + # standard compilers list + cmdlist = ['gcc', 'cc', 'c++', 'g++'] + # arch-specific compilers list + loopcc(loopcc_cmdlist, cmdlist) + + cmdfile = open(cmdlist_file, 'w') + for name in sorted(set(cmdlist)): + cmdfile.write(name + "\n") + + run_env_update() elif '--get-env' in tmpcmdline: if len(tmpcmdline) == 1: print(open(envfile, 'r').read().rstrip()) @@ -179,3 +244,5 @@ else: print(' %s --set-env VARIABLE VALUE | --get-env [VARIABLE]' % (cmd)) print(' %s --update-masquerade' % (cmd)) print(' %s --update-masquerade-with-crossdev' % (cmd)) + print(' %s --update-masquerade-with-cc32_64' % (cmd)) + print(' %s --generate-cmdlist' % (cmd)) diff --git a/sys-devel/distcc/files/3.0/conf b/sys-devel/distcc/files/distccd.confd index eb784c3..a3a6aa9 100644 --- a/sys-devel/distcc/files/3.0/conf +++ b/sys-devel/distcc/files/distccd.confd @@ -6,11 +6,11 @@ DISTCCD_OPTS="" DISTCCD_EXEC="/usr/bin/distccd" # this is where distccd will store its pid file -DISTCCD_PIDFILE="/var/run/distccd/distccd.pid" +DISTCCD_PIDFILE="/var/run/distccd/@DCCBIN@.pid" # 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" +DISTCCD_OPTS="${DISTCCD_OPTS} --port @DCCPORT@" # Logging # You can change some logging options here: diff --git a/sys-devel/distcc/files/3.1/init b/sys-devel/distcc/files/distccd.initd index 02a9dc2..266ce13 100755..100644 --- a/sys-devel/distcc/files/3.1/init +++ b/sys-devel/distcc/files/distccd.initd @@ -18,6 +18,7 @@ start() { # Load PATH and GCC_SPECS from gcc-config, bug #262773 eval "$(gcc-config -E)" + export PATH="@DCCPATH@${PATH}" start-stop-daemon --start --quiet --exec "${DISTCCD_EXEC}" --user distcc -- \ --daemon --pid-file "${DISTCCD_PIDFILE}" \ diff --git a/sys-devel/distcc/metadata.xml b/sys-devel/distcc/metadata.xml index f1a9c5a..a201dcf 100644 --- a/sys-devel/distcc/metadata.xml +++ b/sys-devel/distcc/metadata.xml @@ -10,7 +10,9 @@ machines on a network. </longdescription> <use> + <flag name="cc32_64">Enable second distcc server to crosscompile amd64 on x86 host or vice versa depending on your host architecture </flag> <flag name="crossdev">Enable support for <pkg>sys-devel/crossdev</pkg></flag> <flag name="gssapi">Enable support for <pkg>net-libs/libgssglue</pkg></flag> + <flag name="secure">Limit the list of allowed commands by the list of installed compilers. Otherwise crafted client may execute arbitrary command on a server host with distcc user id</flag> </use> </pkgmetadata> |