From patchwork Wed Dec 7 01:38:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 5521 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 6C69A23E0C for ; Wed, 7 Dec 2011 01:38:17 +0000 (UTC) Received: from mail-ee0-f52.google.com (mail-ee0-f52.google.com [74.125.83.52]) by fiordland.canonical.com (Postfix) with ESMTP id 4C00CA186EA for ; Wed, 7 Dec 2011 01:38:17 +0000 (UTC) Received: by eekc14 with SMTP id c14so36599eek.11 for ; Tue, 06 Dec 2011 17:38:17 -0800 (PST) Received: by 10.14.9.163 with SMTP id 35mr3244009eet.234.1323221897080; Tue, 06 Dec 2011 17:38:17 -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.205.129.2 with SMTP id hg2cs58097bkc; Tue, 6 Dec 2011 17:38:15 -0800 (PST) Received: by 10.227.207.205 with SMTP id fz13mr3847233wbb.0.1323221894202; Tue, 06 Dec 2011 17:38:14 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ey2si42913wbb.19.2011.12.06.17.38.14 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Dec 2011 17:38:14 -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 1RY6Sb-0006km-RP for ; Wed, 07 Dec 2011 01:38:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id C2573E04D0 for ; Wed, 7 Dec 2011 01:38:13 +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: 173 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 173: move the wget | tar type of deployment into a helper function, and make sure that we fail if this... Message-Id: <20111207013813.2294.85034.launchpad@ackee.canonical.com> Date: Wed, 07 Dec 2011 01:38: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="14435"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: afda0980809a0c7b063692acbc47f1a8df644367 Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dispatcher/bug-900990/+merge/84701 proposed by: Michael Hudson-Doyle (mwhudson) review: Approve - Paul Larson (pwlars) ------------------------------------------------------------ revno: 173 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Wed 2011-12-07 14:36:37 +1300 message: move the wget | tar type of deployment into a helper function, and make sure that we fail if this command fails modified: lava_dispatcher/client/master.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/master.py' --- lava_dispatcher/client/master.py 2011-11-29 03:28:23 +0000 +++ lava_dispatcher/client/master.py 2011-12-07 01:35:56 +0000 @@ -63,17 +63,27 @@ raise RuntimeError("Failed to create tarball: %s" % tarfile) +def _deploy_tarball_to_board(session, tarball_url, dest, timeout=-1): + decompression_char = '' + if tarball_url.endswith('.gz') or tarball_url.endswith('.tgz'): + decompression_char = 'z' + elif tarball_url.endswith('.bz2'): + decompression_char = 'j' + rc = session.run( + 'wget -qO- %s |tar --numeric-owner -C %s -x%sf -' % ( + tarball_url, dest, decompression_char), + timeout=timeout) + if rc != 0: + msg = "Deploy: failed to deploy to %s" % dest + raise OperationFailed(msg) + + def _deploy_linaro_rootfs(session, rootfs): logging.info("Deploying linaro image") session.run('udevadm trigger') session.run('mkdir -p /mnt/root') session.run('mount /dev/disk/by-label/testrootfs /mnt/root') - rc = session.run( - 'wget -qO- %s |tar --numeric-owner -C /mnt/root -xzf -' % rootfs, - timeout=3600) - if rc != 0: - msg = "Deploy test rootfs partition: failed to download tarball." - raise OperationFailed(msg) + _deploy_tarball_to_board(session, rootfs, '/mnt/root', timeout=3600) session.run('echo linaro > /mnt/root/etc/hostname') #DO NOT REMOVE - diverting flash-kernel and linking it to /bin/true @@ -90,11 +100,7 @@ session.run('udevadm trigger') session.run('mkdir -p /mnt/boot') session.run('mount /dev/disk/by-label/testboot /mnt/boot') - rc = session.run( - 'wget -qO- %s |tar --numeric-owner -C /mnt/boot -xzf -' % bootfs) - if rc != 0: - msg = "Deploy test boot partition: failed to download tarball." - raise OperationFailed(msg) + _deploy_tarball_to_board(session, bootfs, '/mnt/boot') session.run('umount /mnt/boot') def _deploy_linaro_android_testboot(session, boottbz2, pkgbz2=None): @@ -106,11 +112,9 @@ session.run('mkdir -p /mnt/lava/boot') session.run('mount /dev/disk/by-label/testboot ' '/mnt/lava/boot') - session.run('wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -' % boottbz2) + _deploy_tarball_to_board(session, boottbz2, '/mnt/lava') if pkgbz2: - session.run( - 'wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -' - % pkgbz2) + _deploy_tarball_to_board(session, pkgbz2, '/mnt/lava') _recreate_uInitrd(session) @@ -167,9 +171,7 @@ session.run('mkdir -p /mnt/lava/system') session.run( 'mount /dev/disk/by-label/testrootfs /mnt/lava/system') - session.run( - 'wget -qO- %s |tar --numeric-owner -C /mnt/lava -xjf -' % systemtbz2, - timeout=600) + _deploy_tarball_to_board(session, systemtbz2, '/mnt/lava', timeout=600) sed_cmd = "/dev_mount sdcard \/mnt\/sdcard/c dev_mount sdcard /mnt/sdcard %s " \ "/devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0" %sdcard_part_lava