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

Proposed by Milo Casagrande
Status: Merged
Approved by: Fathi Boudra
Approved revision: 599
Merged at revision: 599
Proposed branch: lp:~milo/linaro-image-tools/regression-fix
Merge into: lp:linaro-image-tools/11.11
Diff against target: 103 lines (+27/-20)
2 files modified
linaro_image_tools/media_create/boards.py (+26/-19)
linaro_image_tools/media_create/tests/test_media_create.py (+1/-1)
To merge this branch: bzr merge lp:~milo/linaro-image-tools/regression-fix
Reviewer Review Type Date Requested Status
Fathi Boudra Approve
Review via email: mp+142460@code.launchpad.net

Description of the change

As reported on IRC this morning, we have a small regression after merging the code for Android hwpack.

This MP fixes the regression: a missing check on None strings.
It also addresses another change: the boot_args string, under some circumstance was coming out with a "None" inside, like this: "None root=/dev/mmcblk0p2 rootwait ro".

To post a comment you must log in.
Revision history for this message
Milo Casagrande (milo) wrote :

As reported on IRC this morning, we have a small regression after merging the code for Android hwpack.

This MP fixes the regression: a missing check on None strings.
It also addresses another change: the boot_args string, under some circumstance was coming out with a "None" inside, like this: "None root=/dev/mmcblk0p2 rootwait ro".

Revision history for this message
Fathi Boudra (fboudra) wrote :

ship it!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'linaro_image_tools/media_create/boards.py'
--- linaro_image_tools/media_create/boards.py 2013-01-07 12:40:41 +0000
+++ linaro_image_tools/media_create/boards.py 2013-01-09 09:29:24 +0000
@@ -212,10 +212,13 @@
212212
213 # XXX: can be removed when killing v1 hwpack.213 # XXX: can be removed when killing v1 hwpack.
214 def _get_live_serial_options(self):214 def _get_live_serial_options(self):
215 return_value = self._live_serial_options215 live_serial = self._live_serial_options
216 if self._check_placeholder_presence(return_value, r'%s'):216 if live_serial:
217 return_value = self._live_serial_options % self.serial_tty217 if isinstance(live_serial, list):
218 return return_value218 live_serial = ' '.join(live_serial)
219 if self._check_placeholder_presence(live_serial, r'%s'):
220 live_serial = live_serial % self.serial_tty
221 return live_serial
219222
220 def _set_live_serial_options(self, value):223 def _set_live_serial_options(self, value):
221 self._live_serial_options = value224 self._live_serial_options = value
@@ -225,16 +228,19 @@
225228
226 # XXX: can be removed when killing v1 hwpack.229 # XXX: can be removed when killing v1 hwpack.
227 def _get_extra_serial_options(self):230 def _get_extra_serial_options(self):
228 return_value = self._extra_serial_options231 extra_serial = self._extra_serial_options
229 if self._check_placeholder_presence(return_value, r'%s'):232 if extra_serial:
230 return_value = return_value % self.serial_tty233 if isinstance(extra_serial, list):
231 return return_value234 extra_serial = ' '.join(extra_serial)
235 if self._check_placeholder_presence(extra_serial, r'%s'):
236 extra_serial = extra_serial % self.serial_tty
237 return extra_serial
232238
233 def _set_extra_serial_options(self, value):239 def _set_extra_serial_options(self, value):
234 self._extra_serial_options = value240 self._extra_serial_options = value
235241
236 extra_serial_options = property(_get_extra_serial_options,242 extra_serial_options = property(_get_extra_serial_options,
237 _set_extra_serial_options)243 _set_extra_serial_options)
238244
239 def get_metadata_field(self, field_name):245 def get_metadata_field(self, field_name):
240 """ Return the metadata value for field_name if it can be found.246 """ Return the metadata value for field_name if it can be found.
@@ -539,9 +545,11 @@
539 In general subclasses should not have to override this.545 In general subclasses should not have to override this.
540 """546 """
541 boot_args_options = 'rootwait ro'547 boot_args_options = 'rootwait ro'
548 serial_options = ''
542 if self.extra_boot_args_options:549 if self.extra_boot_args_options:
543 boot_args_options += ' %s' % self.extra_boot_args_options550 boot_args_options += ' %s' % self.extra_boot_args_options
544 serial_options = self.extra_serial_options551 if self.extra_serial_options:
552 serial_options = self.extra_serial_options
545 for console in consoles:553 for console in consoles:
546 serial_options += ' console=%s' % console554 serial_options += ' console=%s' % console
547555
@@ -553,14 +561,13 @@
553 if is_lowmem:561 if is_lowmem:
554 lowmem_opt = 'only-ubiquity'562 lowmem_opt = 'only-ubiquity'
555563
556 replacements = dict(564 replacements = dict(serial_options=serial_options.strip(),
557 serial_options=serial_options,565 lowmem_opt=lowmem_opt,
558 lowmem_opt=lowmem_opt, boot_snippet=boot_snippet,566 boot_snippet=boot_snippet,
559 boot_args_options=boot_args_options)567 boot_args_options=boot_args_options)
560 return (568 boot_args = ("%(serial_options)s %(lowmem_opt)s %(boot_snippet)s"
561 "%(serial_options)s %(lowmem_opt)s "569 " %(boot_args_options)s" % replacements).strip()
562 "%(boot_snippet)s %(boot_args_options)s"570 return boot_args
563 % replacements)
564571
565 def _get_boot_env(self, is_live, is_lowmem, consoles, rootfs_id,572 def _get_boot_env(self, is_live, is_lowmem, consoles, rootfs_id,
566 i_img_data, d_img_data):573 i_img_data, d_img_data):
@@ -859,7 +866,7 @@
859 """Checks if the passed string contains the particular placeholder."""866 """Checks if the passed string contains the particular placeholder."""
860 # Very simple way of achieving that.867 # Very simple way of achieving that.
861 presence = False868 presence = False
862 if placeholder in string:869 if string and placeholder in string:
863 presence = True870 presence = True
864 return presence871 return presence
865872
866873
=== modified file 'linaro_image_tools/media_create/tests/test_media_create.py'
--- linaro_image_tools/media_create/tests/test_media_create.py 2012-12-27 14:58:24 +0000
+++ linaro_image_tools/media_create/tests/test_media_create.py 2013-01-09 09:29:24 +0000
@@ -2123,7 +2123,7 @@
2123 is_live=False, is_lowmem=False, consoles=['ttyXXX'],2123 is_live=False, is_lowmem=False, consoles=['ttyXXX'],
2124 rootfs_id="UUID=deadbeef", i_img_data=None, d_img_data=None)2124 rootfs_id="UUID=deadbeef", i_img_data=None, d_img_data=None)
2125 expected = (2125 expected = (
2126 ' console=ttyXXX root=UUID=deadbeef rootwait ro %s' % boot_args)2126 'console=ttyXXX root=UUID=deadbeef rootwait ro %s' % boot_args)
2127 self.assertEqual(expected, boot_commands['bootargs'])2127 self.assertEqual(expected, boot_commands['bootargs'])
21282128
2129 def test_passing_None_to_add_boot_args(self):2129 def test_passing_None_to_add_boot_args(self):

Subscribers

People subscribed via source and target branches