aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn P. Davis <zhen@gentoo.org>2004-06-18 18:06:21 +0000
committerJohn P. Davis <zhen@gentoo.org>2004-06-18 18:06:21 +0000
commit6aa5090a8fc73726f618c85deb4b73082384d6e1 (patch)
treebc5d04af9154be3ae474c1c603e6f38aee9e12f8 /modules
parentbeta code to wrap commands (diff)
downloadcatalyst-6aa5090a8fc73726f618c85deb4b73082384d6e1.tar.gz
catalyst-6aa5090a8fc73726f618c85deb4b73082384d6e1.tar.bz2
catalyst-6aa5090a8fc73726f618c85deb4b73082384d6e1.zip
check changelog
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@400 d1e1f19c-881f-0410-ab34-b69fee027534
Diffstat (limited to 'modules')
-rw-r--r--modules/catalyst_support.py5
-rw-r--r--modules/generic_stage_target.py98
2 files changed, 51 insertions, 52 deletions
diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py
index f78079e3..ae0fa88a 100644
--- a/modules/catalyst_support.py
+++ b/modules/catalyst_support.py
@@ -1,6 +1,6 @@
# 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
@@ -18,6 +18,7 @@ valid_config_file_values.append("PKGCACHE")
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
@@ -90,7 +91,7 @@ def cmd(mycmd,myexc=""):
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
diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index 7f4cc449..ebf74822 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -1,6 +1,6 @@
# 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
@@ -147,11 +147,11 @@ class generic_stage_target(generic_target):
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"):
@@ -159,7 +159,9 @@ class generic_stage_target(generic_target):
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"):
@@ -171,9 +173,7 @@ class generic_stage_target(generic_target):
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)
@@ -208,49 +208,47 @@ class generic_stage_target(generic_target):
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"]