From c84559ad45afe692f71d3e6dfb5cd5d79c72028e Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Sat, 10 Jan 2009 21:17:00 -0600 Subject: [PATCH] Move code to verify digest and hash functions to a separate function --- ChangeLog | 3 +++ catalyst | 78 +++++++++++++++++++++++++++++-------------------------- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2732acfd..966184bb 100644 --- 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 catalyst: + Move code to verify digest and hash functions to a separate function + 11 Jan 2009; Andrew Gaffney catalyst: Allow build_target() to re-raise the exception for the top-level handler to catch it diff --git a/catalyst b/catalyst index a1e19cf8..270c09d3 100755 --- 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() -- 2.26.2