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

Proposed by Milo Casagrande
Status: Merged
Approved by: James Tunnicliffe
Approved revision: 598
Merged at revision: 597
Proposed branch: lp:~milo/linaro-image-tools/var-refactoring
Merge into: lp:linaro-image-tools/11.11
Diff against target: 174 lines (+31/-30)
2 files modified
linaro_image_tools/media_create/android_boards.py (+11/-11)
linaro_image_tools/media_create/boards.py (+20/-19)
To merge this branch: bzr merge lp:~milo/linaro-image-tools/var-refactoring
Reviewer Review Type Date Requested Status
James Tunnicliffe (community) Approve
linaro-image-tools maintainers Pending
Review via email: mp+142093@code.launchpad.net

Description of the change

A simple variable name refactoring in order to have the same name between boards.py and android_boards.py.
Tests do not need to be changed.

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

Looks fine, though I wonder if it is worth picking up more:

46 @@ -547,7 +548,7 @@
47 lowmem_opt = ''
48 boot_snippet = 'root=%s' % rootfs_id
49 if is_live:
50 - serial_opts += ' %s' % self.live_serial_opts
51 + serial_opts += ' %s' % self.live_serial_options
52 boot_snippet = 'boot=casper'
53 if is_lowmem:
54 lowmem_opt = 'only-ubiquity'

I would change the local serial_opts variable to be consistent. There are a few places in android_boards where serial_opts turns up as well.

598. By Milo Casagrande

Refactored serial_opts into serial_options.

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

On Mon, Jan 7, 2013 at 12:20 PM, James Tunnicliffe
<email address hidden> wrote:
>
> I would change the local serial_opts variable to be consistent. There are a few places in android_boards where serial_opts turns up as well.

