From patchwork Tue Jan 24 05:00:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Larson X-Patchwork-Id: 6364 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3DCE22427F for ; Tue, 24 Jan 2012 05:00:21 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 181EFA1802A for ; Tue, 24 Jan 2012 05:00:21 +0000 (UTC) Received: by bkar19 with SMTP id r19so3649603bka.11 for ; Mon, 23 Jan 2012 21:00:20 -0800 (PST) Received: by 10.205.130.12 with SMTP id hk12mr4241610bkc.56.1327381220798; Mon, 23 Jan 2012 21:00:20 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.130.220 with SMTP id u28cs91191bks; Mon, 23 Jan 2012 21:00:20 -0800 (PST) Received: by 10.180.101.161 with SMTP id fh1mr17900863wib.0.1327381219377; Mon, 23 Jan 2012 21:00:19 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ht2si7524269wib.44.2012.01.23.21.00.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jan 2012 21:00:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1RpYUV-0006Pj-3X for ; Tue, 24 Jan 2012 05:00:19 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 0C956E017D for ; Tue, 24 Jan 2012 05:00:19 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 201 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 201: Workaround for license acceptance from ChiThu Message-Id: <20120124050019.26976.92758.launchpad@ackee.canonical.com> Date: Tue, 24 Jan 2012 05:00:19 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14713"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 4e96409e8994eb0f7d93b2652203728000443fb5 X-Gm-Message-State: ALoCoQl9ZV+4fQnMKuxwl9JgGlBO72r9SQAgc8V7cRb51Lf+YnTfAwJWW/7iIE77dYW4y0lkrXuQ Merge authors: Le Chi Thu le.chi.thu@linaro.org Related merge proposals: https://code.launchpad.net/~le-chi-thu/lava-dispatcher/snowball-license-auto-accept/+merge/89613 proposed by: Le Chi Thu (le-chi-thu) review: Approve - Paul Larson (pwlars) review: Resubmit - Le Chi Thu (le-chi-thu) ------------------------------------------------------------ revno: 201 [merge] committer: Paul Larson branch nick: lava-dispatcher timestamp: Mon 2012-01-23 22:58:01 -0600 message: Workaround for license acceptance from ChiThu modified: lava_dispatcher/client/lmc_utils.py --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'lava_dispatcher/client/lmc_utils.py' --- lava_dispatcher/client/lmc_utils.py 2012-01-12 20:38:57 +0000 +++ lava_dispatcher/client/lmc_utils.py 2012-01-22 22:39:22 +0000 @@ -1,10 +1,13 @@ from commands import getoutput, getstatusoutput import contextlib import logging +import pexpect import re import os import shutil from tempfile import mkdtemp +import sys +import time from lava_dispatcher.client.base import CriticalError from lava_dispatcher.utils import ( @@ -98,19 +101,8 @@ client.context.test_data.add_metadata(metadata) image_file = os.path.join(tarball_dir, "lava.img") - #XXX Hack for removing startupfiles from snowball hwpacks + logging.info("client.device_type = %s" %client.device_type) - if client.device_type == "snowball": - logging.info("Remove startupfiles from snowball") - cmd = "sudo linaro-hwpack-replace -r startupfiles-v3 -t %s -i" % hwpack_path - rc, output = getstatusoutput(cmd) - if rc: - raise RuntimeError("linaro-hwpack-replace failed: %s" % output) - - cmd = "sudo linaro-hwpack-replace -r startupfiles -t %s -i" % hwpack_path - rc, output = getstatusoutput(cmd) - if rc: - raise RuntimeError("linaro-hwpack-replace failed: %s" % output) cmd = ("sudo flock /var/lock/lava-lmc.lck linaro-media-create --hwpack-force-yes --dev %s " "--image-file %s --binary %s --hwpack %s --image-size 3G" % @@ -119,7 +111,7 @@ cmd += ' --rootfs ' + rootfstype logging.info("Executing the linaro-media-create command") logging.info(cmd) - rc, output = getstatusoutput(cmd) + rc = run_dispatcher_snowball_license_fix(cmd) if rc: shutil.rmtree(tarball_dir) raise RuntimeError("linaro-media-create failed: %s" % output) @@ -152,3 +144,37 @@ finally: logging_system('sudo umount ' + mntdir) logging_system('rm -rf ' + mntdir) + +def run_dispatcher_snowball_license_fix(cmd): + try: + proc = pexpect.spawn(cmd, logfile=sys.stdout) + done = False + + while not done: + id = proc.expect(["SNOWBALL CLICK-WRAP", + "Do you accept the", + "Configuring startupfiles", + "Configuring ux500-firmware", + "Configuring lbsd", + "Configuring mali400-dev", + pexpect.EOF], timeout=2400) + if id == 0: + proc.send('\t') + time.sleep(1) + proc.send('\r') + + elif id == 1: + if not mali400: + proc.send('\t') + time.sleep(1) + proc.send('\r') + elif id == 6: + done = True + elif id == 5: + mali400 = True + else: + mali400 = False + except pexpect.ExceptionPexpect: + return 1 + + return 0