From patchwork Mon May 2 08:04:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mattias Backman X-Patchwork-Id: 1325 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:50:55 -0000 Delivered-To: patches@linaro.org Received: by 10.224.2.73 with SMTP id 9cs246901qai; Mon, 2 May 2011 01:11:11 -0700 (PDT) Received: by 10.216.238.132 with SMTP id a4mr2147750wer.68.1304323454114; Mon, 02 May 2011 01:04:14 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id s20si13945457wec.82.2011.05.02.01.04.13; Mon, 02 May 2011 01:04:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) client-ip=91.189.90.139; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) smtp.mail=bounces@canonical.com Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QGo73-00055R-6d for ; Mon, 02 May 2011 08:04:13 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 303142E8014 for ; Mon, 2 May 2011 08:04:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-image-tools/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 335 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 335: Install hwpack with --force-yes if hwpack integrity has been verified. Message-Id: <20110502080413.5510.80897.launchpad@loganberry.canonical.com> Date: Mon, 02 May 2011 08:04:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="12915"; Instance="initZopeless config overlay" X-Launchpad-Hash: 52d9834c4abcba2a0683acd684a81d4666480ec0 Merge authors: Mattias Backman (mabac) Related merge proposals: https://code.launchpad.net/~mabac/linaro-image-tools/bug-638384-hwpackforceyes-unneeded/+merge/59371 proposed by: Mattias Backman (mabac) review: Approve - Guilherme Salgado (salgado) ------------------------------------------------------------ revno: 335 [merge] committer: Mattias Backman branch nick: trunk timestamp: Mon 2011-05-02 09:59:07 +0200 message: Install hwpack with --force-yes if hwpack integrity has been verified. modified: linaro-media-create linaro_image_tools/media_create/chroot_utils.py linaro_image_tools/media_create/tests/test_media_create.py --- lp:linaro-image-tools https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk You are subscribed to branch lp:linaro-image-tools. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription === modified file 'linaro-media-create' --- linaro-media-create 2011-04-29 10:53:52 +0000 +++ linaro-media-create 2011-05-02 07:59:07 +0000 @@ -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' --- linaro_image_tools/media_create/chroot_utils.py 2011-04-04 21:20:09 +0000 +++ linaro_image_tools/media_create/chroot_utils.py 2011-04-29 11:47:02 +0000 @@ -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' --- linaro_image_tools/media_create/tests/test_media_create.py 2011-04-29 11:03:10 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2011-05-02 07:59:07 +0000 @@ -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