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
1=== modified file 'linaro_image_tools/hwpack/hwpack_convert.py'
2--- linaro_image_tools/hwpack/hwpack_convert.py 2012-07-20 08:19:11 +0000
3+++ linaro_image_tools/hwpack/hwpack_convert.py 2012-10-17 14:57:39 +0000
4@@ -39,6 +39,8 @@
5 FILE_FIELD,
6 IN_BOOT_PART_FIELD,
7 DD_FIELD,
8+ DTB_FILE_FIELD,
9+ DTB_FILES_FIELD,
10 ENV_DD_FIELD,
11 SPL_IN_BOOT_PART_FIELD,
12 SPL_DD_FIELD,
13@@ -80,6 +82,9 @@
14 SPL_KEYS = [SPL_IN_BOOT_PART_FIELD, SPL_DD_FIELD, SPL_PACKAGE_FIELD,
15 SPL_FILE_FIELD, ENV_DD_FIELD]
16
17+# The default name used for renaming dtb file
18+DEFAULT_DTB_NAME = 'board.dtb'
19+
20 logger = logging.getLogger("linaro_hwpack_converter")
21
22
23@@ -125,6 +130,8 @@
24 self.spl = {}
25 # The list of packages that should be installed.
26 self.assume_installed = []
27+ # The dtb_files section
28+ self.dtb_files = []
29
30 def _parse(self):
31 """Parses the config file and stores its values."""
32@@ -181,6 +188,10 @@
33 self.assume_installed,
34 value)
35 continue
36+ elif key == DTB_FILE_FIELD:
37+ self.dtb_files.append({DEFAULT_DTB_NAME:
38+ value})
39+ continue
40 elif key == INCLUDE_DEBS_OLD:
41 key = INCLUDE_DEBS_FIELD
42 self.hwpack[key] = value
43@@ -258,6 +269,9 @@
44 if self.sources:
45 sources = {SOURCES_FIELD: self.sources}
46 converted += dump(sources)
47+ if self.dtb_files:
48+ dtb = {DTB_FILES_FIELD: self.dtb_files}
49+ converted += dump(dtb)
50 if self.bootloaders or self.extra_boot_options or self.spl:
51 # The bootloaders section in the new YAML file is a dictionary
52 # containing a dictionary which can contains also other
53
54=== modified file 'linaro_image_tools/hwpack/tests/test_hwpack_converter.py'
55--- linaro_image_tools/hwpack/tests/test_hwpack_converter.py 2012-07-20 08:19:11 +0000
56+++ linaro_image_tools/hwpack/tests/test_hwpack_converter.py 2012-10-17 14:57:39 +0000
57@@ -154,3 +154,15 @@
58 converter = HwpackConverter(input_file, output_file)
59 converter._parse()
60 self.assertEqual(out_format, str(converter))
61+
62+ def test_dtb_file(self):
63+ """Test the dtb_file conversion."""
64+ ini_format = ("[hwpack]\nformat=2.0\ndtb_file=boot/a-*-path/file.dtb")
65+ out_format = ("format: '3.0'\ndtb_files:\n- board.dtb: "
66+ "boot/a-*-path/file.dtb\n")
67+ input_file = self.useFixture(CreateTempFileFixture(ini_format)).\
68+ get_file_name()
69+ output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
70+ converter = HwpackConverter(input_file, output_file)
71+ converter._parse()
72+ self.assertEqual(out_format, str(converter))

Subscribers

People subscribed via source and target branches