=== modified file 'linaro-media-create'
@@ -22,6 +22,7 @@
import os
import sys
import tempfile
+import subprocess
from linaro_image_tools import cmd_runner
@@ -104,16 +105,17 @@
ensure_required_commands(args)
sig_file_list = args.hwpacksigs[:]
+ verified_files = []
if args.binarysig is not None:
sig_file_list.append(args.binarysig)
for sig_file in sig_file_list:
hash_file = sig_file[0:-len('.asc')]
- if cmd_runner.run(['gpg', '--verify', sig_file]).wait() != 0:
- print "Could not verify hash file signature %s." % sig_file
- sys.exit(1)
- if cmd_runner.run(['sha1sum', '-c', hash_file]).wait() != 0:
- print "Could not verify hash in file %s." % hash_file
- sys.exit(1)
+ cmd_runner.run(['gpg', '--verify', sig_file]).wait() != 0:
+ sha1sums_out, _ = cmd_runner.run(['sha1sum', '-c', hash_file],
+ stdout=subprocess.PIPE).communicate()
+ verified_files.extend(sha1sums_out.replace(': OK', '').splitlines())
+ for verified_file in verified_files:
+ print 'Hash verification of file %s OK.' % verified_file
media = Media(args.device)
if media.is_block_device:
@@ -134,7 +136,7 @@
if lmc_dir == '':
lmc_dir = None
install_hwpacks(
- ROOTFS_DIR, TMP_DIR, lmc_dir, args.hwpack_force_yes, *hwpacks)
+ ROOTFS_DIR, TMP_DIR, lmc_dir, args.hwpack_force_yes, verified_files, *hwpacks)
if args.rootfs == 'btrfs':
install_packages(ROOTFS_DIR, TMP_DIR, "btrfs-tools")
=== modified file 'linaro_image_tools/media_create/chroot_utils.py'
@@ -43,7 +43,7 @@
os.path.join(chroot_dir, 'usr', 'bin'))
def install_hwpacks(
- chroot_dir, tmp_dir, tools_dir, hwpack_force_yes, *hwpack_files):
+ chroot_dir, tmp_dir, tools_dir, hwpack_force_yes, verified_files, *hwpack_files):
"""Install the given hwpacks onto the given chroot."""
prepare_chroot(chroot_dir, tmp_dir)
@@ -58,7 +58,10 @@
try:
mount_chroot_proc(chroot_dir)
for hwpack_file in hwpack_files:
- install_hwpack(chroot_dir, hwpack_file, hwpack_force_yes)
+ hwpack_verified = False
+ if os.path.basename(hwpack_file) in verified_files:
+ hwpack_verified = True
+ install_hwpack(chroot_dir, hwpack_file, hwpack_force_yes or hwpack_verified)
finally:
run_local_atexit_funcs()
=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
@@ -1392,7 +1392,7 @@
prefer_dir = preferred_tools_dir()
install_hwpacks(
- chroot_dir, tmp_dir, prefer_dir, force_yes, 'hwpack1.tgz',
+ chroot_dir, tmp_dir, prefer_dir, force_yes, [], 'hwpack1.tgz',
'hwpack2.tgz')
linaro_hwpack_install = find_command(
'linaro-hwpack-install', prefer_dir=prefer_dir)
@@ -1506,7 +1506,7 @@
exception_caught = False
try:
install_hwpacks(
- 'chroot', '/tmp/dir', preferred_tools_dir(), force_yes,
+ 'chroot', '/tmp/dir', preferred_tools_dir(), force_yes, [],
'hwp.tgz', 'hwp2.tgz')
except:
exception_caught = True