From b64eb2f7af96867a39670527daa6aaaa37bc05e2 Mon Sep 17 00:00:00 2001 From: Sergey Popov Date: Thu, 22 Oct 2015 18:14:39 +0300 Subject: sys-devel/distcc: revision bump Distcc-config appears to be installed twice, which is wrong. Also, create separate subdirectory for config files and initscripts, related to 3.2 branch of package. Drop old revision. Gentoo-Bug: 523658 Package-Manager: portage-2.2.20 --- sys-devel/distcc/distcc-3.2_rc1-r3.ebuild | 207 --------------------------- sys-devel/distcc/distcc-3.2_rc1-r4.ebuild | 205 ++++++++++++++++++++++++++ sys-devel/distcc/files/3.2/conf | 40 ++++++ sys-devel/distcc/files/3.2/distcc-config | 181 +++++++++++++++++++++++ sys-devel/distcc/files/3.2/init | 32 +++++ sys-devel/distcc/files/distcc-config-3.2_rc1 | 181 ----------------------- 6 files changed, 458 insertions(+), 388 deletions(-) delete mode 100644 sys-devel/distcc/distcc-3.2_rc1-r3.ebuild create mode 100644 sys-devel/distcc/distcc-3.2_rc1-r4.ebuild create mode 100644 sys-devel/distcc/files/3.2/conf create mode 100644 sys-devel/distcc/files/3.2/distcc-config create mode 100644 sys-devel/distcc/files/3.2/init delete mode 100644 sys-devel/distcc/files/distcc-config-3.2_rc1 (limited to 'sys-devel/distcc') diff --git a/sys-devel/distcc/distcc-3.2_rc1-r3.ebuild b/sys-devel/distcc/distcc-3.2_rc1-r3.ebuild deleted file mode 100644 index 29e2e0fc9b94..000000000000 --- a/sys-devel/distcc/distcc-3.2_rc1-r3.ebuild +++ /dev/null @@ -1,207 +0,0 @@ -# Copyright 1999-2015 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -EAPI=5 - -PYTHON_COMPAT=( python2_7 ) - -inherit autotools eutils fdo-mime flag-o-matic multilib python-single-r1 systemd toolchain-funcs user - -MY_P="${P/_}" -DESCRIPTION="Distribute compilation of C code across several machines on a network" -HOMEPAGE="http://distcc.org/" -SRC_URI="https://distcc.googlecode.com/files/${MY_P}.tar.bz2" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" -IUSE="avahi crossdev gnome gssapi gtk hardened ipv6 selinux xinetd" - -RESTRICT="test" - -CDEPEND="${PYTHON_DEPS} - dev-libs/popt - avahi? ( >=net-dns/avahi-0.6[dbus] ) - gnome? ( - >=gnome-base/libgnome-2 - >=gnome-base/libgnomeui-2 - x11-libs/gtk+:2 - x11-libs/pango - ) - gssapi? ( net-libs/libgssglue ) - gtk? ( x11-libs/gtk+:2 )" -DEPEND="${CDEPEND} - virtual/pkgconfig" -RDEPEND="${CDEPEND} - !net-misc/pump - >=sys-devel/gcc-config-1.4.1 - selinux? ( sec-policy/selinux-distcc ) - xinetd? ( sys-apps/xinetd )" - -REQUIRED_USE="${PYTHON_REQUIRED_USE}" - -S="${WORKDIR}/${MY_P}" - -DCCC_PATH="/usr/$(get_libdir)/distcc/bin" -DISTCC_VERBOSE="0" - -pkg_setup() { - enewuser distcc 240 -1 -1 daemon - python-single-r1_pkg_setup -} - -src_prepare() { - epatch "${FILESDIR}/${PN}-3.0-xinetd.patch" - # bug #253786 - epatch "${FILESDIR}/${PN}-3.0-fix-fortify.patch" - # bug #255188 - epatch "${FILESDIR}/${PN}-3.2_rc1-freedesktop.patch" - # bug #258364 - epatch "${FILESDIR}/${PN}-3.2_rc1-python.patch" - # for net-libs/libgssglue - epatch "${FILESDIR}/${PN}-3.2_rc1-gssapi.patch" - # SOCKSv5 support needed for Portage, bug #537616 - epatch "${FILESDIR}/${PN}-3.2_rc1-socks5.patch" - epatch_user - - # Bugs #120001, #167844 and probably more. See patch for description. - use hardened && epatch "${FILESDIR}/distcc-hardened.patch" - - sed -i \ - -e "/PATH/s:\$distcc_location:${EPREFIX}${DCCC_PATH}:" \ - -e "s:@PYTHON@:${EPYTHON}:" \ - pump.in || die "sed failed" - - sed \ - -e "s:@EPREFIX@:${EPREFIX:-/}:" \ - -e "s:@libdir@:/usr/$(get_libdir):" \ - "${FILESDIR}/distcc-config-3.2_rc1" > "${T}/distcc-config" || die - - eaclocal -Im4 --output=aclocal.m4 - eautoconf -} - -src_configure() { - local myconf="--disable-Werror --with-docdir=/usr/share/doc/${PF}" - # More legacy stuff? - [ "$(gcc-major-version)" = "2" ] && filter-lfs-flags - - # --disable-rfc2553 b0rked, bug #254176 - use ipv6 && myconf="${myconf} --enable-rfc2553" - - econf \ - $(use_with avahi) \ - $(use_with gtk) \ - $(use_with gnome) \ - $(use_with gssapi auth) \ - ${myconf} -} - -src_install() { - default - python_optimize - - dobin "${FILESDIR}/3.0/distcc-config" - - newinitd "${FILESDIR}/3.1/init" distccd - systemd_dounit "${FILESDIR}/distccd.service" - systemd_install_serviced "${FILESDIR}/distccd.service.conf" - - cp "${FILESDIR}/3.0/conf" "${T}/distccd" || die - if use avahi; then - cat >> "${T}/distccd" <<-EOF - - # Enable zeroconf support in distccd - DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf" - EOF - - sed -i '/ExecStart/ s|$| --zeroconf|' "${ED}"/usr/lib/systemd/system/distccd.service || die - fi - doconfd "${T}/distccd" || die - - cat > "${T}/02distcc" <<-EOF - # 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 - doenvd "${T}/02distcc" || die - - keepdir "${DCCC_PATH}" || die - - dobin "${T}/distcc-config" || die - - # create the distccd pid directory - keepdir /var/run/distccd || die - fowners distcc:daemon /var/run/distccd || die - - 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 - fi - - if use xinetd; then - insinto /etc/xinetd.d || die - newins "doc/example/xinetd" distcc || die - fi - - rm -r "${ED}/etc/default" || die - rm "${ED}/etc/distcc/clients.allow" || die - rm "${ED}/etc/distcc/commands.allow.sh" || die -} - -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 - - use gnome && fdo-mime_desktop_database_update - - elog - elog "Tips on using distcc with Gentoo can be found at" - elog "https://www.gentoo.org/doc/en/distcc.xml" - elog - elog "How to use pump mode with Gentoo:" - elog "# distcc-config --set-hosts \"foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo\"" - elog "# echo 'FEATURES=\"\${FEATURES} distcc distcc-pump\"' >> /etc/portage/make.conf" - elog "# emerge -u world" - 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 gnome || use gtk; then - elog "Or:" - elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-gnome" - fi - - elog - elog "***SECURITY NOTICE***" - elog "If you are upgrading distcc please make sure to run etc-update to" - elog "update your /etc/conf.d/distccd and /etc/init.d/distccd files with" - elog "added security precautions (the --listen and --allow directives)" - elog -} - -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++} - rmdir "${EPREFIX}${DCCC_PATH}" - fi - - use gnome && fdo-mime_desktop_database_update -} diff --git a/sys-devel/distcc/distcc-3.2_rc1-r4.ebuild b/sys-devel/distcc/distcc-3.2_rc1-r4.ebuild new file mode 100644 index 000000000000..5dbdc1693d46 --- /dev/null +++ b/sys-devel/distcc/distcc-3.2_rc1-r4.ebuild @@ -0,0 +1,205 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 ) + +inherit autotools eutils fdo-mime flag-o-matic multilib python-single-r1 systemd toolchain-funcs user + +MY_P="${P/_}" +DESCRIPTION="Distribute compilation of C code across several machines on a network" +HOMEPAGE="http://distcc.org/" +SRC_URI="https://distcc.googlecode.com/files/${MY_P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" +IUSE="avahi crossdev gnome gssapi gtk hardened ipv6 selinux xinetd" + +RESTRICT="test" + +CDEPEND="${PYTHON_DEPS} + dev-libs/popt + avahi? ( >=net-dns/avahi-0.6[dbus] ) + gnome? ( + >=gnome-base/libgnome-2 + >=gnome-base/libgnomeui-2 + x11-libs/gtk+:2 + x11-libs/pango + ) + gssapi? ( net-libs/libgssglue ) + gtk? ( x11-libs/gtk+:2 )" +DEPEND="${CDEPEND} + virtual/pkgconfig" +RDEPEND="${CDEPEND} + !net-misc/pump + >=sys-devel/gcc-config-1.4.1 + selinux? ( sec-policy/selinux-distcc ) + xinetd? ( sys-apps/xinetd )" + +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +S="${WORKDIR}/${MY_P}" + +DCCC_PATH="/usr/$(get_libdir)/distcc/bin" +DISTCC_VERBOSE="0" + +pkg_setup() { + enewuser distcc 240 -1 -1 daemon + python-single-r1_pkg_setup +} + +src_prepare() { + epatch "${FILESDIR}/${PN}-3.0-xinetd.patch" + # bug #253786 + epatch "${FILESDIR}/${PN}-3.0-fix-fortify.patch" + # bug #255188 + epatch "${FILESDIR}/${PN}-3.2_rc1-freedesktop.patch" + # bug #258364 + epatch "${FILESDIR}/${PN}-3.2_rc1-python.patch" + # for net-libs/libgssglue + epatch "${FILESDIR}/${PN}-3.2_rc1-gssapi.patch" + # SOCKSv5 support needed for Portage, bug #537616 + epatch "${FILESDIR}/${PN}-3.2_rc1-socks5.patch" + epatch_user + + # Bugs #120001, #167844 and probably more. See patch for description. + use hardened && epatch "${FILESDIR}/distcc-hardened.patch" + + sed -i \ + -e "/PATH/s:\$distcc_location:${EPREFIX}${DCCC_PATH}:" \ + -e "s:@PYTHON@:${EPYTHON}:" \ + pump.in || die "sed failed" + + sed \ + -e "s:@EPREFIX@:${EPREFIX:-/}:" \ + -e "s:@libdir@:/usr/$(get_libdir):" \ + "${FILESDIR}/3.2/distcc-config" > "${T}/distcc-config" || die + + eaclocal -Im4 --output=aclocal.m4 + eautoconf +} + +src_configure() { + local myconf="--disable-Werror --with-docdir=/usr/share/doc/${PF}" + # More legacy stuff? + [ "$(gcc-major-version)" = "2" ] && filter-lfs-flags + + # --disable-rfc2553 b0rked, bug #254176 + use ipv6 && myconf="${myconf} --enable-rfc2553" + + econf \ + $(use_with avahi) \ + $(use_with gtk) \ + $(use_with gnome) \ + $(use_with gssapi auth) \ + ${myconf} +} + +src_install() { + default + python_optimize + + newinitd "${FILESDIR}/3.2/init" distccd + systemd_dounit "${FILESDIR}/distccd.service" + systemd_install_serviced "${FILESDIR}/distccd.service.conf" + + cp "${FILESDIR}/3.2/conf" "${T}/distccd" || die + if use avahi; then + cat >> "${T}/distccd" <<-EOF + + # Enable zeroconf support in distccd + DISTCCD_OPTS="\${DISTCCD_OPTS} --zeroconf" + EOF + + sed -i '/ExecStart/ s|$| --zeroconf|' "${ED}"/usr/lib/systemd/system/distccd.service || die + fi + doconfd "${T}/distccd" || die + + cat > "${T}/02distcc" <<-EOF + # 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 + doenvd "${T}/02distcc" || die + + keepdir "${DCCC_PATH}" || die + + dobin "${T}/distcc-config" || die + + # create the distccd pid directory + keepdir /var/run/distccd || die + fowners distcc:daemon /var/run/distccd || die + + 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 + fi + + if use xinetd; then + insinto /etc/xinetd.d || die + newins "doc/example/xinetd" distcc || die + fi + + rm -r "${ED}/etc/default" || die + rm "${ED}/etc/distcc/clients.allow" || die + rm "${ED}/etc/distcc/commands.allow.sh" || die +} + +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 + + use gnome && fdo-mime_desktop_database_update + + elog + elog "Tips on using distcc with Gentoo can be found at" + elog "https://www.gentoo.org/doc/en/distcc.xml" + elog + elog "How to use pump mode with Gentoo:" + elog "# distcc-config --set-hosts \"foo,cpp,lzo bar,cpp,lzo baz,cpp,lzo\"" + elog "# echo 'FEATURES=\"\${FEATURES} distcc distcc-pump\"' >> /etc/portage/make.conf" + elog "# emerge -u world" + 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 gnome || use gtk; then + elog "Or:" + elog "# DISTCC_DIR=\"${DISTCC_DIR:-${BUILD_PREFIX}/.distcc}\" distccmon-gnome" + fi + + elog + elog "***SECURITY NOTICE***" + elog "If you are upgrading distcc please make sure to run etc-update to" + elog "update your /etc/conf.d/distccd and /etc/init.d/distccd files with" + elog "added security precautions (the --listen and --allow directives)" + elog +} + +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++} + rmdir "${EPREFIX}${DCCC_PATH}" + fi + + use gnome && fdo-mime_desktop_database_update +} diff --git a/sys-devel/distcc/files/3.2/conf b/sys-devel/distcc/files/3.2/conf new file mode 100644 index 000000000000..c499271685e9 --- /dev/null +++ b/sys-devel/distcc/files/3.2/conf @@ -0,0 +1,40 @@ +# /etc/conf.d/distccd: config file for /etc/init.d/distccd + +DISTCCD_OPTS="" + +# this is the distccd executable +DISTCCD_EXEC="/usr/bin/distccd" + +# this is where distccd will store its pid file +DISTCCD_PIDFILE="/var/run/distccd/distccd.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" + +# 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" diff --git a/sys-devel/distcc/files/3.2/distcc-config b/sys-devel/distcc/files/3.2/distcc-config new file mode 100644 index 000000000000..6f3bd27e40f0 --- /dev/null +++ b/sys-devel/distcc/files/3.2/distcc-config @@ -0,0 +1,181 @@ +#!/usr/bin/env python2 +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +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().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)) diff --git a/sys-devel/distcc/files/3.2/init b/sys-devel/distcc/files/3.2/init new file mode 100644 index 000000000000..f7009f6e3101 --- /dev/null +++ b/sys-devel/distcc/files/3.2/init @@ -0,0 +1,32 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + need net + use avahi-daemon ypbind +} + +start() { + ebegin "Starting distccd" + + if [ ! -e /var/run/distccd ] ; then + mkdir -p /var/run/distccd + chown distcc:daemon /var/run/distccd + fi + + # Load PATH and GCC_SPECS from gcc-config, bug #262773 + eval "$(gcc-config -E)" + + start-stop-daemon --start --quiet --exec "${DISTCCD_EXEC}" --user distcc -- \ + --daemon --pid-file "${DISTCCD_PIDFILE}" \ + ${DISTCCD_OPTS} + eend $? +} + +stop() { + ebegin "Stopping distccd" + start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}" + eend $? +} diff --git a/sys-devel/distcc/files/distcc-config-3.2_rc1 b/sys-devel/distcc/files/distcc-config-3.2_rc1 deleted file mode 100644 index 6f3bd27e40f0..000000000000 --- a/sys-devel/distcc/files/distcc-config-3.2_rc1 +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/env python2 -# Copyright 1999-2011 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -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().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)) -- cgit v1.2.3-65-gdbad