Move code to verify digest and hash functions to a separate function
authorAndrew Gaffney <agaffney@gentoo.org>
Sun, 11 Jan 2009 03:17:00 +0000 (21:17 -0600)
committerAndrew Gaffney <agaffney@gentoo.org>
Sun, 11 Jan 2009 03:17:00 +0000 (21:17 -0600)
ChangeLog
catalyst

index 2732acfd77275ec0df8194f6d8bb60e1439693b6..966184bb6cf3477b51d2b81262a7a65358ccc36b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 # Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
 # Distributed under the GPL v2
 
+  11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org> catalyst:
+  Move code to verify digest and hash functions to a separate function
+
   11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org> catalyst:
   Allow build_target() to re-raise the exception for the top-level handler
   to catch it
index a1e19cf895a295a56bbc23f81ce7f219d390ee48..270c09d3489261f2fcc8c447bcd676799be7a83a 100755 (executable)
--- a/catalyst
+++ b/catalyst
@@ -182,6 +182,46 @@ def build_target(addlargs, targetmap):
 #              sys.exit(1)
                raise
 
+def verify_digest_and_hash_functions(conf_values):
+       # Start checking that digests are valid now that the hash_map was imported from catalyst_support
+       if conf_values.has_key("digests"):
+               for i in conf_values["digests"].split():
+                       if not hash_map.has_key(i):
+                               print
+                               print i+" is not a valid digest entry"
+                               print "Valid digest entries:"
+                               print hash_map.keys()
+                               print
+                               print "Catalyst aborting...."
+                               sys.exit(2)
+                       if find_binary(hash_map[i][1]) == None:
+                               print
+                               print "digest="+i
+                               print "\tThe "+hash_map[i][1]+\
+                                       " binary was not found. It needs to be in your system path"
+                               print
+                               print "Catalyst aborting...."
+                               sys.exit(2)
+
+       if conf_values.has_key("hash_function"):
+               if not hash_map.has_key(conf_values["hash_function"]):
+                       print
+                       print conf_values["hash_function"]+" is not a valid hash_function entry"
+                       print "Valid hash_function entries:"
+                       print hash_map.keys()
+                       print
+                       print "Catalyst aborting...."
+                       sys.exit(2)
+               if find_binary(hash_map[conf_values["hash_function"]][1]) == None:
+                       print
+                       print "hash_function="+conf_values["hash_function"]
+                       print "\tThe "+hash_map[conf_values["hash_function"]][1]+\
+                               " binary was not found. It needs to be in your system path"
+                       print
+                       print "Catalyst aborting...."
+                       sys.exit(2)
+
+
 if __name__ == "__main__":
        
        show_version()
@@ -275,43 +315,7 @@ if __name__ == "__main__":
 
        parse_config(myconfig)
        
-       # Start checking that digests are valid now that the hash_map was imported from catalyst_support
-       if conf_values.has_key("digests"):
-               for i in conf_values["digests"].split():
-                       if not hash_map.has_key(i):
-                               print
-                               print i+" is not a valid digest entry"
-                               print "Valid digest entries:"
-                               print hash_map.keys()
-                               print
-                               print "Catalyst aborting...."
-                               sys.exit(2)
-                       if find_binary(hash_map[i][1]) == None:
-                               print
-                               print "digest="+i
-                               print "\tThe "+hash_map[i][1]+\
-                                       " binary was not found. It needs to be in your system path"
-                               print
-                               print "Catalyst aborting...."
-                               sys.exit(2)
-
-       if conf_values.has_key("hash_function"):
-               if not hash_map.has_key(conf_values["hash_function"]):
-                       print
-                       print conf_values["hash_function"]+" is not a valid hash_function entry"
-                       print "Valid hash_function entries:"
-                       print hash_map.keys()
-                       print
-                       print "Catalyst aborting...."
-                       sys.exit(2)
-               if find_binary(hash_map[conf_values["hash_function"]][1]) == None:
-                       print
-                       print "hash_function="+conf_values["hash_function"]
-                       print "\tThe "+hash_map[conf_values["hash_function"]][1]+\
-                               " binary was not found. It needs to be in your system path"
-                       print
-                       print "Catalyst aborting...."
-                       sys.exit(2)
+       verify_digest_and_hash_functions(conf_values)
 
        targetmap = catalyst.target.build_target_map()