From patchwork Wed Feb 29 01:36:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 6983 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 9DBBC23EAF for ; Wed, 29 Feb 2012 01:36:12 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4AEE3A18079 for ; Wed, 29 Feb 2012 01:36:12 +0000 (UTC) Received: by iage36 with SMTP id e36so2368623iag.11 for ; Tue, 28 Feb 2012 17:36:11 -0800 (PST) Received: from mr.google.com ([10.50.12.170]) by 10.50.12.170 with SMTP id z10mr5094626igb.55.1330479371818 (num_hops = 1); Tue, 28 Feb 2012 17:36:11 -0800 (PST) Received: by 10.50.12.170 with SMTP id z10mr4235404igb.55.1330479371758; Tue, 28 Feb 2012 17:36:11 -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.231.11.10 with SMTP id r10csp22093ibr; Tue, 28 Feb 2012 17:36:11 -0800 (PST) Received: by 10.180.83.70 with SMTP id o6mr10003613wiy.19.1330479370676; Tue, 28 Feb 2012 17:36:10 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id a1si12679145wed.33.2012.02.28.17.36.10 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Feb 2012 17:36:10 -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 1S2YSg-0003tl-4X for ; Wed, 29 Feb 2012 01:36:10 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 144ADE0842 for ; Wed, 29 Feb 2012 01:36:10 +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: 236 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 236: allow deploying from an image compressed with gzip, bzip2 or xz Message-Id: <20120229013610.1957.21541.launchpad@ackee.canonical.com> Date: Wed, 29 Feb 2012 01:36:10 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14874"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 92a226d8f63a92b9eef9c4b466dd4c1556f53111 X-Gm-Message-State: ALoCoQlDJ5ge5dUSpZMnhOxhOPRBjcMLP6QxiJz9rHwQ1uZfWl0Si6ajxBkmZ/osnB3feWzUlSzI Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dispatcher/deploy-from-compressed-image-bug-940036/+merge/94904 proposed by: Michael Hudson-Doyle (mwhudson) ------------------------------------------------------------ revno: 236 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Wed 2012-02-29 14:34:44 +1300 message: allow deploying from an image compressed with gzip, bzip2 or xz modified: lava_dispatcher/client/master.py lava_dispatcher/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/master.py' --- lava_dispatcher/client/master.py 2012-02-26 22:17:45 +0000 +++ lava_dispatcher/client/master.py 2012-02-29 01:33:14 +0000 @@ -20,13 +20,14 @@ # with this program; if not, see . import contextlib +import logging import os import pexpect import shutil -import traceback +import subprocess from tempfile import mkdtemp -import logging import time +import traceback from lava_dispatcher.utils import ( download, @@ -261,6 +262,19 @@ def master_str(self): return self.device_option("MASTER_STR") + def decompress(self, image_file): + for suffix, command in [('.gz', 'gunzip'), + ('.xz', 'unxz'), + ('.bz2', 'bunzip2')]: + if image_file.endswith(suffix): + logging.info("Uncompressing %s with %s", image_file, command) + uncompressed_name = image_file[:-len(suffix)] + subprocess.check_call( + [command, '-c', image_file], stdout=open(uncompressed_name, 'w')) + return uncompressed_name + return image_file + + def deploy_linaro(self, hwpack=None, rootfs=None, image=None, kernel_matrix=None, use_cache=True, rootfstype='ext3'): LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir @@ -283,6 +297,7 @@ image_file = download_with_cache(image, tarball_dir, lava_cachedir) else: image_file = download(image, tarball_dir) + image_file = self.decompress(image_file) boot_tgz, root_tgz = self._generate_tarballs(image_file) except CriticalError: raise === modified file 'lava_dispatcher/utils.py' --- lava_dispatcher/utils.py 2012-02-07 19:16:17 +0000 +++ lava_dispatcher/utils.py 2012-02-28 03:19:36 +0000 @@ -86,7 +86,7 @@ splitter.whitespace = "," splitter.whitespace_split = True newlines_to_spaces = lambda x: x.replace('\n', ' ') - strip_newlines = lambda x: newlines_to_spaces(x).strip(' ') + strip_newlines = lambda x: newlines_to_spaces(x).strip(' ') return map(strip_newlines, list(splitter)) def logging_system(cmd):