# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.234 2005/04/21 14:45:09 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.235 2005/04/21 17:45:31 rocket Exp $
+
+ 21 Apr 2005; Eric Edgar <rocket@gentoo.org> catalyst,
+ modules/catalyst_support.py, modules/generic_stage_target.py:
+ Add support to clear the autoresume flags and improve the purge code to
+ clean the chroot, and pkg/kern cache
21 Apr 2005; Eric Edgar <rocket@gentoo.org> catalyst,
modules/catalyst_support.py, modules/generic_stage_target.py,
#!/usr/bin/python
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.73 2005/04/21 14:45:09 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.74 2005/04/21 17:45:31 rocket Exp $
# Maintained in full by:
# Eric Edgar <rocket@gentoo.org>
def usage():
print "Usage catalyst [options] [-C variable=value...] [ -s identifier]"
+ print " -a --clear_autoresume clear autoresume flags"
print " -c --config use specified configuration file"
print " -C --cli catalyst commandline (MUST BE LAST OPTION)"
print " -d --debug enable debugging"
print " -f --file read specfile"
print " -F --fetchonly fetch files only"
print " -h --help print this help message"
+ print " -p --purge clear tmp dirs,package cache and autoresume flags"
print " -s --snapshot generate a Portage snapshot"
print " -v --version display version information"
print " -V --verbose verbose output"
print "Purge support enabled."
conf_values["PURGE"]="1"
+ if "clear_autoresume" in string.split(conf_values["options"]):
+ print "Cleaning autoresume flags support enabled."
+ conf_values["CLEAR_AUTORESUME"]="1"
+
+
if myconf.has_key("envscript"):
print "Envscript support enabled."
conf_values["ENVSCRIPT"]=myconf["envscript"]
raise CatalystError,"Target \""+addlargs["target"]+"\" not available."
mytarget=targetmap[addlargs["target"]](conf_values, addlargs)
+
+ if conf_values.has_key("CLEAR_AUTORESUME"):
+ mytarget.clear_autoresume()
+
if conf_values.has_key("PURGE"):
mytarget.purge()
+
mytarget.run()
except CatalystError:
# parse out the command line arguments
try:
- opts,args = getopt.getopt(sys.argv[1:], "xhvdc:C:f:FVs:", ["purge","help", "version", "debug",\
- "config=", "cli=", "file=", "fetch", "verbose","snapshot="])
+ opts,args = getopt.getopt(sys.argv[1:], "apxhvdc:C:f:FVs:", ["purge","help", "version", "debug",\
+ "clear_autoresume", "config=", "cli=", "file=", "fetch", "verbose","snapshot="])
except getopt.GetoptError:
usage()
else:
mycmdline.append("target=snapshot")
mycmdline.append("version_stamp="+a)
- if o in ("--purge"):
+
+ if o in ("-p", "--purge"):
+ if len(sys.argv) < 3:
+ print "!!! catalyst: please specify one of either -f or -C\n"
+ usage()
+ sys.exit(2)
+ else:
conf_values["PURGE"]="1"
+ if o in ("-a", "--clear_autoresume"):
+ if len(sys.argv) < 3:
+ print "!!! catalyst: please specify one of either -f or -C\n"
+ usage()
+ sys.exit(2)
+ else:
+ conf_values["CLEAR_AUTORESUME"]="1"
if run != 1:
print "!!! catalyst: please specify one of either -f or -C\n"
usage()
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.40 2005/04/21 14:45:09 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.41 2005/04/21 17:45:31 rocket Exp $
import sys,string,os,types,re,signal,traceback,md5
# a function to turn a string of non-printable characters into a string of
valid_config_file_values.append("DISTCC")
valid_config_file_values.append("ENVSCRIPT")
valid_config_file_values.append("AUTORESUME")
+valid_config_file_values.append("CLEAR_AUTORESUME")
valid_config_file_values.append("options")
valid_config_file_values.append("DEBUG")
valid_config_file_values.append("VERBOSE")
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.35 2005/04/21 14:45:09 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.36 2005/04/21 17:45:31 rocket Exp $
"""
This class does all of the chroot setup, copying of files, etc. It is
# This should be first to be set as other set_ options depend on this
self.set_spec_prefix()
-
# define all of our core variables
self.set_target_profile()
self.set_target_subpath()
print "Setting up directories..."
self.mount_safety_check()
- if os.path.exists(self.settings["chroot_path"]):
- cmd("rm -rf "+self.settings["chroot_path"],\
- "Could not remove existing directory: "+self.settings["chroot_path"])
-
+ self.clear_chroot()
+
if not os.path.exists(self.settings["chroot_path"]+"/tmp"):
os.makedirs(self.settings["chroot_path"]+"/tmp",1777)
elif type(self.settings[x])==types.ListType:
os.environ[varname]=string.join(self.settings[x])
- def purge(self):
- if self.settings.has_key("PKGCACHE"):
- print "purging the pkgcache ..."
-
- myemp=self.settings["pkgcache_path"]
- if not os.path.isdir(myemp):
- print myemp,"not a directory or does not exist, skipping 'pkgcache purge' operation."
- else:
- print "Emptying directory",myemp
- # stat the dir, delete the dir, recreate the dir and set
- # the proper perms and ownership
- mystat=os.stat(myemp)
- shutil.rmtree(myemp)
- os.makedirs(myemp,0755)
-
def run(self):
-
for x in self.settings["action_sequence"]:
print "Running action sequence: "+x
try:
except CatalystError:
self.unbind()
raise CatalystError,"build aborting due to livecd_update error."
+
+ def clear_chroot(self):
+ myemp=self.settings["chroot_path"]
+ if not os.path.isdir(myemp):
+ print myemp,"not a directory or does not exist, skipping 'chroot purge' operation."
+ else:
+ print "Emptying directory",myemp
+ # stat the dir, delete the dir, recreate the dir and set
+ # the proper perms and ownership
+ mystat=os.stat(myemp)
+ shutil.rmtree(myemp)
+ os.makedirs(myemp,0755)
+
+ def clear_packages(self):
+ if self.settings.has_key("PKGCACHE"):
+ print "purging the pkgcache ..."
+
+ myemp=self.settings["pkgcache_path"]
+ if not os.path.isdir(myemp):
+ print myemp,"not a directory or does not exist, skipping 'pkgcache purge' operation."
+ else:
+ print "Emptying directory",myemp
+ # stat the dir, delete the dir, recreate the dir and set
+ # the proper perms and ownership
+ mystat=os.stat(myemp)
+ shutil.rmtree(myemp)
+ os.makedirs(myemp,0755)
+
+ def purge(self):
+ if self.settings.has_key("PURGE"):
+ print "clearing autoresume ..."
+ self.clear_autoresume
+
+ print "clearing chroot ..."
+ self.clear_chroot
+
+ print "clearing package cache ..."
+ self.clear_packages