Merge lp:~milo/linaro-image-tools/hwpack-converter-dtb-files into lp:linaro-image-tools/11.11

Proposed by Milo Casagrande
Status: Merged
Merged at revision: 578
Proposed branch: lp:~milo/linaro-image-tools/hwpack-converter-dtb-files
Merge into: lp:linaro-image-tools/11.11
Diff against target: 72 lines (+26/-0)
2 files modified
linaro_image_tools/hwpack/hwpack_convert.py (+14/-0)
linaro_image_tools/hwpack/tests/test_hwpack_converter.py (+12/-0)
To merge this branch: bzr merge lp:~milo/linaro-image-tools/hwpack-converter-dtb-files
Reviewer Review Type Date Requested Status
James Tunnicliffe (community) Approve
Paul Sokolovsky Pending
Linaro Infrastructure Pending
Review via email: mp+130137@code.launchpad.net

Description of the change

Added support to the hwpack converter for dtb_files: if there is a dtb_file filed in an old hwpack config file, it will be converted into the new dtb_files one.

To post a comment you must log in.
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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:57:39 +0000
@@ -39,6 +39,8 @@
39 FILE_FIELD,39 FILE_FIELD,
40 IN_BOOT_PART_FIELD,40 IN_BOOT_PART_FIELD,
41 DD_FIELD,41 DD_FIELD,
42 DTB_FILE_FIELD,
43 DTB_FILES_FIELD,
42 ENV_DD_FIELD,44 ENV_DD_FIELD,
43 SPL_IN_BOOT_PART_FIELD,45 SPL_IN_BOOT_PART_FIELD,
44 SPL_DD_FIELD,46 SPL_DD_FIELD,
@@ -80,6 +82,9 @@
80SPL_KEYS = [SPL_IN_BOOT_PART_FIELD, SPL_DD_FIELD, SPL_PACKAGE_FIELD,82SPL_KEYS = [SPL_IN_BOOT_PART_FIELD, SPL_DD_FIELD, SPL_PACKAGE_FIELD,
81 SPL_FILE_FIELD, ENV_DD_FIELD]83 SPL_FILE_FIELD, ENV_DD_FIELD]
8284
85# The default name used for renaming dtb file
86DEFAULT_DTB_NAME = 'board.dtb'
87
83logger = logging.getLogger("linaro_hwpack_converter")88logger = logging.getLogger("linaro_hwpack_converter")
8489
8590
@@ -125,6 +130,8 @@
125 self.spl = {}130 self.spl = {}
126 # The list of packages that should be installed.131 # The list of packages that should be installed.
127 self.assume_installed = []132 self.assume_installed = []
133 # The dtb_files section
134 self.dtb_files = []
128135
129 def _parse(self):136 def _parse(self):
130 """Parses the config file and stores its values."""137 """Parses the config file and stores its values."""
@@ -181,6 +188,10 @@
181 self.assume_installed,188 self.assume_installed,
182 value)189 value)
183 continue190 continue
191 elif key == DTB_FILE_FIELD:
192 self.dtb_files.append({DEFAULT_DTB_NAME:
193 value})
194 continue
184 elif key == INCLUDE_DEBS_OLD:195 elif key == INCLUDE_DEBS_OLD:
185 key = INCLUDE_DEBS_FIELD196 key = INCLUDE_DEBS_FIELD
186 self.hwpack[key] = value197 self.hwpack[key] = value
@@ -258,6 +269,9 @@
258 if self.sources:269 if self.sources:
259 sources = {SOURCES_FIELD: self.sources}270 sources = {SOURCES_FIELD: self.sources}
260 converted += dump(sources)271 converted += dump(sources)
272 if self.dtb_files:
273 dtb = {DTB_FILES_FIELD: self.dtb_files}
274 converted += dump(dtb)
261 if self.bootloaders or self.extra_boot_options or self.spl:275 if self.bootloaders or self.extra_boot_options or self.spl:
262 # The bootloaders section in the new YAML file is a dictionary276 # The bootloaders section in the new YAML file is a dictionary
263 # containing a dictionary which can contains also other277 # containing a dictionary which can contains also other
264278
=== 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:57:39 +0000
@@ -154,3 +154,15 @@
154 converter = HwpackConverter(input_file, output_file)154 converter = HwpackConverter(input_file, output_file)
155 converter._parse()155 converter._parse()
156 self.assertEqual(out_format, str(converter))156 self.assertEqual(out_format, str(converter))
157
158 def test_dtb_file(self):
159 """Test the dtb_file conversion."""
160 ini_format = ("[hwpack]\nformat=2.0\ndtb_file=boot/a-*-path/file.dtb")
161 out_format = ("format: '3.0'\ndtb_files:\n- board.dtb: "
162 "boot/a-*-path/file.dtb\n")
163 input_file = self.useFixture(CreateTempFileFixture(ini_format)).\
164 get_file_name()
165 output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
166 converter = HwpackConverter(input_file, output_file)
167 converter._parse()
168 self.assertEqual(out_format, str(converter))

Subscribers

People subscribed via source and target branches