# ChangeLog for gentoo/src/catalyst
# Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.65 2004/06/16 18:34:23 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.66 2004/06/18 18:06:21 zhen Exp $
+
+ 18 Jun 2004; John Davis <zhen@gentoo.org> catalyst,
+ modules/catalyst_support.py, modules/generic_stage_target.py,
+ targets/stage1/build.sh, targets/stage1/stage1-chroot.sh,
+ targets/stage2/stage2-chroot.sh, targets/stage3/stage3-chroot.sh:
+ stage resuming functionality should be working. I still have to work on GRP
+ and livecds, but they should not be hard. I could not incorporate emerge
+ --resume into stage resuming functionality because in some instances, portage
+ is remerged (bootstrap, stage2), which wipes out the resume data and puts
+ catalyst into an infinite portage merging loop (very unproductive, trust me ;)
+ ). I also made some small tweaks to the stage target scripts which clean up
+ the envscript stuff. Not noticable performance wise, but it makes me feel all
+ warm and fuzzy to know that it is programmed absolutely correctly ;)
16 Jun 2004; John Davis <zhen@gentoo.org> TODO, modules/catalyst_support.py,
modules/generic_stage_target.py:
#!/usr/bin/python
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.37 2004/06/13 15:18:49 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.38 2004/06/18 18:06:21 zhen Exp $
import os,sys,imp,string
print "Distcc support enabled."
myspec["DISTCC"]="1"
+if "autoresume" in string.split(myspec["options"]):
+ print "Autoresuming support enabled."
+ myspec["AUTORESUME"]="1"
+
if myconf.has_key("envscript"):
print "Envscript support enabled."
myspec["ENVSCRIPT"]=myconf["envscript"]
# Distributed under the GNU General Public License version 2
# Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.23 2004/06/16 18:34:23 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.24 2004/06/18 18:06:21 zhen Exp $
import sys,string,os,types
valid_config_file_values.append("CCACHE")
valid_config_file_values.append("DISTCC")
valid_config_file_values.append("ENVSCRIPT")
+valid_config_file_values.append("AUTORESUME")
valid_config_file_values.append("options")
verbosity=1
if retval != 0:
raise CatalystError,myexc
except KeyboardInterrupt:
- raise CatalystError,"Build aborting due to user intervention"
+ raise CatalystError,"Caught SIGINT, aborting."
def file_locate(settings,filelist,expand=1):
#if expand=1, non-absolute paths will be accepted and
# Distributed under the GNU General Public License version 2
# Copyright 2003-2004 Gentoo Technologies, Inc.
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.3 2004/06/16 18:34:23 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.4 2004/06/18 18:06:21 zhen Exp $
"""
This class does all of the chroot setup, copying of files, etc. It is
def dir_setup(self):
print "Setting up directories..."
self.mount_safety_check()
- if not os.path.exists(self.settings["chroot_path"]+"/tmp/unpacked"):
- cmd("rm -rf "+self.settings["chroot_path"],"Could not remove existing directory: "+self.settings["chroot_path"])
- else:
+ if self.settings.has_key("AUTORESUME") and os.path.exists(self.settings["chroot_path"]+"/tmp/unpacked"):
print "Directories previously setup, resuming..."
-
+ else:
+ cmd("rm -rf "+self.settings["chroot_path"],"Could not remove existing directory: "+self.settings["chroot_path"])
+
if not os.path.exists(self.settings["chroot_path"]):
os.makedirs(self.settings["chroot_path"])
if self.settings.has_key("PKGCACHE"):
os.makedirs(self.settings["pkgcache_path"])
def unpack_and_bind(self):
- if not os.path.exists(self.settings["chroot_path"]+"/tmp/unpacked"):
+ if self.settings.has_key("AUTORESUME") and os.path.exists(self.settings["chroot_path"]+"/tmp/unpacked"):
+ print "CHROOT previously unpacked and bind mounted, resuming..."
+ else:
print "Unpacking stage tarball..."
cmd("tar xjpf "+self.settings["source_path"]+" -C "+self.settings["chroot_path"],"Error unpacking tarball")
if os.path.exists(self.settings["chroot_path"]+"/usr/portage"):
cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.profile","Error zapping profile link")
cmd("ln -sf ../usr/portage/profiles/"+self.settings["target_profile"]+" "+self.settings["chroot_path"]+"/etc/make.profile","Error creating profile link")
touch(self.settings["chroot_path"]+"/tmp/unpacked")
- else:
- print "CHROOT previously unpacked and bind mounted, resuming..."
-
+
for x in self.mounts:
if not os.path.exists(self.settings["chroot_path"]+x):
os.makedirs(self.settings["chroot_path"]+x)
raise CatalystError,"Couldn't umount one or more bind-mounts; aborting for safety."
def chroot_setup(self):
- if not os.path.exists(self.settings["chroot_path"]+"/tmp/chroot_setup"):
- cmd("cp /etc/resolv.conf "+self.settings["chroot_path"]+"/etc","Could not copy resolv.conf into place.")
- if self.settings.has_key("ENVSCRIPT"):
- if not os.path.exists(self.settings["ENVSCRIPT"]):
- raise CatalystError, "Can't find envscript "+self.settings["ENVSCRIPT"]
- cmd("cp "+self.settings["ENVSCRIPT"]+" "+self.settings["chroot_path"]+"/tmp/envscript","Could not copy envscript into place.")
- cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.conf")
-
- myf=open(self.settings["chroot_path"]+"/etc/make.conf","w")
- myf.write("# These settings were set by the catalyst build script that automatically built this stage\n")
- myf.write("# Please consult /etc/make.conf.example for a more detailed example\n")
- myf.write('CFLAGS="'+self.settings["CFLAGS"]+'"\n')
- myf.write('CHOST="'+self.settings["CHOST"]+'"\n')
- myusevars=[]
- if self.settings.has_key("HOSTUSE"):
- myusevars.extend(self.settings["HOSTUSE"])
- if self.settings["target"]=="grp":
- myusevars.append("bindist")
- myusevars.extend(self.settings["grp/use"])
- myf.write('USE="'+string.join(myusevars)+'"\n')
- elif self.settings["target"]=="tinderbox":
- myusevars.extend(self.settings["tinderbox/use"])
- myf.write('USE="'+string.join(myusevars)+'"\n')
- elif self.settings["target"]=="livecd-stage1":
- myusevars.extend(self.settings["livecd/use"])
- myf.write('USE="'+string.join(myusevars)+'"\n')
- elif self.settings["target"]=="embedded":
- myusevars.extend(self.settings["embedded/use"])
- myf.write('USE="'+string.join(myusevars)+'"\n')
- if self.settings.has_key("CXXFLAGS"):
- myf.write('CXXFLAGS="'+self.settings["CXXFLAGS"]+'"\n')
- else:
- myf.write('CXXFLAGS="${CFLAGS}"\n')
- myf.close()
+ print "Setting up chroot..."
+ cmd("cp /etc/resolv.conf "+self.settings["chroot_path"]+"/etc","Could not copy resolv.conf into place.")
+ if self.settings.has_key("ENVSCRIPT"):
+ if not os.path.exists(self.settings["ENVSCRIPT"]):
+ raise CatalystError, "Can't find envscript "+self.settings["ENVSCRIPT"]
+ cmd("cp "+self.settings["ENVSCRIPT"]+" "+self.settings["chroot_path"]+"/tmp/envscript","Could not copy envscript into place.")
+ cmd("rm -f "+self.settings["chroot_path"]+"/etc/make.conf")
- #create entry in /etc/passwd for distcc user
- if self.settings.has_key("DISTCC"):
- myf=open(self.settings["chroot_path"]+"/etc/passwd","a")
- myf.write("distcc:x:7980:2:distccd:/dev/null:/bin/false\n")
- myf.close()
- touch(self.settings["chroot_path"]+"/tmp/chroot_setup")
+ myf=open(self.settings["chroot_path"]+"/etc/make.conf","w")
+ myf.write("# These settings were set by the catalyst build script that automatically built this stage\n")
+ myf.write("# Please consult /etc/make.conf.example for a more detailed example\n")
+ myf.write('CFLAGS="'+self.settings["CFLAGS"]+'"\n')
+ myf.write('CHOST="'+self.settings["CHOST"]+'"\n')
+ myusevars=[]
+ if self.settings.has_key("HOSTUSE"):
+ myusevars.extend(self.settings["HOSTUSE"])
+ if self.settings["target"]=="grp":
+ myusevars.append("bindist")
+ myusevars.extend(self.settings["grp/use"])
+ myf.write('USE="'+string.join(myusevars)+'"\n')
+ elif self.settings["target"]=="tinderbox":
+ myusevars.extend(self.settings["tinderbox/use"])
+ myf.write('USE="'+string.join(myusevars)+'"\n')
+ elif self.settings["target"]=="livecd-stage1":
+ myusevars.extend(self.settings["livecd/use"])
+ myf.write('USE="'+string.join(myusevars)+'"\n')
+ elif self.settings["target"]=="embedded":
+ myusevars.extend(self.settings["embedded/use"])
+ myf.write('USE="'+string.join(myusevars)+'"\n')
+ if self.settings.has_key("CXXFLAGS"):
+ myf.write('CXXFLAGS="'+self.settings["CXXFLAGS"]+'"\n')
else:
- print "CHROOT previously setup, resuming..."
+ myf.write('CXXFLAGS="${CFLAGS}"\n')
+ myf.close()
+
+ #create entry in /etc/passwd for distcc user
+ if self.settings.has_key("DISTCC"):
+ myf=open(self.settings["chroot_path"]+"/etc/passwd","a")
+ myf.write("distcc:x:7980:2:distccd:/dev/null:/bin/false\n")
+ myf.close()
+ touch(self.settings["chroot_path"]+"/tmp/chroot_setup")
def clean(self):
destpath=self.settings["chroot_path"]
#!/bin/bash
# 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/build.sh,v 1.6 2004/03/30 19:45:14 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/Attic/build.sh,v 1.7 2004/06/18 18:06:21 zhen Exp $
for x in `cat /etc/make.profile/packages.build | grep -v '^#'`
do
#!/bin/bash
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-chroot.sh,v 1.16 2004/06/04 14:03:46 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage1/stage1-chroot.sh,v 1.17 2004/06/18 18:06:21 zhen Exp $
/usr/sbin/env-update
source /etc/profile
-if [ -f /tmp/envscript ]
-then
- source /tmp/envscript
- rm -f /tmp/envscript
-fi
+[ -f /tmp/envscript ] && source /tmp/envscript
if [ -n "${clst_CCACHE}" ]
then
export clst_myfeatures="${clst_myfeatures} ccache"
- emerge --oneshot --nodeps ccache || exit 1
+ emerge -b -k --oneshot --nodeps ccache || exit 1
fi
if [ -n "${clst_DISTCC}" ]
export clst_myfeatures="${clst_myfeatures} distcc"
export DISTCC_HOSTS="${clst_distcc_hosts}"
- USE="-gtk -gnome" emerge --oneshot --nodeps distcc || exit 1
+ USE="-gtk -gnome" emerge -b -k --oneshot --nodeps distcc || exit 1
/usr/bin/distcc-config --install 2>&1 > /dev/null
/usr/bin/distccd 2>&1 > /dev/null
fi
if [ -n "${clst_PKGCACHE}" ]
then
- export clst_myemergeopts="--usepkg --buildpkg"
+ export clst_myemergeopts="${clst_myemergeopts} --usepkg --buildpkg"
fi
+
+# broken, need to figure out how to avoid a portage infinite loop
+#if [ -n "${clst_AUTORESUME}" ] && [ -e /tmp/build.log ]
+#then
+# export clst_myemergeopts="${clst_myemergeopts} --resume"
+#fi
# setup our environment
export FEATURES="${clst_myfeatures}"
done
USE="-* build" emerge ${clst_myemergeopts} --noreplace ${clst_buildpkgs} || exit 1
-
-# if baselayout did not fix up /dev, we do it
-# THIS SHOULD BE TEMPORARY CODE - NOT A SOLUTION
-if [ ! -d ${ROOT}/dev ]
-then
- case ${clst_mainarch} in
- x86)
- clst_devtype=i386
- ;;
- ppc)
- clst_devtype=powerpc
- ;;
- ppc64)
- clst_devtype=powerpc
- ;;
- sparc)
- clst_devtype=sparc
- ;;
- sparc64)
- clst_devtype=sparc
- ;;
- alpha)
- clst_devtype=alpha
- ;;
- s390)
- clst_devtype=s390
- ;;
- amd64)
- clst_devtype=i386
- ;;
- hppa)
- clst_devtype=hppa
- ;;
- ia64)
- clst_devtype=ia64
- ;;
- mips)
- clst_devtype=mips
- ;;
- arm)
- clst_devtype=arm
- ;;
- *)
- echo "!!! Catalyst mainarch ${clst_mainarch} not supported" && exit 1
- ;;
- esac
-
- mkdir -p ${ROOT}/dev
- cd ${ROOT}/dev
- MAKEDEV generic-${clst_devtype}
-fi
#!/bin/sh
# 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/stage2-chroot.sh,v 1.3 2004/06/04 14:03:46 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage2/stage2-chroot.sh,v 1.4 2004/06/18 18:06:21 zhen Exp $
/usr/sbin/env-update
source /etc/profile
-if [ -f /tmp/envscript ]
-then
- source /tmp/envscript
- rm -f /tmp/envscript
-fi
+[ -f /tmp/envscript ] && source /tmp/envscript
if [ -n "${clst_CCACHE}" ]
then
export clst_myfeatures="${clst_myfeatures} ccache"
- emerge --oneshot --nodeps ccache || exit 1
+ emerge -b -k --oneshot --nodeps ccache || exit 1
fi
if [ -n "${clst_DISTCC}" ]
export clst_myfeatures="${clst_myfeatures} distcc"
export DISTCC_HOSTS="${clst_distcc_hosts}"
- USE="-gnome -gtk" emerge --oneshot --nodeps distcc || exit 1
+ USE="-gnome -gtk" emerge -b -k --oneshot --nodeps distcc || exit 1
/usr/bin/distcc-config --install 2>&1 > /dev/null
/usr/bin/distccd 2>&1 > /dev/null
fi
#!/bin/bash
# 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/stage3-chroot.sh,v 1.4 2004/06/04 14:03:46 zhen Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/targets/stage3/stage3-chroot.sh,v 1.5 2004/06/18 18:06:21 zhen Exp $
/usr/sbin/env-update
source /etc/profile
-if [ -f /tmp/envscript ]
-then
- source /tmp/envscript
- rm -f /tmp/envscript
-fi
+[ -f /tmp/envscript ] && source /tmp/envscript
if [ -n "${clst_CCACHE}" ]
then
export clst_myfeatures="${clst_myfeatures} ccache"
- emerge --oneshot --nodeps ccache || exit 1
+ emerge -b -k --oneshot --nodeps ccache || exit 1
fi
if [ -n "${clst_DISTCC}" ]
export clst_myfeatures="${clst_myfeatures} distcc"
export DISTCC_HOSTS="${clst_distcc_hosts}"
- USE="-gnome -gtk" emerge --oneshot --nodeps distcc || exit 1
+ USE="-gnome -gtk" emerge -b -k --oneshot --nodeps distcc || exit 1
/usr/bin/distcc-config --install 2>&1 > /dev/null
/usr/bin/distccd 2>&1 > /dev/null
fi