Should be done now.
Thanks.

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

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/media_create/android_boards.py'
2--- linaro_image_tools/media_create/android_boards.py 2013-01-03 13:55:33 +0000
3+++ linaro_image_tools/media_create/android_boards.py 2013-01-07 12:42:21 +0000
4@@ -170,15 +170,15 @@
5 if self.extra_boot_args_options:
6 boot_args_options += ' %s' % self.extra_boot_args_options
7 boot_args_options += ' %s' % self.android_specific_args
8- serial_opts = self.extra_serial_options
9+ serial_options = self.extra_serial_options
10 for console in consoles:
11- serial_opts += ' console=%s' % console
12+ serial_options += ' console=%s' % console
13
14 replacements = dict(
15- serial_opts=serial_opts,
16+ serial_options=serial_options,
17 boot_args_options=boot_args_options)
18 return (
19- "%(serial_opts)s "
20+ "%(serial_options)s "
21 "%(boot_args_options)s"
22 % replacements)
23
24@@ -391,13 +391,13 @@
25 self._android_specific_args = 'init=/init androidboot.console=%s'
26
27 def _get_extra_serial_options(self):
28- serial_opts = self._extra_serial_options
29- if serial_opts:
30- if isinstance(serial_opts, list):
31- serial_opts = ' '.join(serial_opts)
32- if self._check_placeholder_presence(serial_opts, '%s'):
33- serial_opts = serial_opts % self.serial_tty
34- return serial_opts
35+ serial_options = self._extra_serial_options
36+ if serial_options:
37+ if isinstance(serial_options, list):
38+ serial_options = ' '.join(serial_options)
39+ if self._check_placeholder_presence(serial_options, '%s'):
40+ serial_options = serial_options % self.serial_tty
41+ return serial_options
42
43 def _set_extra_serial_options(self, value):
44 self._extra_serial_options = value
45
46=== modified file 'linaro_image_tools/media_create/boards.py'
47--- linaro_image_tools/media_create/boards.py 2013-01-02 14:38:13 +0000
48+++ linaro_image_tools/media_create/boards.py 2013-01-07 12:42:21 +0000
49@@ -151,7 +151,7 @@
50 # placeholders in the string for dinamically change values. But this
51 # is done only for hwpack v1.
52 self._extra_serial_options = ''
53- self._live_serial_opts = ''
54+ self._live_serial_options = ''
55 self.board = None
56 self.boot_script = None
57 self.bootloader_dd = False
58@@ -211,16 +211,17 @@
59 self.initrd = None
60
61 # XXX: can be removed when killing v1 hwpack.
62- def _get_live_serial_opts(self):
63- return_value = self._live_serial_opts
64+ def _get_live_serial_options(self):
65+ return_value = self._live_serial_options
66 if self._check_placeholder_presence(return_value, r'%s'):
67- return_value = self._live_serial_opts % self.serial_tty
68+ return_value = self._live_serial_options % self.serial_tty
69 return return_value
70
71- def _set_live_serial_opts(self, value):
72- self._live_serial_opts = value
73+ def _set_live_serial_options(self, value):
74+ self._live_serial_options = value
75
76- live_serial_opts = property(_get_live_serial_opts, _set_live_serial_opts)
77+ live_serial_options = property(_get_live_serial_options,
78+ _set_live_serial_options)
79
80 # XXX: can be removed when killing v1 hwpack.
81 def _get_extra_serial_options(self):
82@@ -233,7 +234,7 @@
83 self._extra_serial_options = value
84
85 extra_serial_options = property(_get_extra_serial_options,
86- _set_extra_serial_options)
87+ _set_extra_serial_options)
88
89 def get_metadata_field(self, field_name):
90 """ Return the metadata value for field_name if it can be found.
91@@ -540,24 +541,24 @@
92 boot_args_options = 'rootwait ro'
93 if self.extra_boot_args_options:
94 boot_args_options += ' %s' % self.extra_boot_args_options
95- serial_opts = self.extra_serial_options
96+ serial_options = self.extra_serial_options
97 for console in consoles:
98- serial_opts += ' console=%s' % console
99+ serial_options += ' console=%s' % console
100
101 lowmem_opt = ''
102 boot_snippet = 'root=%s' % rootfs_id
103 if is_live:
104- serial_opts += ' %s' % self.live_serial_opts
105+ serial_options += ' %s' % self.live_serial_options
106 boot_snippet = 'boot=casper'
107 if is_lowmem:
108 lowmem_opt = 'only-ubiquity'
109
110 replacements = dict(
111- serial_opts=serial_opts,
112+ serial_options=serial_options,
113 lowmem_opt=lowmem_opt, boot_snippet=boot_snippet,
114 boot_args_options=boot_args_options)
115 return (
116- "%(serial_opts)s %(lowmem_opt)s "
117+ "%(serial_options)s %(lowmem_opt)s "
118 "%(boot_snippet)s %(boot_args_options)s"
119 % replacements)
120
121@@ -946,7 +947,7 @@
122 self.load_addr = '0x80008000'
123 self._serial_tty = 'ttyO2'
124 self._extra_serial_options = 'console=tty0 console=%s,115200n8'
125- self._live_serial_opts = 'serialtty=%s'
126+ self._live_serial_options = 'serialtty=%s'
127
128
129 class OveroConfig(OmapConfig):
130@@ -981,7 +982,7 @@
131 self.kernel_addr = '0x80200000'
132 self.load_addr = '0x80008000'
133 self._extra_serial_options = 'console=tty0 console=%s,115200n8'
134- self._live_serial_opts = 'serialtty=%s'
135+ self._live_serial_options = 'serialtty=%s'
136
137
138 class IgepConfig(BeagleConfig):
139@@ -1020,7 +1021,7 @@
140 self.mmc_option = '1:1'
141 self.serial_tty = 'ttyAMA2'
142 self._extra_serial_options = 'console=tty0 console=%s,115200n8'
143- self._live_serial_opts = 'serialtty=%s'
144+ self._live_serial_options = 'serialtty=%s'
145
146 def _make_boot_files(self, boot_env, chroot_dir, boot_dir,
147 boot_device_or_file, k_img_data, i_img_data,
148@@ -1231,7 +1232,7 @@
149 self.mmc_part_offset = 1
150 self.serial_tty = 'ttymxc0'
151 self._extra_serial_options = 'console=tty0 console=%s,115200n8'
152- self._live_serial_opts = 'serialtty=%s'
153+ self._live_serial_options = 'serialtty=%s'
154
155 def get_v1_sfdisk_cmd(self, should_align_boot_part=None):
156 """Return the sfdisk command to partition the media.
157@@ -1342,7 +1343,7 @@
158 self.load_addr = '0x60008000'
159 self.serial_tty = 'ttyAMA0'
160 self._extra_serial_options = 'console=tty0 console=%s,38400n8'
161- self._live_serial_opts = 'serialtty=%s'
162+ self._live_serial_options = 'serialtty=%s'
163
164 def _make_boot_files(self, boot_env, chroot_dir, boot_dir,
165 boot_device_or_file, k_img_data, i_img_data,
166@@ -1588,7 +1589,7 @@
167 self.kernel_flavors = ['generic', 'pae']
168 self.serial_tty = 'ttyS0'
169 self._extra_serial_options = 'console=tty0 console=%s,115200n8'
170- self._live_serial_opts = 'serialtty=%s'
171+ self._live_serial_options = 'serialtty=%s'
172
173 def _make_boot_files(self, boot_env, chroot_dir, boot_dir,
174 boot_device_or_file, k_img_data, i_img_data,

Subscribers

People subscribed via source and target branches