From patchwork Tue Jul 26 15:35:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Westby X-Patchwork-Id: 3154 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 486F824142 for ; Tue, 26 Jul 2011 15:35:34 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id F1283A1866F for ; Tue, 26 Jul 2011 15:35:33 +0000 (UTC) Received: by qwb8 with SMTP id 8so376000qwb.11 for ; Tue, 26 Jul 2011 08:35:33 -0700 (PDT) Received: by 10.229.25.212 with SMTP id a20mr717793qcc.148.1311694533413; Tue, 26 Jul 2011 08:35:33 -0700 (PDT) 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.229.217.78 with SMTP id hl14cs116808qcb; Tue, 26 Jul 2011 08:35:32 -0700 (PDT) Received: by 10.227.24.76 with SMTP id u12mr965429wbb.110.1311694531907; Tue, 26 Jul 2011 08:35:31 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id fz21si1110285wbb.103.2011.07.26.08.35.31; Tue, 26 Jul 2011 08:35:31 -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 1QljfP-0007eO-62 for ; Tue, 26 Jul 2011 15:35:31 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 27D892E8059 for ; Tue, 26 Jul 2011 15:35:31 +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: 389 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 389: Avoid an error if the kernel version doesn't match 2.6.*. Message-Id: <20110726153531.2571.37026.launchpad@loganberry.canonical.com> Date: Tue, 26 Jul 2011 15:35:31 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13503"; Instance="initZopeless config overlay" X-Launchpad-Hash: 200ad77e4e77a87729e53afb5de16df52aad5594 Merge authors: James Westby Related merge proposals: https://code.launchpad.net/~james-w/linaro-image-tools/fix-three-dot-oh/+merge/69302 proposed by: James Westby (james-w) review: Approve - Guilherme Salgado (salgado) ------------------------------------------------------------ revno: 389 [merge] committer: James Westby branch nick: trunk timestamp: Tue 2011-07-26 16:33:42 +0100 message: Avoid an error if the kernel version doesn't match 2.6.*. modified: linaro_image_tools/media_create/boards.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_image_tools/media_create/boards.py' --- linaro_image_tools/media_create/boards.py 2011-07-25 16:48:37 +0000 +++ linaro_image_tools/media_create/boards.py 2011-07-26 15:20:56 +0000 @@ -552,9 +552,12 @@ vmlinuz = _get_file_matching( os.path.join(chroot_dir, 'boot', 'vmlinuz*')) basename = os.path.basename(vmlinuz) - minor_version = re.match('.*2\.6\.([0-9]{2}).*', basename).group(1) - if int(minor_version) < 36: - cls.serial_tty = classproperty(lambda cls: 'ttyS2') + match = re.match('.*2\.6\.([0-9]{2}).*', basename) + # Assume if it doesn't match that it is 3.0 or later. + if match is not None: + minor_version = match.group(1) + if int(minor_version) < 36: + cls.serial_tty = classproperty(lambda cls: 'ttyS2') @classmethod def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2011-07-26 12:10:08 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2011-07-26 15:20:56 +0000 @@ -1039,6 +1039,14 @@ boards.BeagleConfig.set_appropriate_serial_tty(tempdir) self.assertEquals('ttyO2', boards.BeagleConfig.serial_tty) + def test_set_appropriate_serial_tty_three_dot_oh_kernel(self): + tempdir = self.useFixture(CreateTempDirFixture()).tempdir + boot_dir = os.path.join(tempdir, 'boot') + os.makedirs(boot_dir) + open(os.path.join(boot_dir, 'vmlinuz-3.0-13-foo'), 'w').close() + boards.BeagleConfig.set_appropriate_serial_tty(tempdir) + self.assertEquals('ttyO2', boards.BeagleConfig.serial_tty) + class TestGetSfdiskCmd(TestCase):