From patchwork Thu Jun 14 09:18:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?0JTQsNC90LjQu9C+INCo0LXQs9Cw0L0=?= X-Patchwork-Id: 9278 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 7BFCE23E55 for ; Thu, 14 Jun 2012 09:20:15 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id DDCF7A189B7 for ; Thu, 14 Jun 2012 09:20:14 +0000 (UTC) Received: by yhpp61 with SMTP id p61so1389265yhp.11 for ; Thu, 14 Jun 2012 02:20:14 -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=HDxsqKa6tKvdliEstsuaw6zL649QopQzWi5xQ9OUCJI=; b=WO95Pe83e7ExAMdic3cs3WeezOcdVi5h1kiXI63YbMzdcZcgrPyDUYh+q+fVRbdyKf dcphD7ou9VR9rwt0FONdGYltcXNAWrgZEfM9hUrslVL6qGiF9Eis9dA0RPhAocUxD91l Uqef5HKQQJejoRPVhXWlMDLXaRsA0Z8k6/+5nGN616YcE7D6nb4zBdNhsUTb1GwjMmum QEJCFykBD2dE/gGgIEAD7B6c7WOZ971GyNW+oGZOWKEotpsm4ZFCFYFxEFeFvVXLqkn2 61GrlVEp0q1Fl8nmi/WzTWxMwJoH7NxCqwOsUG+z0mLJ/x6U9X4pA1LJpvhKSmoNuXAK 4W8A== Received: by 10.50.193.196 with SMTP id hq4mr12138699igc.57.1339665614131; Thu, 14 Jun 2012 02:20:14 -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.231.24.148 with SMTP id v20csp71526ibb; Thu, 14 Jun 2012 02:20:11 -0700 (PDT) Received: by 10.180.78.233 with SMTP id e9mr2694371wix.5.1339665491825; Thu, 14 Jun 2012 02:18:11 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id f3si11039059wiz.35.2012.06.14.02.18.11 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Jun 2012 02:18:11 -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 1Sf6Bv-00078A-7j for ; Thu, 14 Jun 2012 09:18:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 300AFE0052 for ; Thu, 14 Jun 2012 09:18:11 +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: 527 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 527: Fix remaining PEP-8 problems. Message-Id: <20120614091811.26869.16799.launchpad@ackee.canonical.com> Date: Thu, 14 Jun 2012 09:18:11 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15405"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 214ca75828eb826b100af16981e5d15898fb15a2 X-Gm-Message-State: ALoCoQk8HkylK16vMZo45sMql+gEcu3puFjms/8jSnxiYN3Yt5XZm+bF+mMIVBIC/+AbsnknYVit Merge authors: Данило Шеган (danilo) Related merge proposals: https://code.launchpad.net/~danilo/linaro-image-tools/more-pep8-fixes/+merge/110100 proposed by: Данило Шеган (danilo) review: Approve - Milo Casagrande (milo) review: Approve - Loïc Minier (lool) ------------------------------------------------------------ revno: 527 [merge] committer: Danilo Segan branch nick: trunk timestamp: Thu 2012-06-14 11:10:17 +0200 message: Fix remaining PEP-8 problems. modified: linaro_image_tools/cmd_runner.py linaro_image_tools/hwpack/__init__.py linaro_image_tools/hwpack/better_tarfile.py linaro_image_tools/hwpack/builder.py linaro_image_tools/hwpack/config.py linaro_image_tools/hwpack/hardwarepack.py linaro_image_tools/hwpack/hardwarepack_format.py linaro_image_tools/hwpack/packages.py linaro_image_tools/hwpack/tarfile_matchers.py linaro_image_tools/hwpack/testing.py linaro_image_tools/hwpack/tests/__init__.py linaro_image_tools/hwpack/tests/test_better_tarfile.py linaro_image_tools/hwpack/tests/test_builder.py linaro_image_tools/hwpack/tests/test_config.py linaro_image_tools/hwpack/tests/test_hardwarepack.py linaro_image_tools/hwpack/tests/test_packages.py linaro_image_tools/hwpack/tests/test_script.py linaro_image_tools/hwpack/tests/test_tarfile_matchers.py linaro_image_tools/hwpack/tests/test_testing.py linaro_image_tools/media_create/__init__.py linaro_image_tools/media_create/android_boards.py linaro_image_tools/media_create/boards.py linaro_image_tools/media_create/check_device.py linaro_image_tools/media_create/chroot_utils.py linaro_image_tools/media_create/rootfs.py linaro_image_tools/media_create/tests/test_media_create.py linaro_image_tools/media_create/unpack_binary_tarball.py linaro_image_tools/testing.py linaro_image_tools/tests/fixtures.py linaro_image_tools/tests/test_pep8.py linaro_image_tools/tests/test_utils.py linaro_image_tools/utils.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/cmd_runner.py' --- linaro_image_tools/cmd_runner.py 2012-06-07 12:59:21 +0000 +++ linaro_image_tools/cmd_runner.py 2012-06-13 14:26:02 +0000 @@ -3,7 +3,7 @@ # Author: Guilherme Salgado # # This file is part of Linaro Image Tools. -# +# # Linaro Image Tools is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or === modified file 'linaro_image_tools/hwpack/__init__.py' --- linaro_image_tools/hwpack/__init__.py 2011-01-28 19:50:48 +0000 +++ linaro_image_tools/hwpack/__init__.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/hwpack/better_tarfile.py' --- linaro_image_tools/hwpack/better_tarfile.py 2012-06-07 13:12:42 +0000 +++ linaro_image_tools/hwpack/better_tarfile.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/hwpack/builder.py' --- linaro_image_tools/hwpack/builder.py 2012-06-07 12:59:21 +0000 +++ linaro_image_tools/hwpack/builder.py 2012-06-13 14:53:32 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, @@ -104,7 +104,8 @@ wanted_package_name) return wanted_package - def add_file_to_hwpack(self, package, wanted_file, package_unpacker, hwpack, target_path): + def add_file_to_hwpack(self, package, wanted_file, package_unpacker, + hwpack, target_path): tempfile_name = package_unpacker.get_file( package.filepath, wanted_file) return hwpack.add_file(target_path, tempfile_name) === modified file 'linaro_image_tools/hwpack/config.py' --- linaro_image_tools/hwpack/config.py 2012-06-07 13:22:47 +0000 +++ linaro_image_tools/hwpack/config.py 2012-06-13 14:53:32 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, @@ -238,7 +238,7 @@ @property def serial_tty(self): - """/dev device name of the serial console for this kernel + """/dev device name of the serial console for this kernel A str. """ @@ -279,7 +279,7 @@ @property def kernel_addr(self): - """address where u-boot should load the kernel + """address where u-boot should load the kernel An int. """ @@ -287,7 +287,7 @@ @property def initrd_addr(self): - """address where u-boot should load the kernel + """address where u-boot should load the kernel An int. """ @@ -327,9 +327,9 @@ @property def partition_layout(self): - """bootfs16_rootfs, bootfs_rootfs and reserved_bootfs_rootfs; - controls what kind of SD card partition layout we should use when - writing images + """bootfs16_rootfs, bootfs_rootfs and reserved_bootfs_rootfs; + controls what kind of SD card partition layout we should use when + writing images A str. """ @@ -337,7 +337,7 @@ @property def mmc_id(self): - """which MMC drive contains the boot filesystem + """which MMC drive contains the boot filesystem An int. """ @@ -795,8 +795,9 @@ if u_boot_package is not None: self._assert_matches_pattern( self.PACKAGE_REGEX, u_boot_package, "Invalid value in %s in " \ - "the [%s] section: %s" % (self.U_BOOT_PACKAGE_KEY, - self.MAIN_SECTION, u_boot_package)) + "the [%s] section: %s" % ( + self.U_BOOT_PACKAGE_KEY, self.MAIN_SECTION, + u_boot_package)) def _validate_spl_package(self): spl_package = self.spl_package === modified file 'linaro_image_tools/hwpack/hardwarepack.py' --- linaro_image_tools/hwpack/hardwarepack.py 2012-06-07 13:22:47 +0000 +++ linaro_image_tools/hwpack/hardwarepack.py 2012-06-13 14:49:14 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, @@ -78,13 +78,13 @@ self.architecture = architecture @classmethod - def add_v2_config(self, serial_tty=None, kernel_addr=None, initrd_addr=None, - load_addr=None, dtb_file=None, wired_interfaces=[], - wireless_interfaces=[], partition_layout=None, - mmc_id=None, boot_min_size=None, root_min_size=None, - loader_min_size=None, vmlinuz=None, initrd=None, - dtb_addr=None, extra_boot_options=None, env_dd=None, - boot_script=None, uboot_in_boot_part=None, + def add_v2_config(self, serial_tty=None, kernel_addr=None, + initrd_addr=None, load_addr=None, dtb_file=None, + wired_interfaces=[], wireless_interfaces=[], + partition_layout=None, mmc_id=None, boot_min_size=None, + root_min_size=None, loader_min_size=None, vmlinuz=None, + initrd=None, dtb_addr=None, extra_boot_options=None, + env_dd=None, boot_script=None, uboot_in_boot_part=None, uboot_dd=None, spl_in_boot_part=None, spl_dd=None, extra_serial_opts=None, loader_start=None, snowball_startup_files_config=None, @@ -150,35 +150,38 @@ format=config.format) if config.format.has_v2_fields: - metadata.add_v2_config(serial_tty=config.serial_tty, - kernel_addr=config.kernel_addr, - initrd_addr=config.initrd_addr, - load_addr=config.load_addr, - wired_interfaces=config.wired_interfaces, - wireless_interfaces=config.wireless_interfaces, - partition_layout=config.partition_layout, - mmc_id=config.mmc_id, - boot_min_size=config.boot_min_size, - root_min_size=config.root_min_size, - loader_min_size=config.loader_min_size, - loader_start=config.loader_start, - vmlinuz=config.vmlinuz, - initrd=config.initrd, - dtb_file=config.dtb_file, - dtb_addr=config.dtb_addr, - extra_boot_options=config.extra_boot_options, - boot_script=config.boot_script, - uboot_in_boot_part=config.uboot_in_boot_part, - uboot_dd=config.uboot_dd, - spl_in_boot_part=config.spl_in_boot_part, - spl_dd=config.spl_dd, - env_dd=config.env_dd, - extra_serial_opts=config.extra_serial_opts, - snowball_startup_files_config=config.snowball_startup_files_config, - samsung_bl1_start=config.samsung_bl1_start, - samsung_bl1_len=config.samsung_bl1_len, - samsung_env_len=config.samsung_env_len, - samsung_bl2_len=config.samsung_bl2_len) + # Helper variable to adhere to the line length limit. + snowball_startup_config = config.snowball_startup_files_config + metadata.add_v2_config( + serial_tty=config.serial_tty, + kernel_addr=config.kernel_addr, + initrd_addr=config.initrd_addr, + load_addr=config.load_addr, + wired_interfaces=config.wired_interfaces, + wireless_interfaces=config.wireless_interfaces, + partition_layout=config.partition_layout, + mmc_id=config.mmc_id, + boot_min_size=config.boot_min_size, + root_min_size=config.root_min_size, + loader_min_size=config.loader_min_size, + loader_start=config.loader_start, + vmlinuz=config.vmlinuz, + initrd=config.initrd, + dtb_file=config.dtb_file, + dtb_addr=config.dtb_addr, + extra_boot_options=config.extra_boot_options, + boot_script=config.boot_script, + uboot_in_boot_part=config.uboot_in_boot_part, + uboot_dd=config.uboot_dd, + spl_in_boot_part=config.spl_in_boot_part, + spl_dd=config.spl_dd, + env_dd=config.env_dd, + extra_serial_opts=config.extra_serial_opts, + snowball_startup_files_config=snowball_startup_config, + samsung_bl1_start=config.samsung_bl1_start, + samsung_bl1_len=config.samsung_bl1_len, + samsung_env_len=config.samsung_env_len, + samsung_bl2_len=config.samsung_bl2_len) return metadata def __str__(self): @@ -211,7 +214,8 @@ if self.dtb_addr is not None: metadata += "DTB_ADDR=%s\n" % self.dtb_addr if self.wired_interfaces != []: - metadata += "WIRED_INTERFACES=%s\n" % " ".join(self.wired_interfaces) + metadata += "WIRED_INTERFACES=%s\n" % " ".join( + self.wired_interfaces) if self.wireless_interfaces != []: metadata += "WIRELESS_INTERFACES=%s\n" % " ".join( self.wireless_interfaces) @@ -250,7 +254,8 @@ if self.extra_serial_opts is not None: metadata += "EXTRA_SERIAL_OPTIONS=%s\n" % self.extra_serial_opts if self.snowball_startup_files_config is not None: - metadata += "SNOWBALL_STARTUP_FILES_CONFIG=%s\n" % self.snowball_startup_files_config + metadata += "SNOWBALL_STARTUP_FILES_CONFIG=%s\n" % ( + self.snowball_startup_files_config) if self.samsung_bl1_start is not None: metadata += "SAMSUNG_BL1_START=%s\n" % self.samsung_bl1_start if self.samsung_bl1_len is not None: @@ -413,7 +418,8 @@ # Don't output sources with passwords in them if not url_parsed.password: tf.create_file_from_string( - self.SOURCES_LIST_DIRNAME + "/" + source_name + ".list", + (self.SOURCES_LIST_DIRNAME + "/" + + source_name + ".list"), "deb " + source_info + "\n") # TODO: include sources keys etc. tf.create_dir(self.SOURCES_LIST_GPG_DIRNAME) === modified file 'linaro_image_tools/hwpack/hardwarepack_format.py' --- linaro_image_tools/hwpack/hardwarepack_format.py 2012-02-07 23:53:51 +0000 +++ linaro_image_tools/hwpack/hardwarepack_format.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/hwpack/packages.py' --- linaro_image_tools/hwpack/packages.py 2012-06-07 13:00:08 +0000 +++ linaro_image_tools/hwpack/packages.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/hwpack/tarfile_matchers.py' --- linaro_image_tools/hwpack/tarfile_matchers.py 2011-01-28 19:50:48 +0000 +++ linaro_image_tools/hwpack/tarfile_matchers.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/hwpack/testing.py' --- linaro_image_tools/hwpack/testing.py 2012-06-07 12:59:21 +0000 +++ linaro_image_tools/hwpack/testing.py 2012-06-13 14:53:32 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, @@ -382,7 +382,8 @@ if self.package_spec: dep_package_matcher = dep_package_matcher.update( depends=MatchesPackageRelationshipList( - [Equals(p.strip()) for p in self.package_spec.split(',')])) + [Equals(p.strip()) + for p in self.package_spec.split(',')])) package_matchers.append(dep_package_matcher) matchers.append(HardwarePackHasFile( "pkgs/Packages", === modified file 'linaro_image_tools/hwpack/tests/__init__.py' --- linaro_image_tools/hwpack/tests/__init__.py 2012-06-07 13:12:42 +0000 +++ linaro_image_tools/hwpack/tests/__init__.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/hwpack/tests/test_better_tarfile.py' --- linaro_image_tools/hwpack/tests/test_better_tarfile.py 2011-03-23 22:25:10 +0000 +++ linaro_image_tools/hwpack/tests/test_better_tarfile.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/hwpack/tests/test_builder.py' --- linaro_image_tools/hwpack/tests/test_builder.py 2012-06-07 12:59:21 +0000 +++ linaro_image_tools/hwpack/tests/test_builder.py 2012-06-13 14:53:32 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, @@ -115,17 +115,18 @@ def setUp(self): super(HardwarePackBuilderTests, self).setUp() self.useFixture(ChdirToTempdirFixture()) - self.extra_config = {'format': '2.0', - 'u-boot-package': 'wanted-package', - 'u-boot-file': 'wanted-file', - 'partition_layout': 'bootfs_rootfs', - 'x_loader_package': 'x-loader-omap4-panda', - 'x_loader_file': 'usr/lib/x-loader/omap4430panda/MLO', - 'kernel_file': 'boot/vmlinuz-3.0.0-1002-linaro-omap', - 'initrd_file': 'boot/initrd.img-3.0.0-1002-linaro-omap', - 'boot_script': 'boot.scr', - 'mmc_id': '0:1', - 'u_boot_in_boot_part': 'no'} + self.extra_config = { + 'format': '2.0', + 'u-boot-package': 'wanted-package', + 'u-boot-file': 'wanted-file', + 'partition_layout': 'bootfs_rootfs', + 'x_loader_package': 'x-loader-omap4-panda', + 'x_loader_file': 'usr/lib/x-loader/omap4430panda/MLO', + 'kernel_file': 'boot/vmlinuz-3.0.0-1002-linaro-omap', + 'initrd_file': 'boot/initrd.img-3.0.0-1002-linaro-omap', + 'boot_script': 'boot.scr', + 'mmc_id': '0:1', + 'u_boot_in_boot_part': 'no'} def test_raises_on_missing_configuration(self): e = self.assertRaises( === modified file 'linaro_image_tools/hwpack/tests/test_config.py' --- linaro_image_tools/hwpack/tests/test_config.py 2011-09-27 07:06:09 +0000 +++ linaro_image_tools/hwpack/tests/test_config.py 2012-06-13 14:32:49 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, @@ -32,21 +32,24 @@ "[hwpack]\nname = ahwpack\npackages = foo\narchitectures = armel\n") valid_start_v2 = valid_start + "format = 2.0\n" valid_complete_v2 = (valid_start_v2 + - "u_boot_package = u-boot-linaro-s5pv310\n" \ - "u_boot_file = usr/lib/u-boot/smdkv310/" \ - "u-boot.bin\nserial_tty=ttySAC1\n" \ - "partition_layout = bootfs_rootfs\n"\ - "spl_package = x-loader-omap4-panda\n"\ - "spl_file = usr/lib/x-loader/omap4430panda/MLO\n"\ - "kernel_file = boot/vmlinuz-*-linaro-omap\n"\ - "initrd_file = boot/initrd.img-*-linaro-omap\n"\ - "dtb_file = boot/dt-*-linaro-omap/omap4-panda.dtb\n"\ - "boot_script = boot.scr\n"\ - "extra_serial_options = console=tty0 console=ttyO2,115200n8\n"\ - "extra_boot_options = earlyprintk fixrtc nocompcache vram=48M omapfb.vram=0:24M mem=456M@0x80000000 mem=512M@0xA0000000\n"\ - "boot_script = boot.scr\n"\ - "mmc_id = 0:1\n"\ - "u_boot_in_boot_part = Yes\n") + "u_boot_package = u-boot-linaro-s5pv310\n" + "u_boot_file = usr/lib/u-boot/smdkv310/" + "u-boot.bin\nserial_tty=ttySAC1\n" + "partition_layout = bootfs_rootfs\n" + "spl_package = x-loader-omap4-panda\n" + "spl_file = usr/lib/x-loader/omap4430panda/MLO\n" + "kernel_file = boot/vmlinuz-*-linaro-omap\n" + "initrd_file = boot/initrd.img-*-linaro-omap\n" + "dtb_file = boot/dt-*-linaro-omap/omap4-panda.dtb\n" + "boot_script = boot.scr\n" + + ("extra_serial_options = console=tty0 " + "console=ttyO2,115200n8\n") + + ("extra_boot_options = earlyprintk fixrtc " + "nocompcache vram=48M omapfb.vram=0:24M " + "mem=456M@0x80000000 mem=512M@0xA0000000\n") + + "boot_script = boot.scr\n" + "mmc_id = 0:1\n" + "u_boot_in_boot_part = Yes\n") valid_end = "[ubuntu]\nsources-entry = foo bar\n" def test_create(self): @@ -203,13 +206,13 @@ config) def test_validate_invalid_u_boot_file(self): - config = self.get_config(self.valid_start_v2 + + config = self.get_config(self.valid_start_v2 + "u_boot_package = u-boot-linaro-s5pv310\n" \ "u_boot_file = ~~\n") self.assertValidationError("Invalid path: ~~", config) def test_validate_invalid_kernel_file(self): - config = self.get_config(self.valid_start_v2 + + config = self.get_config(self.valid_start_v2 + "u-boot-package = u-boot-linaro-s5pv310\n" \ "u-boot-file = u-boot.bin\n" \ "partition_layout = bootfs_rootfs\n"\ @@ -217,54 +220,60 @@ self.assertValidationError("Invalid path: ~~", config) def test_validate_empty_kernel_file(self): - config = self.get_config(self.valid_start_v2 + + config = self.get_config(self.valid_start_v2 + "u-boot-package = u-boot-linaro-s5pv310\n" \ "u-boot-file = u-boot.bin\n" "partition_layout = bootfs_rootfs\n"\ "kernel_file = \n") - self.assertValidationError("No kernel_file in the [hwpack] section", config) + self.assertValidationError("No kernel_file in the [hwpack] section", + config) def test_validate_invalid_initrd_file(self): - config = self.get_config(self.valid_start_v2 + - "u-boot-package = u-boot-linaro-s5pv310\n" \ - "u-boot-file = u-boot.bin\n" \ - "partition_layout = bootfs_rootfs\n"\ - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ - "initrd_file = ~~\n") + config = self.get_config( + self.valid_start_v2 + + "u-boot-package = u-boot-linaro-s5pv310\n" \ + "u-boot-file = u-boot.bin\n" \ + "partition_layout = bootfs_rootfs\n"\ + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ + "initrd_file = ~~\n") self.assertValidationError("Invalid path: ~~", config) def test_validate_empty_initrd_file(self): - config = self.get_config(self.valid_start_v2 + - "u-boot-package = u-boot-linaro-s5pv310\n" \ - "u-boot-file = u-boot.bin\n" - "partition_layout = bootfs_rootfs\n"\ - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ - "initrd_file = \n") - self.assertValidationError("No initrd_file in the [hwpack] section", config) + config = self.get_config( + self.valid_start_v2 + + "u-boot-package = u-boot-linaro-s5pv310\n" \ + "u-boot-file = u-boot.bin\n" + "partition_layout = bootfs_rootfs\n"\ + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ + "initrd_file = \n") + self.assertValidationError("No initrd_file in the [hwpack] section", + config) def test_validate_invalid_boot_script(self): - config = self.get_config(self.valid_start_v2 + - "u-boot-package = u-boot-linaro-s5pv310\n" \ - "mmc_id = 0:1\n"\ - "u-boot-file = u-boot.bin\n" \ - "partition_layout = bootfs_rootfs\n"\ - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ - "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ - "u_boot_in_boot_part = No\n"\ - "boot_script = ~~\n") + config = self.get_config( + self.valid_start_v2 + + "u-boot-package = u-boot-linaro-s5pv310\n" \ + "mmc_id = 0:1\n"\ + "u-boot-file = u-boot.bin\n" \ + "partition_layout = bootfs_rootfs\n"\ + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ + "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ + "u_boot_in_boot_part = No\n"\ + "boot_script = ~~\n") self.assertValidationError("Invalid path: ~~", config) def test_validate_invalid_dtb_file(self): - config = self.get_config(self.valid_start_v2 + - "u-boot-package = u-boot-linaro-s5pv310\n" \ - "u-boot-file = u-boot.bin\n" \ - "partition_layout = bootfs_rootfs\n"\ - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ - "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ - "boot_script = boot.scr\n"\ - "u_boot_in_boot_part = No\n"\ - "mmc_id = 0:1\n"\ - "dtb_file = ~~\n") + config = self.get_config( + self.valid_start_v2 + + "u-boot-package = u-boot-linaro-s5pv310\n" \ + "u-boot-file = u-boot.bin\n" \ + "partition_layout = bootfs_rootfs\n"\ + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ + "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ + "boot_script = boot.scr\n"\ + "u_boot_in_boot_part = No\n"\ + "mmc_id = 0:1\n"\ + "dtb_file = ~~\n") self.assertValidationError("Invalid path: ~~", config) def test_validate_invalid_spl_package_name(self): @@ -279,12 +288,13 @@ config) def test_validate_invalid_spl_file(self): - config = self.get_config(self.valid_start_v2 + - "u-boot-package = u-boot-linaro-s5pv310\n" \ - "u-boot-file = usr/bin/version/MLO\n" \ - "partition_layout = bootfs_rootfs\n" \ - "spl_package = x-loader--linaro-s5pv310\n" \ - "spl_file = ~~\n") + config = self.get_config( + self.valid_start_v2 + + "u-boot-package = u-boot-linaro-s5pv310\n" \ + "u-boot-file = usr/bin/version/MLO\n" \ + "partition_layout = bootfs_rootfs\n" \ + "spl_package = x-loader--linaro-s5pv310\n" \ + "spl_file = ~~\n") self.assertValidationError("Invalid path: ~~", config) def test_validate_partition_layout(self): @@ -306,124 +316,132 @@ self.assertTrue("XXX What is an invalid interface name?") def test_validate_u_boot_in_boot_part(self): - config = self.get_config(self.valid_start_v2 + - "u-boot-package = u-boot-linaro-s5pv310\n" \ - "u-boot-file = u-boot.bin\n" \ - "partition_layout = bootfs_rootfs\n"\ - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ - "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ - "boot_script = boot.scr\n"\ - "mmc_id = 0:1\n"\ - "u_boot_in_boot_part = Nope\n") - self.assertValidationError("Invalid value for u_boot_in_boot_part: Nope", config) + config = self.get_config( + self.valid_start_v2 + + "u-boot-package = u-boot-linaro-s5pv310\n" \ + "u-boot-file = u-boot.bin\n" \ + "partition_layout = bootfs_rootfs\n"\ + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ + "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ + "boot_script = boot.scr\n"\ + "mmc_id = 0:1\n"\ + "u_boot_in_boot_part = Nope\n") + self.assertValidationError( + "Invalid value for u_boot_in_boot_part: Nope", config) def test_validate_u_boot_in_boot_part_bool(self): - config = self.get_config(self.valid_start_v2 + - "u-boot-package = u-boot-linaro-s5pv310\n" \ - "u-boot-file = u-boot.bin\n" \ - "partition_layout = bootfs_rootfs\n"\ - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ - "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ - "boot_script = boot.scr\n"\ - "mmc_id = 0:1\n"\ - "u_boot_in_boot_part = True\n") - self.assertValidationError("Invalid value for u_boot_in_boot_part: True", config) + config = self.get_config( + self.valid_start_v2 + + "u-boot-package = u-boot-linaro-s5pv310\n" \ + "u-boot-file = u-boot.bin\n" \ + "partition_layout = bootfs_rootfs\n"\ + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ + "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ + "boot_script = boot.scr\n"\ + "mmc_id = 0:1\n"\ + "u_boot_in_boot_part = True\n") + self.assertValidationError( + "Invalid value for u_boot_in_boot_part: True", config) def test_validate_serial_tty(self): - config = self.get_config(self.valid_start_v2 + - "u_boot_package = u-boot-linaro-s5pv310\n" \ - "u_boot_file = u-boot.bin\nserial_tty=tty\n") + config = self.get_config( + self.valid_start_v2 + + "u_boot_package = u-boot-linaro-s5pv310\n" \ + "u_boot_file = u-boot.bin\nserial_tty=tty\n") self.assertValidationError("Invalid serial tty: tty", config) - config = self.get_config(self.valid_start_v2 + - "u_boot_package = u-boot-linaro-s5pv310\n" \ - "u_boot_file = u-boot.bin\n" \ - "serial_tty=ttxSAC1\n") + config = self.get_config( + self.valid_start_v2 + + "u_boot_package = u-boot-linaro-s5pv310\n" \ + "u_boot_file = u-boot.bin\n" \ + "serial_tty=ttxSAC1\n") self.assertValidationError("Invalid serial tty: ttxSAC1", config) def test_validate_mmc_id(self): - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "mmc_id = x\n") self.assertValidationError("Invalid mmc_id x", config) def test_validate_boot_min_size(self): - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "boot_min_size = x\n") self.assertValidationError("Invalid boot min size x", config) def test_validate_root_min_size(self): - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "root_min_size = x\n") self.assertValidationError("Invalid root min size x", config) def test_validate_loader_min_size(self): - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "loader_min_size = x\n") self.assertValidationError("Invalid loader min size x", config) def test_validate_kernel_addr(self): - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "kernel_addr = 0x8000000\n") self.assertValidationError("Invalid kernel address: 0x8000000", config) - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "kernel_addr = 0x8000000x\n") - self.assertValidationError("Invalid kernel address: 0x8000000x", config) - config = self.get_config(self.valid_complete_v2 + + self.assertValidationError( + "Invalid kernel address: 0x8000000x", config) + config = self.get_config(self.valid_complete_v2 + "kernel_addr = 80000000\n") self.assertValidationError("Invalid kernel address: 80000000", config) def test_validate_initrd_addr(self): - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "initrd_addr = 0x8000000\n") self.assertValidationError("Invalid initrd address: 0x8000000", config) - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "initrd_addr = 0x8000000x\n") - self.assertValidationError("Invalid initrd address: 0x8000000x", config) - config = self.get_config(self.valid_complete_v2 + + self.assertValidationError( + "Invalid initrd address: 0x8000000x", config) + config = self.get_config(self.valid_complete_v2 + "initrd_addr = 80000000\n") self.assertValidationError("Invalid initrd address: 80000000", config) def test_validate_load_addr(self): - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "load_addr = 0x8000000\n") self.assertValidationError("Invalid load address: 0x8000000", config) - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "load_addr = 0x8000000x\n") self.assertValidationError("Invalid load address: 0x8000000x", config) - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "load_addr = 80000000\n") self.assertValidationError("Invalid load address: 80000000", config) def test_validate_dtb_addr(self): - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "dtb_addr = 0x8000000\n") self.assertValidationError("Invalid dtb address: 0x8000000", config) - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "dtb_addr = 0x8000000x\n") self.assertValidationError("Invalid dtb address: 0x8000000x", config) - config = self.get_config(self.valid_complete_v2 + + config = self.get_config(self.valid_complete_v2 + "dtb_addr = 80000000\n") self.assertValidationError("Invalid dtb address: 80000000", config) def test_wired_interfaces(self): - config = self.get_config(self.valid_complete_v2 + - "wired_interfaces = eth0\n" + + config = self.get_config(self.valid_complete_v2 + + "wired_interfaces = eth0\n" + self.valid_end) config.validate() self.assertEqual(["eth0"], config.wired_interfaces) - config = self.get_config(self.valid_complete_v2 + - "wired_interfaces = eth0 eth1 usb2\n" + + config = self.get_config(self.valid_complete_v2 + + "wired_interfaces = eth0 eth1 usb2\n" + self.valid_end) config.validate() self.assertEqual(["eth0", "eth1", "usb2"], config.wired_interfaces) def test_wireless_interfaces(self): - config = self.get_config(self.valid_complete_v2 + - "wireless_interfaces = wlan0\n" + + config = self.get_config(self.valid_complete_v2 + + "wireless_interfaces = wlan0\n" + self.valid_end) config.validate() self.assertEqual(["wlan0"], config.wireless_interfaces) - config = self.get_config(self.valid_complete_v2 + - "wireless_interfaces = wlan0 wl1 usb2\n" + + config = self.get_config(self.valid_complete_v2 + + "wireless_interfaces = wlan0 wl1 usb2\n" + self.valid_end) config.validate() self.assertEqual(["wlan0", "wl1", "usb2"], config.wireless_interfaces) @@ -473,8 +491,10 @@ def test_extra_boot_options(self): config = self.get_config(self.valid_complete_v2 + self.valid_end) config.validate() - self.assertEqual("earlyprintk fixrtc nocompcache vram=48M omapfb.vram=0:24M mem=456M@0x80000000 mem=512M@0xA0000000", - config.extra_boot_options) + self.assertEqual( + "earlyprintk fixrtc nocompcache vram=48M " + "omapfb.vram=0:24M mem=456M@0x80000000 mem=512M@0xA0000000", + config.extra_boot_options) def test_extra_serial_opts(self): config = self.get_config(self.valid_complete_v2 + self.valid_end) @@ -506,77 +526,77 @@ self.assertEqual("ttySAC1", config.serial_tty) def test_mmc_id(self): - config = self.get_config(self.valid_complete_v2 + - "mmc_id = 0:1\n" + + config = self.get_config(self.valid_complete_v2 + + "mmc_id = 0:1\n" + self.valid_end) config.validate() self.assertEqual("0:1", config.mmc_id) def test_boot_min_size(self): - config = self.get_config(self.valid_complete_v2 + - "boot_min_size = 50\n" + + config = self.get_config(self.valid_complete_v2 + + "boot_min_size = 50\n" + self.valid_end) config.validate() self.assertEqual("50", config.boot_min_size) def test_root_min_size(self): - config = self.get_config(self.valid_complete_v2 + - "root_min_size = 50\n" + + config = self.get_config(self.valid_complete_v2 + + "root_min_size = 50\n" + self.valid_end) config.validate() self.assertEqual("50", config.root_min_size) def test_loader_min_size(self): - config = self.get_config(self.valid_complete_v2 + - "loader_min_size = 2\n" + + config = self.get_config(self.valid_complete_v2 + + "loader_min_size = 2\n" + self.valid_end) config.validate() self.assertEqual("2", config.loader_min_size) def test_kernel_addr(self): - config = self.get_config(self.valid_complete_v2 + - "kernel_addr = 0x80000000\n" + + config = self.get_config(self.valid_complete_v2 + + "kernel_addr = 0x80000000\n" + self.valid_end) config.validate() self.assertEqual("0x80000000", config.kernel_addr) - config = self.get_config(self.valid_complete_v2 + - "kernel_addr = 0x8aBcdEFf\n" + + config = self.get_config(self.valid_complete_v2 + + "kernel_addr = 0x8aBcdEFf\n" + self.valid_end) config.validate() self.assertEqual("0x8aBcdEFf", config.kernel_addr) def test_initrd_addr(self): - config = self.get_config(self.valid_complete_v2 + - "initrd_addr = 0x80000000\n" + + config = self.get_config(self.valid_complete_v2 + + "initrd_addr = 0x80000000\n" + self.valid_end) config.validate() self.assertEqual("0x80000000", config.initrd_addr) - config = self.get_config(self.valid_complete_v2 + - "initrd_addr = 0x8aBcdEFf\n" + + config = self.get_config(self.valid_complete_v2 + + "initrd_addr = 0x8aBcdEFf\n" + self.valid_end) config.validate() self.assertEqual("0x8aBcdEFf", config.initrd_addr) def test_load_addr(self): - config = self.get_config(self.valid_complete_v2 + - "load_addr = 0x80000000\n" + + config = self.get_config(self.valid_complete_v2 + + "load_addr = 0x80000000\n" + self.valid_end) config.validate() self.assertEqual("0x80000000", config.load_addr) - config = self.get_config(self.valid_complete_v2 + - "load_addr = 0x8aBcdEFf\n" + + config = self.get_config(self.valid_complete_v2 + + "load_addr = 0x8aBcdEFf\n" + self.valid_end) config.validate() self.assertEqual("0x8aBcdEFf", config.load_addr) def test_dtb_addr(self): - config = self.get_config(self.valid_complete_v2 + - "dtb_addr = 0x80000000\n" + + config = self.get_config(self.valid_complete_v2 + + "dtb_addr = 0x80000000\n" + self.valid_end) config.validate() self.assertEqual("0x80000000", config.dtb_addr) - config = self.get_config(self.valid_complete_v2 + - "dtb_addr = 0x8aBcdEFf\n" + + config = self.get_config(self.valid_complete_v2 + + "dtb_addr = 0x8aBcdEFf\n" + self.valid_end) config.validate() self.assertEqual("0x8aBcdEFf", config.dtb_addr) === modified file 'linaro_image_tools/hwpack/tests/test_hardwarepack.py' --- linaro_image_tools/hwpack/tests/test_hardwarepack.py 2012-06-07 12:59:21 +0000 +++ linaro_image_tools/hwpack/tests/test_hardwarepack.py 2012-06-13 14:53:32 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, @@ -240,7 +240,8 @@ def test_str_with_dtb_file(self): metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2()) - metadata.add_v2_config(dtb_file='boot/dt-3.0.0-1002-linaro-omap/omap4-panda.dtb') + metadata.add_v2_config( + dtb_file='boot/dt-3.0.0-1002-linaro-omap/omap4-panda.dtb') self.assertEqual( "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "DTB_FILE=boot/dt-3.0.0-1002-linaro-omap/omap4-panda.dtb\n", @@ -258,16 +259,21 @@ def test_str_with_extra_boot_options(self): metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2()) - metadata.add_v2_config(extra_boot_options='earlyprintk fixrtc nocompcache vram=48M omapfb.vram=0:24M mem=456M@0x80000000 mem=512M@0xA0000000') + metadata.add_v2_config( + extra_boot_options=( + 'earlyprintk fixrtc nocompcache vram=48M omapfb.vram=0:24M ' + 'mem=456M@0x80000000 mem=512M@0xA0000000')) self.assertEqual( "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" - "EXTRA_BOOT_OPTIONS=earlyprintk fixrtc nocompcache vram=48M omapfb.vram=0:24M mem=456M@0x80000000 mem=512M@0xA0000000\n", + "EXTRA_BOOT_OPTIONS=earlyprintk fixrtc nocompcache vram=48M " + "omapfb.vram=0:24M mem=456M@0x80000000 mem=512M@0xA0000000\n", str(metadata)) def test_str_with_extra_serial_options(self): metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2()) - metadata.add_v2_config(extra_serial_opts='console=tty0 console=ttyO2,115200n8') + metadata.add_v2_config( + extra_serial_opts='console=tty0 console=ttyO2,115200n8') self.assertEqual( "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "EXTRA_SERIAL_OPTIONS=console=tty0 console=ttyO2,115200n8\n", === modified file 'linaro_image_tools/hwpack/tests/test_packages.py' --- linaro_image_tools/hwpack/tests/test_packages.py 2012-06-07 13:14:28 +0000 +++ linaro_image_tools/hwpack/tests/test_packages.py 2012-06-13 14:53:32 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, @@ -779,7 +779,8 @@ for relationship, value in relationships.items(): dummy_relationships[relationship.lower().replace('-', '_')] = value target_package = DummyFetchedPackage( - "foo", "1.0", content=open(deb_file_path).read(), **dummy_relationships) + "foo", "1.0", content=open(deb_file_path).read(), + **dummy_relationships) created_package = FetchedPackage.from_deb(deb_file_path) self.assertThat(created_package, MatchesPackage(target_package)) === modified file 'linaro_image_tools/hwpack/tests/test_script.py' --- linaro_image_tools/hwpack/tests/test_script.py 2012-06-07 13:22:47 +0000 +++ linaro_image_tools/hwpack/tests/test_script.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/hwpack/tests/test_tarfile_matchers.py' --- linaro_image_tools/hwpack/tests/test_tarfile_matchers.py 2011-03-23 22:25:10 +0000 +++ linaro_image_tools/hwpack/tests/test_tarfile_matchers.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/hwpack/tests/test_testing.py' --- linaro_image_tools/hwpack/tests/test_testing.py 2012-06-07 13:08:49 +0000 +++ linaro_image_tools/hwpack/tests/test_testing.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/media_create/__init__.py' --- linaro_image_tools/media_create/__init__.py 2012-06-07 13:22:47 +0000 +++ linaro_image_tools/media_create/__init__.py 2012-06-13 14:43:59 +0000 @@ -3,7 +3,7 @@ # Author: Guilherme Salgado # # This file is part of Linaro Image Tools. -# +# # Linaro Image Tools is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -23,7 +23,8 @@ from linaro_image_tools import cmd_runner from linaro_image_tools.media_create.boards import board_configs -from linaro_image_tools.media_create.android_boards import android_board_configs +from linaro_image_tools.media_create.android_boards import ( + android_board_configs) from linaro_image_tools.__version__ import __version__ @@ -158,7 +159,8 @@ parser.add_argument( '--nocheck-mmc', dest='nocheck_mmc', action='store_true', - help='Assume yes to the question "Are you 100%% sure, on selecting [mmc]"') + help=('Assume yes to the question "Are you 100%% sure, ' + 'on selecting [mmc]"')) add_common_options(parser) return parser === modified file 'linaro_image_tools/media_create/android_boards.py' --- linaro_image_tools/media_create/android_boards.py 2012-05-16 20:27:29 +0000 +++ linaro_image_tools/media_create/android_boards.py 2012-06-13 14:43:59 +0000 @@ -117,11 +117,16 @@ else: partition_type = '0x0E' - BOOT_MIN_SIZE_S = align_up(128 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE - SYSTEM_MIN_SIZE_S = align_up(512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE - CACHE_MIN_SIZE_S = align_up(256 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE - USERDATA_MIN_SIZE_S = align_up(512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE - SDCARD_MIN_SIZE_S = align_up(512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE + BOOT_MIN_SIZE_S = align_up( + 128 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE + SYSTEM_MIN_SIZE_S = align_up( + 512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE + CACHE_MIN_SIZE_S = align_up( + 256 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE + USERDATA_MIN_SIZE_S = align_up( + 512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE + SDCARD_MIN_SIZE_S = align_up( + 512 * 1024 * 1024, SECTOR_SIZE) / SECTOR_SIZE # align on sector 63 for compatibility with broken versions of x-loader # unless align_boot_part is set @@ -196,7 +201,8 @@ boot_script = 'boot.scr' initrd_addr = '0x05000000' extra_boot_args_options = ( - 'earlyprintk mem=128M@0 mali.mali_mem=64M@128M hwmem=168M@192M mem=22M@360M mem_issw=1M@383M mem=640M@384M vmalloc=300M') + 'earlyprintk mem=128M@0 mali.mali_mem=64M@128M hwmem=168M@192M ' + 'mem=22M@360M mem_issw=1M@383M mem=640M@384M vmalloc=300M') _extra_serial_opts = 'console=ttyAMA2,115200n8' android_specific_args = 'init=/init androidboot.console=ttyAMA2' dtb_name = None @@ -206,7 +212,8 @@ boot_script = 'boot.scr' initrd_addr = '0x05000000' extra_boot_args_options = ( - 'earlyprintk mem=128M@0 mali.mali_mem=64M@128M hwmem=168M@192M mem=22M@360M mem_issw=1M@383M mem=640M@384M vmalloc=300M') + 'earlyprintk mem=128M@0 mali.mali_mem=64M@128M hwmem=168M@192M ' + 'mem=22M@360M mem_issw=1M@383M mem=640M@384M vmalloc=300M') _extra_serial_opts = 'console=ttyAMA2,115200n8' android_specific_args = 'init=/init androidboot.console=ttyAMA2' mmc_option = '0:2' @@ -248,7 +255,7 @@ media, boot_dir) @classmethod - def snowball_config(cls, chroot_dir): + def snowball_config(cls, chroot_dir): # The user is expected to have unpacked the startupfiles to this subdir # of their working dir. return os.path.join('.', 'startupfiles') @@ -283,7 +290,9 @@ @classmethod def install_boot_loader(cls, boot_partition, boot_device_or_file): - install_mx5_boot_loader(os.path.join(boot_device_or_file, "u-boot.imx"), boot_partition, cls.LOADER_MIN_SIZE_S) + install_mx5_boot_loader( + os.path.join(boot_device_or_file, "u-boot.imx"), + boot_partition, cls.LOADER_MIN_SIZE_S) class AndroidMx6QSabreliteConfig(AndroidMx53LoCoConfig): === modified file 'linaro_image_tools/media_create/boards.py' --- linaro_image_tools/media_create/boards.py 2012-06-07 13:22:47 +0000 +++ linaro_image_tools/media_create/boards.py 2012-06-13 14:41:42 +0000 @@ -254,27 +254,28 @@ # Samsung v310 implementation notes and terminology # # * BL0, BL1 etc. are the various bootloaders in order of execution - # * BL0 is the first stage bootloader, located in ROM; it loads a 32s long BL1 - # from MMC offset +1s and runs it - # * BL1 is the secondary program loader (SPL), a small (< 14k) version of - # U-Boot with a checksum; it inits DRAM and loads a 1024s long BL2 to DRAM - # from MMC offset +65s - # * BL2 is U-Boot; it loads its 32s (16 KiB) long environment from MMC offset - # +33s which tells it to load a boot.scr from the first FAT partition of the - # MMC + # * BL0 is the first stage bootloader, located in ROM; it loads a 32s + # long BL1 from MMC offset +1s and runs it + # * BL1 is the secondary program loader (SPL), a small (< 14k) version + # of U-Boot with a checksum; it inits DRAM and loads a 1024s long BL2 + # to DRAM from MMC offset +65s + # * BL2 is U-Boot; it loads its 32s (16 KiB) long environment from MMC + # offset +33s which tells it to load a boot.scr from the first FAT + # partition of the MMC # # Layout: # +0s: part table / MBR, 1s long # +1s: BL1/SPL, 32s long # +33s: U-Boot environment, 32s long # +65s: U-Boot, 1024s long - # >= +1089s: FAT partition with boot script (boot.scr), kernel (uImage) and - # initrd (uInitrd) + # >= +1089s: FAT partition with boot script (boot.scr), kernel (uImage) + # and initrd (uInitrd) SAMSUNG_V310_BL1_START = 1 SAMSUNG_V310_BL1_LEN = 32 SAMSUNG_V310_ENV_START = SAMSUNG_V310_BL1_START + SAMSUNG_V310_BL1_LEN SAMSUNG_V310_ENV_LEN = 32 - assert SAMSUNG_V310_ENV_START == 33, "BL1 expects u-boot environment at +33s" + assert SAMSUNG_V310_ENV_START == 33, ( + "BL1 expects u-boot environment at +33s") assert SAMSUNG_V310_ENV_LEN * SECTOR_SIZE == 16 * 1024, ( "BL1 expects u-boot environment to be 16 KiB") SAMSUNG_V310_BL2_START = SAMSUNG_V310_ENV_START + SAMSUNG_V310_ENV_LEN @@ -344,13 +345,14 @@ cls.extra_boot_args_options = cls.get_metadata_field( 'extra_boot_options') cls.boot_script = cls.get_metadata_field('boot_script') - cls.extra_serial_opts = cls.get_metadata_field('extra_serial_options') + cls.extra_serial_opts = cls.get_metadata_field( + 'extra_serial_options') cls.snowball_startup_files_config = cls.get_metadata_field( 'snowball_startup_files_config') cls.partition_layout = cls.get_metadata_field('partition_layout') - if cls.partition_layout in ['bootfs_rootfs', 'reserved_bootfs_rootfs', - None]: + if cls.partition_layout in [ + 'bootfs_rootfs', 'reserved_bootfs_rootfs', None]: cls.fat_size = 32 elif cls.partition_layout == 'bootfs16_rootfs': cls.fat_size = 16 @@ -373,8 +375,9 @@ SECTOR_SIZE) / SECTOR_SIZE loader_min_size = cls.get_metadata_field('loader_min_size') if loader_min_size is not None: - cls.LOADER_MIN_SIZE_S = align_up(int(loader_min_size) * 1024 ** 2, - SECTOR_SIZE) / SECTOR_SIZE + cls.LOADER_MIN_SIZE_S = ( + align_up(int(loader_min_size) * 1024 ** 2, + SECTOR_SIZE) / SECTOR_SIZE) uboot_in_boot_part = cls.get_metadata_field('u_boot_in_boot_part') if uboot_in_boot_part is None: @@ -455,8 +458,8 @@ :param should_align_boot_part: Whether to align the boot partition too. - This default implementation returns a boot vfat partition of type FAT16 - or FAT32, followed by a root partition. + This default implementation returns a boot vfat partition of type + FAT16 or FAT32, followed by a root partition. XXX: This default implementation and all overrides are left for V1 compatibility only. They should be removed as part of the work to @@ -561,7 +564,8 @@ return cls.get_reserved_sfdisk_cmd(should_align_boot_part) else: assert (cls.hwpack_format == HardwarepackHandler.FORMAT_1), ( - "Hwpack format is not 1.0 but partition_layout is unspecified.") + "Hwpack format is not 1.0 but " + "partition_layout is unspecified.") return cls.get_v1_sfdisk_cmd(should_align_boot_part) @classmethod @@ -575,16 +579,18 @@ mmc_option=cls.mmc_option, kernel_addr=cls.kernel_addr, initrd_addr=cls.initrd_addr, dtb_addr=cls.dtb_addr) boot_script = ( - "%(fatload_command)s mmc %(mmc_option)s %(kernel_addr)s %(uimage_path)suImage; " - "%(fatload_command)s mmc %(mmc_option)s %(initrd_addr)s %(uimage_path)suInitrd; " - % replacements) + ("%(fatload_command)s mmc %(mmc_option)s %(kernel_addr)s " + + "%(uimage_path)suImage; ") + + ("%(fatload_command)s mmc %(mmc_option)s %(initrd_addr)s " + + "%(uimage_path)suInitrd; ")) % replacements if d_img_data is not None: assert cls.dtb_addr is not None, ( "Need a dtb_addr when passing d_img_data") boot_script += ( - "%(fatload_command)s mmc %(mmc_option)s %(dtb_addr)s board.dtb; " + ("%(fatload_command)s mmc %(mmc_option)s %(dtb_addr)s " + + "board.dtb; ") + "bootm %(kernel_addr)s %(initrd_addr)s %(dtb_addr)s" - % replacements) + ) % replacements else: boot_script += ( "bootm %(kernel_addr)s %(initrd_addr)s" % replacements) @@ -649,7 +655,8 @@ @classmethod def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, - chroot_dir, rootfs_uuid, boot_dir, boot_device_or_file): + chroot_dir, rootfs_uuid, boot_dir, + boot_device_or_file): if cls.hwpack_format == HardwarepackHandler.FORMAT_1: parts_dir = uboot_parts_dir else: @@ -731,11 +738,13 @@ if cls.env_dd: # Do we need to zero out the env before flashing it? - _dd("/dev/zero", boot_device_or_file, count=cls.SAMSUNG_V310_ENV_LEN, + _dd("/dev/zero", boot_device_or_file, + count=cls.SAMSUNG_V310_ENV_LEN, seek=cls.SAMSUNG_V310_ENV_START) env_size = cls.SAMSUNG_V310_ENV_LEN * SECTOR_SIZE env_file = make_flashable_env(boot_env, env_size) - cls._dd_file(env_file, boot_device_or_file, cls.SAMSUNG_V310_ENV_START) + cls._dd_file(env_file, boot_device_or_file, + cls.SAMSUNG_V310_ENV_START) @classmethod def _make_boot_files(cls, boot_env, chroot_dir, boot_dir, @@ -763,12 +772,12 @@ # if cls.uboot_flavor is not None: default = os.path.join( - chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor, - 'u-boot.img') + chroot_dir, 'usr', 'lib', 'u-boot', + cls.uboot_flavor, 'u-boot.img') if not os.path.exists(default): default = os.path.join( - chroot_dir, 'usr', 'lib', 'u-boot', cls.uboot_flavor, - 'u-boot.bin') + chroot_dir, 'usr', 'lib', 'u-boot', + cls.uboot_flavor, 'u-boot.bin') else: default = None # @@ -840,8 +849,8 @@ def snowball_config(cls, chroot_dir): # Override in subclasses where applicable raise NotImplementedError( - "snowball_config() must only be called on BoardConfigs that use the " - "Snowball startupfiles.") + "snowball_config() must only be called on BoardConfigs that " + "use the Snowball startupfiles.") class OmapConfig(BoardConfig): @@ -895,7 +904,8 @@ @classmethod def make_boot_files(cls, uboot_parts_dir, is_live, is_lowmem, consoles, - chroot_dir, rootfs_uuid, boot_dir, boot_device_or_file): + chroot_dir, rootfs_uuid, boot_dir, + boot_device_or_file): # XXX: This is also part of our temporary hack to fix bug 697824; we # need to call set_appropriate_serial_tty() before doing anything that # may use cls.serial_tty. @@ -1061,10 +1071,11 @@ The Snowball partitioning scheme depends on whether the target is a raw image or an SD card. Both targets have the normal FAT 32 boot partition and EXT? root partition. - The raw image prepends these two partitions with a raw loader partition, - containing HW-dependent boot stages up to and including u-boot. - This is done since the boot rom always boots off the internal memory; - there simply is no point to having a loader partition on SD card. + The raw image prepends these two partitions with a raw loader + partition, containing HW-dependent boot stages up to and including + u-boot. This is done since the boot rom always boots off the internal + memory; there simply is no point to having a loader partition + on SD card. """ # boot ROM expects bootloader at 0x20000, which is sector 0x100 # with the usual SECTOR_SIZE of 0x200. @@ -1113,7 +1124,7 @@ cls.snowball_startup_files_config)) @classmethod - def snowball_config(cls, chroot_dir): + def snowball_config(cls, chroot_dir): # We will find the startupfiles in the target boot partition. return os.path.join(chroot_dir, 'boot') @@ -1158,20 +1169,21 @@ def create_toc(cls, f, files): ''' Writes a table of contents of the boot binaries. Boot rom searches this table to find the binaries.''' + # Format string means: < little endian, + # I; unsigned int; offset, + # I; unsigned int; size, + # I; unsigned int; flags, + # i; int; align, + # i; int; load_address, + # 12s; string of char; name + # http://igloocommunity.org/support/index.php/ConfigPartitionOverview + toc_format = ' # # This file is part of Linaro Image Tools. -# +# # Linaro Image Tools is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or === modified file 'linaro_image_tools/media_create/chroot_utils.py' --- linaro_image_tools/media_create/chroot_utils.py 2012-06-07 13:12:42 +0000 +++ linaro_image_tools/media_create/chroot_utils.py 2012-06-13 14:11:28 +0000 @@ -3,7 +3,7 @@ # Author: Guilherme Salgado # # This file is part of Linaro Image Tools. -# +# # Linaro Image Tools is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -45,7 +45,8 @@ def install_hwpacks( - chroot_dir, tmp_dir, tools_dir, hwpack_force_yes, verified_files, *hwpack_files): + chroot_dir, tmp_dir, tools_dir, hwpack_force_yes, verified_files, + *hwpack_files): """Install the given hwpacks onto the given chroot.""" prepare_chroot(chroot_dir, tmp_dir) @@ -78,7 +79,8 @@ hwpack_verified = False if os.path.basename(hwpack_file) in verified_files: hwpack_verified = True - install_hwpack(chroot_dir, hwpack_file, hwpack_force_yes or hwpack_verified) + install_hwpack(chroot_dir, hwpack_file, + hwpack_force_yes or hwpack_verified) finally: run_local_atexit_funcs() === modified file 'linaro_image_tools/media_create/rootfs.py' --- linaro_image_tools/media_create/rootfs.py 2012-06-07 12:59:21 +0000 +++ linaro_image_tools/media_create/rootfs.py 2012-06-13 14:11:28 +0000 @@ -3,7 +3,7 @@ # Author: Guilherme Salgado # # This file is part of Linaro Image Tools. -# +# # Linaro Image Tools is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -110,12 +110,14 @@ config = '' for interface in interfaces: if interface not in config: - config += "auto %(if)s\niface %(if)s inet dhcp\n" % ({'if': interface}) + config += "auto %(if)s\niface %(if)s inet dhcp\n" % ( + {'if': interface}) if config != '': write_data_to_protected_file(if_path, config) -def create_flash_kernel_config(root_disk, mmc_device_id, boot_partition_number): +def create_flash_kernel_config(root_disk, mmc_device_id, + boot_partition_number): """Create a flash-kernel.conf file under root_disk/etc. Uses the given partition number to figure out the boot partition. === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' --- linaro_image_tools/media_create/tests/test_media_create.py 2012-06-12 14:08:45 +0000 +++ linaro_image_tools/media_create/tests/test_media_create.py 2012-06-13 14:11:28 +0000 @@ -494,9 +494,8 @@ class config(BoardConfig): pass - self.assertRaises(AssertionError, - config.set_metadata, - 'ahwpack.tar.gz') + self.assertRaises( + AssertionError, config.set_metadata, 'ahwpack.tar.gz') class TestGetMLOFile(TestCaseWithFixtures): @@ -771,11 +770,8 @@ uboot_file = os.path.join(uboot_dir, 'u-boot.bin') uboot_relative_file = uboot_file.replace(self.tempdir, '') with open(cfg_file, 'w') as f: - f.write('%s %s %i %#x %s\n' % ('NORMAL', - uboot_relative_file, - 0, - 0xBA0000, - '9')) + f.write('%s %s %i %#x %s\n' % ( + 'NORMAL', uboot_relative_file, 0, 0xBA0000, '9')) with open(uboot_file, 'w') as f: file_info = boards.SnowballEmmcConfig.get_file_info( self.tempdir, self.temp_bootdir_path) @@ -788,10 +784,9 @@ with open(cfg_file, 'w') as f: f.write('%s %s %i %#x %s\n' % ('NORMAL', 'u-boot.bin', 0, 0xBA0000, '9')) - self.assertRaises(AssertionError, - boards.SnowballEmmcConfig.get_file_info, - self.tempdir, - self.temp_bootdir_path) + self.assertRaises( + AssertionError, boards.SnowballEmmcConfig.get_file_info, + self.tempdir, self.temp_bootdir_path) def test_file_name_size(self): ''' Test using a to large toc file ''' @@ -970,8 +965,8 @@ super(TestBootSteps, self).setUp() self.funcs_calls = [] self.mock_all_boards_funcs() - linaro_image_tools.media_create.boards.BoardConfig.hwpack_format = \ - '1.0' + boards = linaro_image_tools.media_create.boards + boards.BoardConfig.hwpack_format = '1.0' def mock_all_boards_funcs(self): """Mock functions of boards module with a call tracer.""" @@ -1249,19 +1244,19 @@ expected_commands = ['sudo -E cp boot/u-boot.bin ./startupfiles'] self.useFixture(MockSomethingFixture( - linaro_image_tools.media_create.android_boards.AndroidSnowballEmmcConfig, + android_boards.AndroidSnowballEmmcConfig, 'get_file_info', mock_func_creator('get_file_info'))) self.useFixture(MockSomethingFixture( - linaro_image_tools.media_create.android_boards.AndroidSnowballEmmcConfig, + android_boards.AndroidSnowballEmmcConfig, 'create_toc', mock_func_creator('create_toc'))) self.useFixture(MockSomethingFixture( - linaro_image_tools.media_create.android_boards.AndroidSnowballEmmcConfig, + android_boards.AndroidSnowballEmmcConfig, 'install_snowball_boot_loader', mock_func_creator('install_snowball_boot_loader'))) self.useFixture(MockSomethingFixture( - linaro_image_tools.media_create.android_boards.AndroidSnowballEmmcConfig, + android_boards.AndroidSnowballEmmcConfig, 'delete_file', mock_func_creator('delete_file'))) self.populate_raw_partition(android_boards.AndroidSnowballEmmcConfig) @@ -1278,7 +1273,8 @@ self.useFixture(fixture) expected_commands = [ 'sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 seek=33', - 'sudo -E dd if=boot/u-boot-mmc-spl.bin of= bs=512 conv=notrunc seek=1', + ('sudo -E dd if=boot/u-boot-mmc-spl.bin of= ' + 'bs=512 conv=notrunc seek=1'), 'sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc seek=65'] self.useFixture(MockSomethingFixture(os.path, 'getsize', lambda file: 1)) @@ -1299,7 +1295,8 @@ self.useFixture(fixture) expected_commands = [ 'sudo -E dd if=/dev/zero of= bs=512 conv=notrunc count=32 seek=33', - 'sudo -E dd if=boot/u-boot-mmc-spl.bin of= bs=512 conv=notrunc seek=1', + ('sudo -E dd if=boot/u-boot-mmc-spl.bin of= bs=512 ' + 'conv=notrunc seek=1'), 'sudo -E dd if=boot/u-boot.bin of= bs=512 conv=notrunc seek=65'] self.useFixture(MockSomethingFixture(os.path, 'getsize', lambda file: 1)) @@ -2014,9 +2011,11 @@ "%s/%s/uboot" % ("chroot_dir", uboot_flavor), "boot_disk") expected = [ '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc ' - 'seek=%d' % (sudo_args, uboot_flavor, boards.SMDKV310Config.SAMSUNG_V310_BL1_START), + 'seek=%d' % (sudo_args, uboot_flavor, + boards.SMDKV310Config.SAMSUNG_V310_BL1_START), '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc ' - 'seek=%d' % (sudo_args, uboot_flavor, boards.SMDKV310Config.SAMSUNG_V310_BL2_START)] + 'seek=%d' % (sudo_args, uboot_flavor, + boards.SMDKV310Config.SAMSUNG_V310_BL2_START)] self.assertEqual(expected, fixture.mock.commands_executed) def test_install_origen_u_boot(self): @@ -2041,9 +2040,11 @@ boards.OrigenConfig._get_samsung_uboot("chroot_dir"), "boot_disk") expected = [ '%s dd if=chroot_dir/%s/SPL of=boot_disk bs=512 conv=notrunc ' - 'seek=%d' % (sudo_args, uboot_flavor, boards.OrigenConfig.SAMSUNG_V310_BL1_START), + 'seek=%d' % (sudo_args, uboot_flavor, + boards.OrigenConfig.SAMSUNG_V310_BL1_START), '%s dd if=chroot_dir/%s/uboot of=boot_disk bs=512 conv=notrunc ' - 'seek=%d' % (sudo_args, uboot_flavor, boards.OrigenConfig.SAMSUNG_V310_BL2_START)] + 'seek=%d' % (sudo_args, uboot_flavor, + boards.OrigenConfig.SAMSUNG_V310_BL2_START)] self.assertEqual(expected, fixture.mock.commands_executed) def test_get_plain_boot_script_contents(self): @@ -2171,7 +2172,8 @@ self.assertRaises(ValueError, config._get_kflavor_files, tempdir) def test_get_file_matching_no_files_found(self): - self.assertEqual(None, _get_file_matching('/foo/bar/baz/*non-existent')) + self.assertEqual( + None, _get_file_matching('/foo/bar/baz/*non-existent')) def test_run_mkimage(self): # Create a fake boot script. @@ -2200,7 +2202,8 @@ # Stub time.sleep() as create_partitions() use that. self.orig_sleep = time.sleep time.sleep = lambda s: None - linaro_image_tools.media_create.boards.BoardConfig.hwpack_format = '1.0' + boards = linaro_image_tools.media_create.boards + boards.BoardConfig.hwpack_format = '1.0' def tearDown(self): super(TestCreatePartitions, self).tearDown() @@ -2358,7 +2361,8 @@ self.assertEqual(0, wait_partition_to_settle(media)) - def test_wait_partitions_to_settle_raises_SubcommandNonZeroReturnValue(self): + def test_wait_partitions_to_settle_raises_SubcommandNonZeroReturnValue( + self): def mock_run(args, as_root=False, chroot=None, stdin=None, stdout=None, stderr=None, cwd=None): raise cmd_runner.SubcommandNonZeroReturnValue(args, 1) @@ -2461,16 +2465,19 @@ self.assertEqual(12 * 2 ** 30, get_partition_size_in_bytes('12G')) def test_convert_size_float_no_suffix(self): - self.assertEqual(3 * 2 ** 20, get_partition_size_in_bytes('2348576.91')) + self.assertEqual(3 * 2 ** 20, + get_partition_size_in_bytes('2348576.91')) def test_convert_size_float_in_kbytes_to_bytes(self): self.assertEqual(3 * 2 ** 20, get_partition_size_in_bytes('2345.8K')) def test_convert_size_float_in_mbytes_to_bytes_double(self): - self.assertEqual(2 * 2 ** 20, get_partition_size_in_bytes('1.0000001M')) + self.assertEqual(2 * 2 ** 20, + get_partition_size_in_bytes('1.0000001M')) def test_convert_size_float_in_mbytes_to_bytes(self): - self.assertEqual(877 * 2 ** 20, get_partition_size_in_bytes('876.123M')) + self.assertEqual(877 * 2 ** 20, + get_partition_size_in_bytes('876.123M')) def test_convert_size_float_in_gbytes_to_bytes(self): self.assertEqual(1946 * 2 ** 20, get_partition_size_in_bytes('1.9G')) @@ -2497,8 +2504,9 @@ device_info = calculate_android_partition_size_and_offset(tmpfile) # We use map(None, ...) since it would catch if the lists are not of # equal length and zip() would not in all cases. - for device_pair, expected_pair in map(None, device_info, - self.android_snowball_offsets_and_sizes): + snowball_info = map(None, device_info, + self.android_snowball_offsets_and_sizes) + for device_pair, expected_pair in snowball_info: self.assertEqual(device_pair, expected_pair) def test_partition_numbering(self): @@ -2538,7 +2546,8 @@ def _create_qemu_img_with_partitions(self, sfdisk_commands, tempfile_size): tmpfile = self.createTempFileAsFixture() proc = cmd_runner.run( - ['dd', 'of=%s' % tmpfile, 'bs=1', 'seek=%s' % tempfile_size, 'count=0'], + ['dd', 'of=%s' % tmpfile, 'bs=1', 'seek=%s' % tempfile_size, + 'count=0'], stderr=open('/dev/null', 'w')) proc.communicate() stdout, stderr = run_sfdisk_commands( === modified file 'linaro_image_tools/media_create/unpack_binary_tarball.py' --- linaro_image_tools/media_create/unpack_binary_tarball.py 2012-06-07 13:12:42 +0000 +++ linaro_image_tools/media_create/unpack_binary_tarball.py 2012-06-13 14:11:28 +0000 @@ -3,7 +3,7 @@ # Author: Guilherme Salgado # # This file is part of Linaro Image Tools. -# +# # Linaro Image Tools is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or === modified file 'linaro_image_tools/testing.py' --- linaro_image_tools/testing.py 2012-06-07 13:22:47 +0000 +++ linaro_image_tools/testing.py 2012-06-13 14:26:02 +0000 @@ -8,12 +8,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # Linaro Image Tools is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with Linaro Image Tools; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, === modified file 'linaro_image_tools/tests/fixtures.py' --- linaro_image_tools/tests/fixtures.py 2012-06-11 12:49:40 +0000 +++ linaro_image_tools/tests/fixtures.py 2012-06-13 14:55:34 +0000 @@ -115,7 +115,8 @@ def __init__(self, output_string='', assert_child_finished=True): super(MockCmdRunnerPopenFixture, self).__init__( - cmd_runner, 'Popen', MockCmdRunnerPopen(output_string, assert_child_finished)) + cmd_runner, 'Popen', + MockCmdRunnerPopen(output_string, assert_child_finished)) def tearDown(self): super(MockCmdRunnerPopenFixture, self).tearDown() === modified file 'linaro_image_tools/tests/test_pep8.py' --- linaro_image_tools/tests/test_pep8.py 2012-06-08 07:59:18 +0000 +++ linaro_image_tools/tests/test_pep8.py 2012-06-13 16:10:46 +0000 @@ -23,15 +23,12 @@ class TestPep8(TestCase): def test_pep8(self): - # too many of these, should preferably be fixed while updating - # surrounding code: - # E202 whitespace before ')' or ']' - # E501 line too long - # W291 trailing whitespace - # NB: E202 is actually only reported with the natty version of pep8 and - # can be re-enabled once we drop support for natty - ignore = ['E202', 'E501', 'W291'] - # ignore return code + # Errors we have to ignore for now: + # * E202 whitespace before ')' or ']' + # E202 is actually only reported with the natty version of pep8 and + # can be re-enabled once we drop support for natty. + ignore = ['E202'] + # Ignore return code. proc = subprocess.Popen(['pep8', '--repeat', '--ignore=%s' % ','.join(ignore), === modified file 'linaro_image_tools/tests/test_utils.py' --- linaro_image_tools/tests/test_utils.py 2012-06-13 08:19:55 +0000 +++ linaro_image_tools/tests/test_utils.py 2012-06-13 14:55:34 +0000 @@ -266,7 +266,8 @@ self.useFixture(MockSomethingFixture(sys, 'stdin', StringIO('Y'))) - fixture = self.useFixture(MockCmdRunnerPopenFixture(self.output_string)) + fixture = self.useFixture( + MockCmdRunnerPopenFixture(self.output_string)) install_package_providing('mkfs.vfat') self.assertEqual( ['apt-get -s install dosfstools', === modified file 'linaro_image_tools/utils.py' --- linaro_image_tools/utils.py 2012-06-13 08:19:55 +0000 +++ linaro_image_tools/utils.py 2012-06-13 14:55:34 +0000 @@ -198,8 +198,8 @@ "Unable to find any package to be installed.") try: - print ("In order to use the '%s' command, the following package/s have " - "to be installed: %s" % (command, " ".join(to_install))) + print ("In order to use the '%s' command, the following package/s " + "have to be installed: %s" % (command, " ".join(to_install))) resp = raw_input("Install? (Y/n) ") if resp.lower() != 'y': print "Package installation is necessary to continue. Exiting."