Merge lp:~milo/linaro-image-tools/bug1054422 into lp:linaro-image-tools/11.11

Proposed by Milo Casagrande
Status: Merged
Approved by: Данило Шеган
Approved revision: 568
Merged at revision: 565
Proposed branch: lp:~milo/linaro-image-tools/bug1054422
Merge into: lp:linaro-image-tools/11.11
Diff against target: 99 lines (+36/-6)
4 files modified
linaro_image_tools/hwpack/hardwarepack.py (+3/-3)
linaro_image_tools/hwpack/hwpack_fields.py (+1/-1)
linaro_image_tools/hwpack/tests/test_config_v3.py (+29/-0)
linaro_image_tools/utils.py (+3/-2)
To merge this branch: bzr merge lp:~milo/linaro-image-tools/bug1054422
Reviewer Review Type Date Requested Status
Данило Шеган (community) Approve
Paul Sokolovsky Pending
Linaro Infrastructure Pending
Review via email: mp+125995@code.launchpad.net

Description of the change

Changes in this MP fixes problem with bug 1054422. Added also some tests for Samsung specific fields.
There are also two minor fixes found while looking at the code.

To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

Looks good, thanks for the nice fix.

However small the other fixes are, we should generally strive to keep them in separate branches, especially for things where we plan to do a last-minute re-rollout of the tarball: it would be much better to include only relevant changes (it's not going to be obvious what's going on in the commit log if you lump these three changes together, no matter how verbose you make the commit message; it's neither going to be clear why were the other two changes critical and that they needed a .1 release :).

review: Approve
Revision history for this message
Milo Casagrande (milo) wrote :

Hi Danilo,

thanks for the review.

On Mon, Sep 24, 2012 at 9:18 PM, Данило Шеган <email address hidden> wrote:
>
> However small the other fixes are, we should generally strive to keep them in separate branches, especially for things where we plan to do a last-minute re-rollout of the tarball: it would be much better to include only relevant changes (it's not going to be obvious what's going on in the commit log if you lump these three changes together, no matter how verbose you make the commit message; it's neither going to be clear why were the other two changes critical and that they needed a .1 release :).

Yeah, I know, I was not sure to include them here.
I can merge only the two commits for the bug fix, and after the
rollout merge the remaining two with the small fixes.

--
Milo Casagrande
Infrastructure Engineer
Linaro.org <www.linaro.org> │ Open source software for ARM SoCs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro_image_tools/hwpack/hardwarepack.py'
2--- linaro_image_tools/hwpack/hardwarepack.py 2012-08-29 10:31:19 +0000
3+++ linaro_image_tools/hwpack/hardwarepack.py 2012-09-24 12:06:24 +0000
4@@ -166,14 +166,14 @@
5 self.samsung_bl2_len = samsung_bl2_len
6
7 @classmethod
8- def add_v3_config(self, boards=None, bootloaders=None):
9+ def add_v3_config(cls, boards=None, bootloaders=None):
10 """Add fields that are specific to the v3 config format.
11 These fields are not present in the earlier config files.
12
13 :param boards: The boards section of the hwpack.
14 :param bootloaders: The bootloaders section of the hwpack."""
15- self.boards = boards
16- self.bootloaders = bootloaders
17+ cls.boards = boards
18+ cls.bootloaders = bootloaders
19
20 @classmethod
21 def from_config(cls, config, version, architecture):
22
23=== modified file 'linaro_image_tools/hwpack/hwpack_fields.py'
24--- linaro_image_tools/hwpack/hwpack_fields.py 2012-08-28 06:02:43 +0000
25+++ linaro_image_tools/hwpack/hwpack_fields.py 2012-09-24 12:06:24 +0000
26@@ -129,7 +129,7 @@
27 ROOT_MIN_SIZE_FIELD: None,
28 LOADER_MIN_SIZE_FIELD: None,
29 SAMSUNG_BL1_LEN_FIELD: None,
30- SAMSUNG_BL1_LEN_FIELD: None,
31+ SAMSUNG_BL1_START_FIELD: None,
32 SAMSUNG_ENV_LEN_FIELD: None,
33 SAMSUNG_BL2_LEN_FIELD: None,
34 SNOWBALL_STARTUP_FILES_CONFIG_FIELD: None,
35
36=== modified file 'linaro_image_tools/hwpack/tests/test_config_v3.py'
37--- linaro_image_tools/hwpack/tests/test_config_v3.py 2012-08-28 17:34:16 +0000
38+++ linaro_image_tools/hwpack/tests/test_config_v3.py 2012-09-24 12:06:24 +0000
39@@ -26,6 +26,10 @@
40 from linaro_image_tools.hwpack.config import Config, HwpackConfigError
41 from linaro_image_tools.hwpack.hwpack_fields import (
42 DEFINED_PARTITION_LAYOUTS,
43+ SAMSUNG_BL1_LEN_FIELD,
44+ SAMSUNG_BL1_START_FIELD,
45+ SAMSUNG_BL2_LEN_FIELD,
46+ SAMSUNG_ENV_LEN_FIELD,
47 )
48
49
50@@ -796,3 +800,28 @@
51 self.assertValidationError("Unknown key in metadata: "
52 "'boards: snowball: foo'",
53 config._validate_keys)
54+
55+ def test_valid_samsung_bl1_len_field(self):
56+ config = self.get_config(self.valid_start_v3 +
57+ SAMSUNG_BL1_LEN_FIELD + ': 1\n')
58+ self.assertEqual(None, config._validate_keys())
59+
60+ def test_valid_samsung_bl1_start_field(self):
61+ config = self.get_config(self.valid_start_v3 +
62+ SAMSUNG_BL1_START_FIELD + ': 1\n')
63+ self.assertEqual(None, config._validate_keys())
64+
65+ def test_valid_samsung_bl2_len_field(self):
66+ config = self.get_config(self.valid_start_v3 +
67+ SAMSUNG_BL2_LEN_FIELD + ': 1\n')
68+ self.assertEqual(None, config._validate_keys())
69+
70+ def test_valid_samsung_env_len_field(self):
71+ config = self.get_config(self.valid_start_v3 +
72+ SAMSUNG_ENV_LEN_FIELD + ': 1\n')
73+ self.assertEqual(None, config._validate_keys())
74+
75+ def test_samsung_field_wrong(self):
76+ config = self.get_config(self.valid_start_v3 +
77+ 'samsung_wrong_field: 1\n')
78+ self.assertRaises(HwpackConfigError, config._validate_keys)
79
80=== modified file 'linaro_image_tools/utils.py'
81--- linaro_image_tools/utils.py 2012-07-26 19:49:43 +0000
82+++ linaro_image_tools/utils.py 2012-09-24 12:06:24 +0000
83@@ -76,13 +76,14 @@
84
85
86 def path_in_tarfile_exists(path, tar_file):
87- tarinfo = tarfile.open(tar_file, 'r:gz')
88 try:
89+ tarinfo = tarfile.open(tar_file, 'r:gz')
90 tarinfo.getmember(path)
91 return True
92 except KeyError:
93 return False
94- tarinfo.close()
95+ finally:
96+ tarinfo.close()
97
98
99 def verify_file_integrity(sig_file_list):

Subscribers

People subscribed via source and target branches