From patchwork Mon Oct 1 13:49:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milo Casagrande X-Patchwork-Id: 11891 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 BBC5323E54 for ; Mon, 1 Oct 2012 13:49:19 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 19905A1830C for ; Mon, 1 Oct 2012 13:49:18 +0000 (UTC) Received: by ieje10 with SMTP id e10so11631539iej.11 for ; Mon, 01 Oct 2012 06:49:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=RIZPA8ra+E5ixiMGuS3vzBkSHCmF+EyOEVlyZp3o3e8=; b=A6wi/IiJoSZbHv9z0/dQ+oUAidu+k3xcX8azh0j+4LMa4VSqO65lVJREF0FhaduJY9 W7ryxJJ17OIllbUHgk6g0IqsTM93zxEBoR52xcI74APVZYf8aWeckNgEag+nl36jNLkz nhqhhCEN1nX4rDOQKiIAJlWIsGGfHuIT1e+J/dB90M7EmjDYtZa1pHCY6qCyl1Grgiph U7CFwP18YdeWbzswRu2wMB32WuPHnKN1hoq52IsBWLx7wcv32/otBMa79wwQ9ZVzqX0Z UUbVbrfORTzE4IAgPTdZGpwVbDo75kndktsDPrXBWjlOyKCq2lgIqBeorxbGRp9C/8uL MCfA== Received: by 10.50.155.136 with SMTP id vw8mr5112421igb.28.1349099358513; Mon, 01 Oct 2012 06:49:18 -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.50.184.232 with SMTP id ex8csp26004igc; Mon, 1 Oct 2012 06:49:17 -0700 (PDT) Received: by 10.180.102.164 with SMTP id fp4mr14839031wib.13.1349099356581; Mon, 01 Oct 2012 06:49:16 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id y46si20674788web.159.2012.10.01.06.49.11 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Oct 2012 06:49:16 -0700 (PDT) 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 1TIgMw-0007nA-WE for ; Mon, 01 Oct 2012 13:49:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id E4424E02EB for ; Mon, 1 Oct 2012 13:49:10 +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: 568 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 568: Fixed regression on missing default bootloader. Message-Id: <20121001134910.5827.76362.launchpad@ackee.canonical.com> Date: Mon, 01 Oct 2012 13:49: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="16061"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 5d6f67b181ee3a3a470bc177180327bb84d54354 X-Gm-Message-State: ALoCoQmXCpH7YltCttN/6Qc3LnEgF5H1mwR7NOqc7OKhhMM8Znbx9S/1tUGuzN6OrmR+zc7dxhKp Merge authors: Milo Casagrande (milo) Related merge proposals: https://code.launchpad.net/~milo/linaro-image-tools/bug1057639/+merge/127270 proposed by: Milo Casagrande (milo) review: Approve - Paul Sokolovsky (pfalcon) ------------------------------------------------------------ revno: 568 [merge] committer: Milo Casagrande branch nick: trunk timestamp: Mon 2012-10-01 15:45:53 +0200 message: Fixed regression on missing default bootloader. modified: linaro-media-create linaro_image_tools/hwpack/hwpack_fields.py linaro_image_tools/media_create/__init__.py linaro_image_tools/media_create/boards.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 2012-08-09 23:00:50 +0000 +++ linaro-media-create 2012-10-01 12:50:55 +0000 @@ -106,6 +106,14 @@ parser = get_args_parser() args = parser.parse_args() + ch = logging.StreamHandler() + ch.setLevel(logging.INFO) + formatter = logging.Formatter("%(message)s") + ch.setFormatter(formatter) + logger = logging.getLogger("linaro_image_tools") + logger.setLevel(logging.INFO) + logger.addHandler(ch) + try: additional_option_checks(args) except IncompatibleOptions as e: @@ -154,14 +162,6 @@ # All good, move on. pass - ch = logging.StreamHandler() - ch.setLevel(logging.INFO) - formatter = logging.Formatter("%(message)s") - ch.setFormatter(formatter) - logger = logging.getLogger("linaro_image_tools") - logger.setLevel(logging.INFO) - logger.addHandler(ch) - # If --help was specified this won't execute. # Create temp dir and initialize rest of path vars. TMP_DIR = tempfile.mkdtemp() === modified file 'linaro_image_tools/hwpack/hwpack_fields.py' --- linaro_image_tools/hwpack/hwpack_fields.py 2012-09-24 09:07:37 +0000 +++ linaro_image_tools/hwpack/hwpack_fields.py 2012-10-01 12:49:58 +0000 @@ -91,6 +91,11 @@ 'bootfs_rootfs', 'reserved_bootfs_rootfs', ] +# Supported bootloaders +U_BOOT = 'u_boot' +UEFI = 'uefi' +DEFAULT_BOOTLOADER = U_BOOT + # Define where fields are valid, so we can test them. # If a key has a value None, this indicates there is either a value or # list of values that can be associated with it. === modified file 'linaro_image_tools/media_create/__init__.py' --- linaro_image_tools/media_create/__init__.py 2012-07-26 08:48:15 +0000 +++ linaro_image_tools/media_create/__init__.py 2012-10-01 13:44:05 +0000 @@ -26,6 +26,9 @@ from linaro_image_tools.media_create.android_boards import ( android_board_configs) from linaro_image_tools.__version__ import __version__ +from linaro_image_tools.hwpack.hwpack_fields import ( + DEFAULT_BOOTLOADER +) KNOWN_BOARDS = board_configs.keys() @@ -167,8 +170,9 @@ 'on selecting [mmc]"')) parser.add_argument( '--bootloader', - help="Select a bootloader from a hardware pack that contains more than" - "one.") + help="Select a bootloader from a hardware pack that contains more " + "than one. If not specified, it will default to '%s'." % + DEFAULT_BOOTLOADER) add_common_options(parser) return parser === modified file 'linaro_image_tools/media_create/boards.py' --- linaro_image_tools/media_create/boards.py 2012-09-12 10:51:00 +0000 +++ linaro_image_tools/media_create/boards.py 2012-10-01 12:58:41 +0000 @@ -47,6 +47,10 @@ partition_mounted, SECTOR_SIZE, register_loopback) from StringIO import StringIO +from linaro_image_tools.hwpack.hwpack_fields import ( + DEFAULT_BOOTLOADER, +) + KERNEL_GLOB = 'vmlinuz-*-%(kernel_flavor)s' INITRD_GLOB = 'initrd.img-*-%(kernel_flavor)s' DTB_GLOB = 'dt-*-%(kernel_flavor)s/%(dtb_name)s' @@ -438,6 +442,14 @@ hardwarepack_handler = None + @staticmethod + def _get_logger(): + """ + Gets the logger instance. + :return: The logger instance + """ + return logging.getLogger('linaro_image_tools') + @classmethod def get_metadata_field(cls, field_name): """ Return the metadata value for field_name if it can be found. @@ -451,6 +463,14 @@ @classmethod def set_metadata(cls, hwpacks, bootloader=None, board=None): + # If not bootloader is specified, we use the default one. + logger = cls._get_logger() + if not bootloader: + logger.warning('WARNING: no bootloader specified on the command ' + 'line. Defaulting to \'%s\'.' % DEFAULT_BOOTLOADER) + logger.warning('WARNING: specify another bootloader if this is ' + 'not the correct one to use.') + bootloader = DEFAULT_BOOTLOADER cls.hardwarepack_handler = HardwarepackHandler(hwpacks, bootloader, board) with cls.hardwarepack_handler: