diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 578: Added dtb_files support to hwpack config converter.

Message ID 20121017161110.6223.97207.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Milo Casagrande Oct. 17, 2012, 4:11 p.m. UTC
Merge authors:
  Milo Casagrande (milo)
Related merge proposals:
  https://code.launchpad.net/~milo/linaro-image-tools/hwpack-converter-dtb-files/+merge/130137
  proposed by: Milo Casagrande (milo)
  review: Approve - James Tunnicliffe (dooferlad)
------------------------------------------------------------
revno: 578 [merge]
committer: Milo Casagrande <milo@ubuntu.com>
branch nick: trunk
timestamp: Wed 2012-10-17 18:10:50 +0200
message:
  Added dtb_files support to hwpack config converter.
modified:
  linaro_image_tools/hwpack/hwpack_convert.py
  linaro_image_tools/hwpack/tests/test_hwpack_converter.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
diff mbox

Patch

=== modified file 'linaro_image_tools/hwpack/hwpack_convert.py'
--- linaro_image_tools/hwpack/hwpack_convert.py	2012-07-20 08:19:11 +0000
+++ linaro_image_tools/hwpack/hwpack_convert.py	2012-10-17 14:53:24 +0000
@@ -39,6 +39,8 @@ 
     FILE_FIELD,
     IN_BOOT_PART_FIELD,
     DD_FIELD,
+    DTB_FILE_FIELD,
+    DTB_FILES_FIELD,
     ENV_DD_FIELD,
     SPL_IN_BOOT_PART_FIELD,
     SPL_DD_FIELD,
@@ -80,6 +82,9 @@ 
 SPL_KEYS = [SPL_IN_BOOT_PART_FIELD, SPL_DD_FIELD, SPL_PACKAGE_FIELD,
             SPL_FILE_FIELD, ENV_DD_FIELD]
 
+# The default name used for renaming dtb file
+DEFAULT_DTB_NAME = 'board.dtb'
+
 logger = logging.getLogger("linaro_hwpack_converter")
 
 
@@ -125,6 +130,8 @@ 
         self.spl = {}
         # The list of packages that should be installed.
         self.assume_installed = []
+        # The dtb_files section
+        self.dtb_files = []
 
     def _parse(self):
         """Parses the config file and stores its values."""
@@ -181,6 +188,10 @@ 
                                                     self.assume_installed,
                                                     value)
                                 continue
+                            elif key == DTB_FILE_FIELD:
+                                self.dtb_files.append({DEFAULT_DTB_NAME:
+                                                       value})
+                                continue
                             elif key == INCLUDE_DEBS_OLD:
                                 key = INCLUDE_DEBS_FIELD
                             self.hwpack[key] = value
@@ -258,6 +269,9 @@ 
         if self.sources:
             sources = {SOURCES_FIELD: self.sources}
             converted += dump(sources)
+        if self.dtb_files:
+            dtb = {DTB_FILES_FIELD: self.dtb_files}
+            converted += dump(dtb)
         if self.bootloaders or self.extra_boot_options or self.spl:
             # The bootloaders section in the new YAML file is a dictionary
             # containing a dictionary which can contains also other

=== modified file 'linaro_image_tools/hwpack/tests/test_hwpack_converter.py'
--- linaro_image_tools/hwpack/tests/test_hwpack_converter.py	2012-07-20 08:19:11 +0000
+++ linaro_image_tools/hwpack/tests/test_hwpack_converter.py	2012-10-17 14:53:24 +0000
@@ -154,3 +154,15 @@ 
         converter = HwpackConverter(input_file, output_file)
         converter._parse()
         self.assertEqual(out_format, str(converter))
+
+    def test_dtb_file(self):
+        """Test the dtb_file conversion."""
+        ini_format = ("[hwpack]\nformat=2.0\ndtb_file=boot/a-*-path/file.dtb")
+        out_format = ("format: '3.0'\ndtb_files:\n- board.dtb: "
+                      "boot/a-*-path/file.dtb\n")
+        input_file = self.useFixture(CreateTempFileFixture(ini_format)).\
+                                                                get_file_name()
+        output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
+        converter = HwpackConverter(input_file, output_file)
+        converter._parse()
+        self.assertEqual(out_format, str(converter))