From f7ce3bc12db58d9323298073a3caf9fddc0b309d Mon Sep 17 00:00:00 2001 From: "John P. Davis" Date: Thu, 29 Jan 2004 21:53:22 +0000 Subject: [PATCH] added distcc support, documentation forthcoming git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@197 d1e1f19c-881f-0410-ab34-b69fee027534 --- catalyst | 4 ++++ modules/catalyst_support.py | 1 + modules/targets.py | 5 +++-- targets/grp/grp.sh | 11 ++++++++++- targets/stage1/stage1-chroot.sh | 9 +++++++++ targets/stage1/stage1.sh | 4 ++-- targets/stage2/stage2.sh | 15 ++++++++++++++- targets/stage3/stage3.sh | 28 +++++++++++++++++++++------- 8 files changed, 64 insertions(+), 13 deletions(-) diff --git a/catalyst b/catalyst index 8337824e..a64a329e 100755 --- a/catalyst +++ b/catalyst @@ -68,6 +68,10 @@ if "pkgcache" in string.split(myspec["options"]): print "Package cache support enabled." myspec["PKGCACHE"]="1" +if "distcc" in string.split(myspec["options"]): + print "Distcc support enabled." + myspec["DISTCC"]="1" + if sys.argv[1] in ["-f", "--file" ]: try: addlargs=read_spec(sys.argv[2]) diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py index 60456e55..da049ff7 100644 --- a/modules/catalyst_support.py +++ b/modules/catalyst_support.py @@ -21,6 +21,7 @@ required_config_file_values=["storedir","sharedir","distdir","portdir"] valid_config_file_values=required_config_file_values[:] valid_config_file_values.append("PKGCACHE") valid_config_file_values.append("CCACHE") +valid_config_file_values.append("DISTCC") valid_config_file_values.append("options") verbosity=1 diff --git a/modules/targets.py b/modules/targets.py index 9e740424..622db18b 100644 --- a/modules/targets.py +++ b/modules/targets.py @@ -104,10 +104,11 @@ class generic_stage_target(generic_target): if self.settings.has_key("CCACHE"): self.mounts.append("/root/.ccache") self.mountmap["/root/.ccache"]="/root/.ccache" + if self.settings["target"]=="grp": self.mounts.append("/tmp/grp") self.mountmap["/tmp/grp"]=self.settings["target_path"] - + def mount_safety_check(self): mypath=self.settings["chroot_path"] #check and verify that none of our paths in mypath are mounted. We don't want to clean up with things still @@ -204,7 +205,7 @@ class generic_stage_target(generic_target): if self.settings.has_key("CXXFLAGS"): myf.write('CXXFLAGS="'+self.settings["CXXFLAGS"]+'"\n') else: - myf.write('CXXFLAGS="$CFLAGS"\n') + myf.write('CXXFLAGS="${CFLAGS}"\n') myf.close() def clean(self): diff --git a/targets/grp/grp.sh b/targets/grp/grp.sh index 183ac0f8..d1342825 100755 --- a/targets/grp/grp.sh +++ b/targets/grp/grp.sh @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/grp/Attic/grp.sh,v 1.4 2004/01/10 22:23:44 drobbins Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/grp/Attic/grp.sh,v 1.5 2004/01/29 21:53:22 zhen Exp $ case $1 in enter) @@ -21,6 +21,15 @@ run) export FEATURES="ccache" emerge --oneshot --nodeps ccache || exit 1 fi + if [ -n "${clst_DISTCC}" ] + then + export FEATURES="distcc" + export DISTCC_HOSTS="${clst_distcc_hosts}" + emerge --oneshot --nodeps distcc || exit 1 + echo "distcc:x:240:2:distccd:/dev/null:/bin/false" >> /etc/passwd + /usr/bin/distcc-config --install 2>&1 > /dev/null + /usr/bin/distccd 2>&1 > /dev/null + fi if [ ${clst_rel_type} = "hardened" ] then emerge --oneshot --nodeps hardened-gcc || exit 1 diff --git a/targets/stage1/stage1-chroot.sh b/targets/stage1/stage1-chroot.sh index 8342011a..364cc4c2 100755 --- a/targets/stage1/stage1-chroot.sh +++ b/targets/stage1/stage1-chroot.sh @@ -10,6 +10,15 @@ case $1 in export FEATURES="ccache" emerge --oneshot --nodeps ccache || exit 1 fi + if [ -n "${clst_DISTCC}" ] + then + export FEATURES="distcc" + export DISTCC_HOSTS="${clst_distcc_hosts}" + emerge --oneshot --nodeps distcc || exit 1 + echo "distcc:x:240:2:distccd:/dev/null:/bin/false" >> /etc/passwd + /usr/bin/distcc-config --install 2>&1 > /dev/null + /usr/bin/distccd 2>&1 > /dev/null + fi export ROOT=${2} install -d $ROOT if [ -n "${clst_PKGCACHE}" ] diff --git a/targets/stage1/stage1.sh b/targets/stage1/stage1.sh index 60b71a79..314bd58b 100755 --- a/targets/stage1/stage1.sh +++ b/targets/stage1/stage1.sh @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/stage1.sh,v 1.7 2003/11/03 15:46:14 drobbins Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/stage1.sh,v 1.8 2004/01/29 21:53:22 zhen Exp $ case $1 in enter) @@ -15,7 +15,7 @@ run) cp ${clst_chroot_path}/etc/make.conf ${clst_chroot_path}/tmp/stage1root/etc cp -a ${clst_chroot_path}/etc/make.profile ${clst_chroot_path}/tmp/stage1root/etc # enter chroot, execute our build script - $clst_CHROOT ${clst_chroot_path} /tmp/stage1-chroot.sh build /tmp/stage1root + $clst_CHROOT ${clst_chroot_path} /tmp/stage1-chroot.sh build /tmp/stage1root [ $? -ne 0 ] && exit 1 ;; preclean) diff --git a/targets/stage2/stage2.sh b/targets/stage2/stage2.sh index 9aa16170..25062431 100755 --- a/targets/stage2/stage2.sh +++ b/targets/stage2/stage2.sh @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/Attic/stage2.sh,v 1.6 2003/11/06 02:31:20 drobbins Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/Attic/stage2.sh,v 1.7 2004/01/29 21:53:22 zhen Exp $ case $1 in enter) @@ -18,6 +18,15 @@ run) export FEATURES="ccache" emerge --oneshot --nodeps ccache || exit 1 fi + if [ -n "${clst_DISTCC}" ] + then + export FEATURES="distcc" + export DISTCC_HOSTS="${clst_distcc_hosts}" + emerge --oneshot --nodeps distcc || exit 1 + echo "distcc:x:240:2:distccd:/dev/null:/bin/false" >> /etc/passwd + /usr/bin/distcc-config --install 2>&1 > /dev/null + /usr/bin/distccd 2>&1 > /dev/null + fi if [ -n "${clst_PKGCACHE}" ] then export EMERGE_OPTS="--usepkg --buildpkg" @@ -35,6 +44,10 @@ preclean) then emerge -C dev-util/ccache || exit 1 fi + if [ -n "${clst_DISTCC}" ] + then + emerge -C sys-devel/distcc || exit 1 + fi EOF [ $? -ne 0 ] && exit 1 ;; diff --git a/targets/stage3/stage3.sh b/targets/stage3/stage3.sh index de20d636..91309fce 100755 --- a/targets/stage3/stage3.sh +++ b/targets/stage3/stage3.sh @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/Attic/stage3.sh,v 1.7 2003/11/06 03:45:15 drobbins Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/Attic/stage3.sh,v 1.8 2004/01/29 21:53:22 zhen Exp $ case $1 in enter) @@ -14,11 +14,6 @@ run) source /tmp/stage23 export USE="-* \${clst_HOSTUSE} \${GRP_STAGE23_USE}" rm -f /tmp/stage23 - if [ -n "${clst_CCACHE}" ] - then - export FEATURES="ccache" - emerge --oneshot --nodeps ccache || exit 1 - fi if [ ${clst_rel_type} = "hardened" ] then emerge --oneshot --nodeps hardened-gcc || exit 1 @@ -28,7 +23,21 @@ run) #portage needs to be merged manually with USE="build" set to avoid frying our #make.conf. emerge system could merge it otherwise. USE="build" emerge portage - + + if [ -n "${clst_CCACHE}" ] + then + export FEATURES="ccache" + emerge --oneshot --nodeps ccache || exit 1 + fi + if [ -n "${clst_DISTCC}" ] + then + export FEATURES="distcc" + export DISTCC_HOSTS="${clst_distcc_hosts}" + emerge --oneshot --nodeps distcc || exit 1 + echo "distcc:x:240:2:distccd:/dev/null:/bin/false" >> /etc/passwd + /usr/bin/distcc-config --install 2>&1 > /dev/null + /usr/bin/distccd 2>&1 > /dev/null + fi if [ -n "${clst_PKGCACHE}" ] then emerge system --usepkg --buildpkg || exit 1 @@ -46,6 +55,11 @@ preclean) then emerge -C dev-util/ccache || exit 1 fi + if [ -n "${clst_DISTCC}" ] + then + emerge -C sys-devel/distcc || exit 1 + userdel distcc + fi EOF [ $? -ne 0 ] && exit 1 ;; -- 2.26.2