# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.409 2005/11/30 21:42:19 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.410 2005/12/01 19:18:27 rocket Exp $
+
+ 01 Dec 2005; Eric Edgar <rocket@gentoo.org> catalyst, files/catalyst.conf,
+ modules/catalyst_support.py, modules/generic_stage_target.py:
+ Add md5 and sha .digests file creation per wolf31o2's feature request
30 Nov 2005; Chris Gianelloni <wolf31o2@gentoo.org> catalyst:
This is catalyst-2.0_rc2.
#!/usr/bin/python
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.103 2005/11/30 21:42:19 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.104 2005/12/01 19:18:27 rocket Exp $
# Maintained in full by:
# Eric Edgar <rocket@gentoo.org>
if myconf.has_key("envscript"):
print "Envscript support enabled."
conf_values["ENVSCRIPT"]=myconf["envscript"]
+
+ if "md5" in string.split(conf_values["options"]):
+ print "MD5 .digests file creation support enabled."
+ conf_values["MD5"]="1"
+
+ if "sha" in string.split(conf_values["options"]):
+ print "SHA .digests file creation support enabled."
+ conf_values["SHA"]="1"
def import_modules():
# import catalyst's own modules (i.e. catalyst_support and the arch modules)
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/files/catalyst.conf,v 1.15 2005/11/30 21:37:58 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/files/catalyst.conf,v 1.16 2005/12/01 19:18:27 rocket Exp $
# Simple desriptions of catalyst settings. Please refer to the online
# documentation for more information.
# the -a option to the catalyst cmdline. -p will clear the
# autoresume flags as well as your pkgcache and kerncache.
# ( This option is not fully tested, bug reports welcome )
+#
+# DIGESTS CREATION
+# md5 = Cræate a .digests file containing the md5 of the output object
+# sha = Cræate a .digests file containing the sha of the output object
options="pkgcache kerncache seedcache snapcache"
# sharedir specifies where all of the catalyst runtime executables are. Most
# Copyright 1999-2005 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.57 2005/10/06 15:45:28 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.58 2005/12/01 19:18:27 rocket Exp $
-import sys,string,os,types,re,signal,traceback,md5,time
+import sys,string,os,types,re,signal,traceback,md5,sha,time
selinux_capable = False
#userpriv_capable = (os.getuid() == 0)
#fakeroot_capable = False
print "MD5 (%s) = %s" % (file, md5sum)
return md5sum
# calc_md5
-
+
+def calc_sha(file):
+ m = sha.new()
+ f = open(file, 'r')
+ for line in f.readlines():
+ m.update(line)
+ f.close()
+ shaval = hexify(m.digest())
+ #shaval = sha.new(file(file).read()).hexdigest() # loads all into memory first
+ print "SHA (%s) = %s" % (file, shaval)
+ return shaval
+
def read_from_clst(file):
line = ''
myline = ''
valid_config_file_values.append("DISTCC")
valid_config_file_values.append("ENVSCRIPT")
valid_config_file_values.append("AUTORESUME")
+valid_config_file_values.append("SHA")
+valid_config_file_values.append("MD5")
valid_config_file_values.append("FETCH")
valid_config_file_values.append("CLEAR_AUTORESUME")
valid_config_file_values.append("options")
# Copyright 1999-2005 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.80 2005/11/30 21:37:58 rocket Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.81 2005/12/01 19:18:27 rocket Exp $
"""
This class does all of the chroot setup, copying of files, etc. It is
if os.path.isfile(self.settings["source_path"]):
if os.path.exists(self.settings["source_path"]):
self.settings["source_path_md5sum"]=calc_md5(self.settings["source_path"])
+ self.settings["source_path_sha"]=calc_sha(self.settings["source_path"])
if os.path.isdir(self.settings["source_path"]):
print "Source path set to "+self.settings["source_path"]
print "\tIf this is not desired, remove this directory or turn of seedcache in the options of catalyst.conf"
self.settings["snapshot_path"]=normpath(self.settings["storedir"]+"/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
if os.path.exists(self.settings["snapshot_path"]):
self.settings["snapshot_path_md5sum"]=calc_md5(self.settings["snapshot_path"])
+ self.settings["snapshot_path_sha"]=calc_sha(self.settings["snapshot_path"])
def set_snapcache_path(self):
if self.settings.has_key("SNAPCACHE"):
cmd("tar cjf "+self.settings["target_path"]+" -C "+self.settings["stage_path"]+\
" .","Couldn't create stage tarball")
+
+ if self.settings.has_key("MD5") \
+ and os.path.exists(self.settings["target_path"]):
+ md5=calc_md5(self.settings["target_path"])
+ myf=open(self.settings["target_path"]+".digests","w")
+ myf.write("MD5: "+md5+"\n")
+ myf.close()
+
+ if self.settings.has_key("SHA") \
+ and os.path.exists(self.settings["target_path"]):
+ sha=calc_sha(self.settings["target_path"])
+ myf=open(self.settings["target_path"]+".digests","w")
+ myf.write("SHA: "+sha+"\n")
+ myf.close()
+
touch(self.settings["autoresume_path"]+"capture")
def run_local(self):
cmd("/bin/bash "+self.settings["controller_file"]+" iso "+\
self.settings["iso"],"ISO creation script failed.")
touch(self.settings["autoresume_path"]+"create_iso")
+
+ if self.settings.has_key("MD5") \
+ and os.path.exists(self.settings["iso"]):
+ md5=calc_md5(self.settings["iso"])
+ myf=open(self.settings["iso"]+".digests","w")
+ myf.write("MD5: "+md5+"\n")
+ myf.close()
+
+ if self.settings.has_key("SHA") \
+ and os.path.exists(self.settings["iso"]):
+ sha=calc_sha(self.settings["iso"])
+ myf=open(self.settings["iso"]+".digests","w")
+ myf.write("SHA: "+sha+"\n")
+ myf.close()
+
else:
print "WARNING livecd/iso was not defined."
print "A CD Image will not be created, skipping create-iso.sh..."