aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rwxr-xr-xcatalyst10
-rw-r--r--files/catalyst.conf6
-rw-r--r--modules/catalyst_support.py19
-rw-r--r--modules/generic_stage_target.py34
5 files changed, 68 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index bb751eec..e754b2aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
# 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.
diff --git a/catalyst b/catalyst
index d63566d5..6253d859 100755
--- a/catalyst
+++ b/catalyst
@@ -1,7 +1,7 @@
#!/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>
@@ -133,6 +133,14 @@ def parse_config(myconfig):
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)
diff --git a/files/catalyst.conf b/files/catalyst.conf
index 70d2c487..d2b74a2b 100644
--- a/files/catalyst.conf
+++ b/files/catalyst.conf
@@ -1,6 +1,6 @@
# 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.
@@ -24,6 +24,10 @@ distdir="/usr/portage/distfiles"
# 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
diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py
index 5a47b336..19867843 100644
--- a/modules/catalyst_support.py
+++ b/modules/catalyst_support.py
@@ -1,8 +1,8 @@
# 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
@@ -75,7 +75,18 @@ def calc_md5(file):
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 = ''
@@ -107,6 +118,8 @@ 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("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")
diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index cd437063..719ec3a8 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -1,6 +1,6 @@
# 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
@@ -335,6 +335,7 @@ class generic_stage_target(generic_target):
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"
@@ -354,6 +355,7 @@ class generic_stage_target(generic_target):
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"):
@@ -896,6 +898,21 @@ class generic_stage_target(generic_target):
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):
@@ -1007,6 +1024,21 @@ class generic_stage_target(generic_target):
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..."