diff options
author | James Tunnicliffe <james.tunnicliffe@linaro.org> | 2011-07-21 18:41:19 +0100 |
---|---|---|
committer | James Tunnicliffe <james.tunnicliffe@linaro.org> | 2011-07-21 18:41:19 +0100 |
commit | 8b97cc9cedd972f93cb0cbf0c9d3a53bdc84788f (patch) | |
tree | 3394881e82cadc7a9499abcd8afb873faac14cde /linaro-media-create | |
parent | 4cd18c1ef2409b506030813908b48e4deb0ed094 (diff) |
Moved checking the result of verify_file_integrity into its own function that logs the errors, which is now unit tested.
Diffstat (limited to 'linaro-media-create')
-rwxr-xr-x | linaro-media-create | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/linaro-media-create b/linaro-media-create index dc2c6dd..68d6fa4 100755 --- a/linaro-media-create +++ b/linaro-media-create @@ -45,7 +45,7 @@ from linaro_image_tools.media_create import get_args_parser from linaro_image_tools.utils import ( ensure_command, is_arm_host, - verify_file_integrity, + check_file_integrity_and_log_errors, ) # Just define the global variables @@ -110,27 +110,13 @@ if __name__ == '__main__': sig_file_list = args.hwpacksigs[:] if args.binarysig is not None: sig_file_list.append(args.binarysig) - verified_files, gpg_sig_pass = verify_file_integrity(sig_file_list) - # Check the outputs from verify_file_integrity - # Abort if anything fails. - if len(sig_file_list): - if not gpg_sig_pass: - print >> sys.stderr, "GPG signature verification failed. Aborting." - sys.exit(1) - - if not os.path.basename(args.binary) in verified_files: - print >> sys.stderr, "OS Binary verification failed" - sys.exit(1) - - for hwpack in args.hwpacks: - if not os.path.basename(hwpack) in verified_files: - print >> sys.stderr, "Hwpack {0} verification failed".format( - hwpack) - sys.exit(1) - - for verified_file in verified_files: - print 'Hash verification of file %s OK.' % verified_file + # Check that the signatures that we have been provided (if any) match + # the hwpack and OS binaries we have been provided. If they don't, quit. + files_ok, verified_files = check_file_integrity_and_log_errors( + sig_file_list, args.binary, args.hwpacks) + if not files_ok: + sys.exit(1) atexit.register(cleanup_tempdir) media = Media(args.device) |