Merge lp:~stevanr/linaro-image-tools/bug-1107784 into lp:linaro-image-tools/11.11
- bug-1107784
- Merge into trunk
Proposed by
Stevan Radaković
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Milo Casagrande | ||||
Approved revision: | 613 | ||||
Merged at revision: | 606 | ||||
Proposed branch: | lp:~stevanr/linaro-image-tools/bug-1107784 | ||||
Merge into: | lp:linaro-image-tools/11.11 | ||||
Diff against target: |
3793 lines (+731/-701) 39 files modified
linaro_image_tools/hwpack/builder.py (+18/-18) linaro_image_tools/hwpack/config.py (+14/-13) linaro_image_tools/hwpack/handler.py (+6/-6) linaro_image_tools/hwpack/hardwarepack.py (+6/-6) linaro_image_tools/hwpack/hardwarepack_format.py (+3/-3) linaro_image_tools/hwpack/hwpack_convert.py (+20/-18) linaro_image_tools/hwpack/hwpack_fields.py (+4/-3) linaro_image_tools/hwpack/hwpack_reader.py (+9/-9) linaro_image_tools/hwpack/packages.py (+8/-8) linaro_image_tools/hwpack/tarfile_matchers.py (+3/-4) linaro_image_tools/hwpack/testing.py (+5/-6) linaro_image_tools/hwpack/tests/__init__.py (+1/-1) linaro_image_tools/hwpack/tests/test_builder.py (+30/-29) linaro_image_tools/hwpack/tests/test_config.py (+97/-97) linaro_image_tools/hwpack/tests/test_config_v3.py (+43/-41) linaro_image_tools/hwpack/tests/test_hardwarepack.py (+17/-17) linaro_image_tools/hwpack/tests/test_hwpack_converter.py (+29/-29) linaro_image_tools/hwpack/tests/test_hwpack_reader.py (+7/-7) linaro_image_tools/hwpack/tests/test_packages.py (+15/-16) linaro_image_tools/hwpack/tests/test_script.py (+1/-1) linaro_image_tools/hwpack/tests/test_tarfile_matchers.py (+3/-3) linaro_image_tools/hwpack/tests/test_testing.py (+4/-4) linaro_image_tools/media_create/__init__.py (+1/-1) linaro_image_tools/media_create/android_boards.py (+12/-12) linaro_image_tools/media_create/boards.py (+50/-44) linaro_image_tools/media_create/check_device.py (+2/-2) linaro_image_tools/media_create/chroot_utils.py (+3/-3) linaro_image_tools/media_create/partitions.py (+4/-3) linaro_image_tools/media_create/rootfs.py (+3/-3) linaro_image_tools/media_create/tests/__init__.py (+1/-1) linaro_image_tools/media_create/tests/test_android_boards.py (+19/-16) linaro_image_tools/media_create/tests/test_media_create.py (+242/-226) linaro_image_tools/tests/__init__.py (+2/-2) linaro_image_tools/tests/test_cmd_runner.py (+1/-1) linaro_image_tools/tests/test_pep8.py (+5/-4) linaro_image_tools/tests/test_pyflakes.py (+2/-2) linaro_image_tools/tests/test_utils.py (+18/-19) linaro_image_tools/utils.py (+10/-10) setup.py (+13/-13) |
||||
To merge this branch: | bzr merge lp:~stevanr/linaro-image-tools/bug-1107784 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Milo Casagrande (community) | Approve | ||
Review via email: mp+149054@code.launchpad.net |
Commit message
Description of the change
Fix for bug #1107784.
Changes are fairly simple so it might not make sense to go through each of the lines individually, running tests on quantal should be enough.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'linaro_image_tools/hwpack/builder.py' |
2 | --- linaro_image_tools/hwpack/builder.py 2013-01-10 13:17:57 +0000 |
3 | +++ linaro_image_tools/hwpack/builder.py 2013-02-18 14:17:36 +0000 |
4 | @@ -38,7 +38,7 @@ |
5 | FetchedPackage, |
6 | LocalArchiveMaker, |
7 | PackageFetcher, |
8 | - ) |
9 | +) |
10 | |
11 | from linaro_image_tools.hwpack.hwpack_fields import ( |
12 | PACKAGE_FIELD, |
13 | @@ -124,8 +124,8 @@ |
14 | wanted_package = package |
15 | break |
16 | else: |
17 | - raise AssertionError("Package '%s' was not fetched." % \ |
18 | - wanted_package_name) |
19 | + raise AssertionError("Package '%s' was not fetched." % |
20 | + wanted_package_name) |
21 | return wanted_package |
22 | |
23 | def add_file_to_hwpack(self, package, wanted_file, target_path): |
24 | @@ -167,8 +167,8 @@ |
25 | base_dest_path = os.path.join(base_dest_path, self.config.bootloader) |
26 | # Extract bootloader file |
27 | if self.config.bootloader_package and self.config.bootloader_file: |
28 | - dest_path = os.path.join(base_dest_path, |
29 | - os.path.dirname(self.config.bootloader_file)) |
30 | + dest_path = os.path.join( |
31 | + base_dest_path, os.path.dirname(self.config.bootloader_file)) |
32 | self.do_extract_file(self.config.bootloader_package, |
33 | self.config.bootloader_file, |
34 | dest_path) |
35 | @@ -176,7 +176,7 @@ |
36 | # Extract SPL file |
37 | if self.config.spl_package and self.config.spl_file: |
38 | dest_path = os.path.join(base_dest_path, |
39 | - os.path.dirname(self.config.spl_file)) |
40 | + os.path.dirname(self.config.spl_file)) |
41 | self.do_extract_file(self.config.spl_package, |
42 | self.config.spl_file, |
43 | dest_path) |
44 | @@ -241,10 +241,10 @@ |
45 | if self.format.format_as_string == '3.0': |
46 | if self.config.bootloaders is not None: |
47 | self.packages.extend(self.find_bootloader_packages( |
48 | - self.config.bootloaders)) |
49 | + self.config.bootloaders)) |
50 | if self.config.boards is not None: |
51 | self.packages.extend(self.find_bootloader_packages( |
52 | - self.config.boards)) |
53 | + self.config.boards)) |
54 | |
55 | self.packages.extend(self.find_copy_files_packages()) |
56 | else: |
57 | @@ -316,12 +316,12 @@ |
58 | if self.config.bootloader_file is not None: |
59 | assert(self.config.bootloader_package is not None) |
60 | bootloader_package = self.find_fetched_package( |
61 | - self.packages, |
62 | - self.config.bootloader_package) |
63 | + self.packages, |
64 | + self.config.bootloader_package) |
65 | self.hwpack.metadata.u_boot = self.add_file_to_hwpack( |
66 | - bootloader_package, |
67 | - self.config.bootloader_file, |
68 | - self.hwpack.U_BOOT_DIR) |
69 | + bootloader_package, |
70 | + self.config.bootloader_file, |
71 | + self.hwpack.U_BOOT_DIR) |
72 | |
73 | spl_package = None |
74 | if self.config.spl_file is not None: |
75 | @@ -329,13 +329,13 @@ |
76 | spl_package = self.find_fetched_package(self.packages, |
77 | self.config.spl_package) |
78 | self.hwpack.metadata.spl = self.add_file_to_hwpack( |
79 | - spl_package, |
80 | - self.config.spl_file, |
81 | - self.hwpack.SPL_DIR) |
82 | + spl_package, |
83 | + self.config.spl_file, |
84 | + self.hwpack.SPL_DIR) |
85 | |
86 | # bootloader_package and spl_package can be identical |
87 | if (bootloader_package is not None and |
88 | - bootloader_package in self.packages): |
89 | + bootloader_package in self.packages): |
90 | self.packages.remove(bootloader_package) |
91 | if (spl_package is not None and spl_package in self.packages): |
92 | self.packages.remove(spl_package) |
93 | @@ -351,7 +351,7 @@ |
94 | for local_package in local_packages: |
95 | if local_package not in self.packages: |
96 | logger.warning("Local package '%s' not included", |
97 | - local_package.name) |
98 | + local_package.name) |
99 | self.hwpack.add_dependency_package(self.config.packages) |
100 | |
101 | def _extract_build_info(self, cache_dir, out_name, manifest_name): |
102 | |
103 | === modified file 'linaro_image_tools/hwpack/config.py' |
104 | --- linaro_image_tools/hwpack/config.py 2013-01-14 16:26:56 +0000 |
105 | +++ linaro_image_tools/hwpack/config.py 2013-02-18 14:17:36 +0000 |
106 | @@ -30,7 +30,7 @@ |
107 | HardwarePackFormatV1, |
108 | HardwarePackFormatV2, |
109 | HardwarePackFormatV3, |
110 | - ) |
111 | +) |
112 | |
113 | from hwpack_fields import ( |
114 | ARCHITECTURES_FIELD, |
115 | @@ -180,7 +180,7 @@ |
116 | self.parser = yaml.safe_load(fp) |
117 | except yaml.YAMLError, e: |
118 | obfuscated_yaml_e = re.sub(r"([^ ]https://).+?(@)", |
119 | - r"\1***\2", str(e)) |
120 | + r"\1***\2", str(e)) |
121 | else: |
122 | # If YAML parsed OK, we don't have an error. |
123 | obfuscated_e = None |
124 | @@ -333,7 +333,7 @@ |
125 | return HardwarePackFormatV3() |
126 | else: |
127 | raise HwpackConfigError("Format version '%s' is not supported." % |
128 | - format_string) |
129 | + format_string) |
130 | |
131 | @property |
132 | def name(self): |
133 | @@ -348,7 +348,7 @@ |
134 | def include_debs(self): |
135 | """Whether the hardware pack should contain .debs. A bool.""" |
136 | try: |
137 | - if self._get_option(self.INCLUDE_DEBS_KEY) == None: |
138 | + if self._get_option(self.INCLUDE_DEBS_KEY) is None: |
139 | return True |
140 | try: |
141 | return self._get_option_bool(self.INCLUDE_DEBS_KEY) |
142 | @@ -419,7 +419,7 @@ |
143 | else: |
144 | if len(value.keys()) > 1: |
145 | raise HwpackConfigError("copy_files entry found with" |
146 | - "more than one destination") |
147 | + "more than one destination") |
148 | source_path = value.keys()[0] |
149 | dest_path = value[source_path] |
150 | |
151 | @@ -427,7 +427,8 @@ |
152 | # Target path should be relative, or start with /boot - we |
153 | # don't support to copying to anywhere other than /boot. |
154 | if dest_path[0] == "/": |
155 | - raise HwpackConfigError("copy_files destinations must" |
156 | + raise HwpackConfigError( |
157 | + "copy_files destinations must" |
158 | "be relative to /boot or start with /boot.") |
159 | dest_path = os.path.join("/boot", dest_path) |
160 | |
161 | @@ -553,11 +554,11 @@ |
162 | result = self._get_v3_option([BOARDS_FIELD, self.board] + keys) |
163 | |
164 | # If a board specific value isn't found, look for a global one |
165 | - if result == None: |
166 | + if result is None: |
167 | result = self._get_v3_option(keys) |
168 | |
169 | # If no value is found, bail early (return None) |
170 | - if result == None: |
171 | + if result is None: |
172 | return None |
173 | |
174 | # <v3 compatibility: Lists of items can be converted to strings |
175 | @@ -951,8 +952,8 @@ |
176 | if not format: |
177 | raise HwpackConfigError("Empty value for format") |
178 | if not format.is_supported: |
179 | - raise HwpackConfigError("Format version '%s' is not supported." % \ |
180 | - format) |
181 | + raise HwpackConfigError("Format version '%s' is not supported." % |
182 | + format) |
183 | |
184 | def _assert_matches_pattern(self, regex, config_item, error_message): |
185 | if re.match(regex, config_item) is None: |
186 | @@ -1066,7 +1067,7 @@ |
187 | raise HwpackConfigError("Invalid %s address: %s" % |
188 | (name, self._get_option(key))) |
189 | |
190 | - if addr == None: |
191 | + if addr is None: |
192 | return |
193 | |
194 | if not re.match(r"^0x[a-fA-F0-9]{8}$", addr): |
195 | @@ -1109,8 +1110,8 @@ |
196 | mmc_id = self.mmc_id |
197 | if not mmc_id: |
198 | raise HwpackConfigError( |
199 | - "No mmc_id in the [%s] section" % \ |
200 | - self.MAIN_SECTION) |
201 | + "No mmc_id in the [%s] section" % |
202 | + self.MAIN_SECTION) |
203 | else: |
204 | self._assert_matches_pattern( |
205 | r"[0-9]:[0-9]", mmc_id, "Invalid mmc_id %s" % mmc_id) |
206 | |
207 | === modified file 'linaro_image_tools/hwpack/handler.py' |
208 | --- linaro_image_tools/hwpack/handler.py 2013-01-10 13:17:57 +0000 |
209 | +++ linaro_image_tools/hwpack/handler.py 2013-02-18 14:17:36 +0000 |
210 | @@ -232,12 +232,12 @@ |
211 | |
212 | if name != pkg_name: |
213 | continue |
214 | - if version != None and str(version) != pkg_version: |
215 | - continue |
216 | - if revision != None and str(revision) != pkg_revision: |
217 | - continue |
218 | - if (architecture != None and |
219 | - str(architecture) != pkg_architecture): |
220 | + if version is not None and str(version) != pkg_version: |
221 | + continue |
222 | + if revision is not None and str(revision) != pkg_revision: |
223 | + continue |
224 | + if (architecture is not None and |
225 | + str(architecture) != pkg_architecture): |
226 | continue |
227 | |
228 | # Got a matching package - return its path inside the tarball |
229 | |
230 | === modified file 'linaro_image_tools/hwpack/hardwarepack.py' |
231 | --- linaro_image_tools/hwpack/hardwarepack.py 2013-01-03 10:40:12 +0000 |
232 | +++ linaro_image_tools/hwpack/hardwarepack.py 2013-02-18 14:17:36 +0000 |
233 | @@ -28,7 +28,7 @@ |
234 | FetchedPackage, |
235 | get_packages_file, |
236 | PackageMaker, |
237 | - ) |
238 | +) |
239 | from linaro_image_tools.hwpack.hardwarepack_format import ( |
240 | HardwarePackFormatV1, |
241 | ) |
242 | @@ -238,11 +238,11 @@ |
243 | spl_in_boot_part=config.spl_in_boot_part, |
244 | uboot_dd=config.bootloader_dd, |
245 | bootloader_file_in_boot_part=config. |
246 | - bootloader_file_in_boot_part, |
247 | + bootloader_file_in_boot_part, |
248 | vmlinuz=config.vmlinuz, |
249 | wired_interfaces=config.wired_interfaces, |
250 | wireless_interfaces=config.wireless_interfaces, |
251 | - ) |
252 | + ) |
253 | if config.format.format_as_string == '3.0': |
254 | metadata.add_v3_config(boards=config.boards, |
255 | bootloaders=config.bootloaders, |
256 | @@ -327,11 +327,11 @@ |
257 | else: |
258 | extra_serial_options = self.extra_serial_options |
259 | metadata += dump({ |
260 | - EXTRA_SERIAL_OPTIONS_FIELD: |
261 | - extra_serial_options}) |
262 | + EXTRA_SERIAL_OPTIONS_FIELD: |
263 | + extra_serial_options}) |
264 | if self.snowball_startup_files_config is not None: |
265 | metadata += dump({SNOWBALL_STARTUP_FILES_CONFIG_FIELD: |
266 | - self.snowball_startup_files_config}) |
267 | + self.snowball_startup_files_config}) |
268 | if self.samsung_bl1_start is not None: |
269 | metadata += dump({SAMSUNG_BL1_START_FIELD: self.samsung_bl1_start}) |
270 | if self.samsung_bl1_len is not None: |
271 | |
272 | === modified file 'linaro_image_tools/hwpack/hardwarepack_format.py' |
273 | --- linaro_image_tools/hwpack/hardwarepack_format.py 2012-07-10 14:15:04 +0000 |
274 | +++ linaro_image_tools/hwpack/hardwarepack_format.py 2013-02-18 14:17:36 +0000 |
275 | @@ -36,9 +36,9 @@ |
276 | if self.format_as_string is None: |
277 | raise NotImplementedError() |
278 | if self.is_deprecated: |
279 | - logger.warning("The format '%s' is deprecated, please update " \ |
280 | - "your hardware pack configuration." % \ |
281 | - self.format_as_string) |
282 | + logger.warning("The format '%s' is deprecated, please update " |
283 | + "your hardware pack configuration." % |
284 | + self.format_as_string) |
285 | return self.format_as_string |
286 | |
287 | |
288 | |
289 | === modified file 'linaro_image_tools/hwpack/hwpack_convert.py' |
290 | --- linaro_image_tools/hwpack/hwpack_convert.py 2012-10-22 06:57:20 +0000 |
291 | +++ linaro_image_tools/hwpack/hwpack_convert.py 2013-02-18 14:17:36 +0000 |
292 | @@ -69,7 +69,7 @@ |
293 | UBOOT_DD_KEY = 'u_boot_dd' |
294 | # All the u_boot defined keys in a list. |
295 | UBOOT_KEYS = [UBOOT_PACKAGE_KEY, UBOOT_FILE_KEY, UBOOT_IN_BOOT_PART_KEY, |
296 | - UBOOT_DD_KEY] |
297 | + UBOOT_DD_KEY] |
298 | |
299 | # Old field, the only one with a dash: since the format is new, convert it. |
300 | ASSUME_INSTALLED_OLD = 'assume-installed' |
301 | @@ -150,26 +150,28 @@ |
302 | elif re.match("[Nn]o", value): |
303 | value = False |
304 | if key == ARCHITECTURES_FIELD: |
305 | - self.parse_list_string(self.architectures, |
306 | - value) |
307 | + self.parse_list_string( |
308 | + self.architectures, |
309 | + value) |
310 | continue |
311 | elif key == EXTRA_BOOT_OPTIONS_FIELD: |
312 | - self.parse_list_string(self.extra_boot_options, |
313 | - value) |
314 | + self.parse_list_string( |
315 | + self.extra_boot_options, |
316 | + value) |
317 | continue |
318 | elif key == EXTRA_SERIAL_OPTIONS_FIELD: |
319 | self.parse_list_string( |
320 | - self.extra_serial_options, |
321 | - value) |
322 | + self.extra_serial_options, |
323 | + value) |
324 | continue |
325 | elif key == WIRED_INTERFACES_FIELD: |
326 | self.parse_list_string(self.wired_interfaces, |
327 | - value) |
328 | + value) |
329 | continue |
330 | elif key == WIRELESS_INTERFACES_FIELD: |
331 | self.parse_list_string( |
332 | - self.wireless_interfaces, |
333 | - value) |
334 | + self.wireless_interfaces, |
335 | + value) |
336 | continue |
337 | elif key in SPL_KEYS: |
338 | self.spl[key] = value |
339 | @@ -185,8 +187,8 @@ |
340 | # Create list. |
341 | elif key == ASSUME_INSTALLED_OLD: |
342 | self.parse_list_string( |
343 | - self.assume_installed, |
344 | - value) |
345 | + self.assume_installed, |
346 | + value) |
347 | continue |
348 | elif key == DTB_FILE_FIELD: |
349 | self.dtb_files.append({DEFAULT_DTB_NAME: |
350 | @@ -226,7 +228,7 @@ |
351 | """ |
352 | if not isinstance(store, list): |
353 | raise HwpackConverterException("Can use this method only with " |
354 | - "list.") |
355 | + "list.") |
356 | store.extend(string.split(" ")) |
357 | |
358 | def _to_file(self): |
359 | @@ -256,7 +258,7 @@ |
360 | converted += dump(installed) |
361 | if self.extra_serial_options: |
362 | serial_options = {EXTRA_SERIAL_OPTIONS_FIELD: |
363 | - self.extra_serial_options} |
364 | + self.extra_serial_options} |
365 | converted += dump(serial_options) |
366 | if self.packages: |
367 | packages = {PACKAGES_FIELD: self.packages} |
368 | @@ -282,7 +284,7 @@ |
369 | nested_value[key] = value |
370 | if self.extra_boot_options: |
371 | nested_value[EXTRA_BOOT_OPTIONS_FIELD] = \ |
372 | - self.extra_boot_options |
373 | + self.extra_boot_options |
374 | if self.spl: |
375 | for key, value in self.spl.iteritems(): |
376 | nested_value[key] = value |
377 | @@ -309,12 +311,12 @@ |
378 | output_file = args.out |
379 | if not os.path.exists(input_file) or not os.path.isfile(input_file): |
380 | raise HwpackConverterException("The configuration file '%s' is not a " |
381 | - "regular file." % input_file) |
382 | + "regular file." % input_file) |
383 | if output_file is not None: |
384 | if os.path.exists(output_file) or os.path.isdir(output_file): |
385 | raise HwpackConverterException("The output file name provided " |
386 | - "'%s' already exists, or is a " |
387 | - "directory." % output_file) |
388 | + "'%s' already exists, or is a " |
389 | + "directory." % output_file) |
390 | elif not os.path.isabs(output_file): |
391 | # If we output file is just a name, write it in the current dir. |
392 | output_file = os.path.join(os.getcwd(), output_file) |
393 | |
394 | === modified file 'linaro_image_tools/hwpack/hwpack_fields.py' |
395 | --- linaro_image_tools/hwpack/hwpack_fields.py 2012-12-10 10:49:30 +0000 |
396 | +++ linaro_image_tools/hwpack/hwpack_fields.py 2013-02-18 14:17:36 +0000 |
397 | @@ -96,7 +96,7 @@ |
398 | BOOTFS16, |
399 | BOOTFS, |
400 | RESERVED_BOOTFS, |
401 | - ] |
402 | +] |
403 | |
404 | # Supported bootloaders |
405 | U_BOOT = 'u_boot' |
406 | @@ -150,7 +150,8 @@ |
407 | SNOWBALL_STARTUP_FILES_CONFIG_FIELD: None, |
408 | SOURCES_FIELD: None, |
409 | BOOTLOADERS_FIELD: { |
410 | - "*": { |
411 | + "*": |
412 | + { |
413 | PACKAGE_FIELD: None, |
414 | FILE_FIELD: None, |
415 | IN_BOOT_PART_FIELD: None, |
416 | @@ -162,7 +163,7 @@ |
417 | SPL_IN_BOOT_PART_FIELD: None, |
418 | SPL_DD_FIELD: None, |
419 | ENV_DD_FIELD: None, |
420 | - } |
421 | + } |
422 | }, |
423 | BOARDS_FIELD: "root", |
424 | } |
425 | |
426 | === modified file 'linaro_image_tools/hwpack/hwpack_reader.py' |
427 | --- linaro_image_tools/hwpack/hwpack_reader.py 2012-12-05 13:01:06 +0000 |
428 | +++ linaro_image_tools/hwpack/hwpack_reader.py 2013-02-18 14:17:36 +0000 |
429 | @@ -95,9 +95,9 @@ |
430 | equal = False |
431 | if isinstance(other, Hwpack): |
432 | equal = (self.name == other.name and |
433 | - self.boards == other.boards and |
434 | - self.hwpack == other.hwpack and |
435 | - self.bootloaders == other.bootloaders) |
436 | + self.boards == other.boards and |
437 | + self.hwpack == other.hwpack and |
438 | + self.bootloaders == other.bootloaders) |
439 | return equal |
440 | |
441 | def __hash__(self): |
442 | @@ -123,20 +123,20 @@ |
443 | supported_bootloaders = bootloaders.keys() |
444 | else: |
445 | supported_bootloaders = self.bootloaders.keys() |
446 | - string += ELEMENT_FORMAT.format(key, |
447 | - ",".join(supported_bootloaders)) |
448 | + string += ELEMENT_FORMAT.format( |
449 | + key, ",".join(supported_bootloaders)) |
450 | string += LINE_SEP |
451 | else: |
452 | # If we pass a converted file with just a single board, we do not |
453 | # have the boards section, and we default to the name of the hwpack |
454 | if self.bootloaders: |
455 | supported_bootloaders = self.bootloaders.keys() |
456 | - string += ELEMENT_FORMAT.format(self.name, |
457 | - ",".join(supported_bootloaders)) |
458 | + string += ELEMENT_FORMAT.format( |
459 | + self.name, ",".join(supported_bootloaders)) |
460 | string += LINE_SEP |
461 | else: |
462 | string += CENTER_ALIGN.format("No supported boards and " |
463 | - "bootloaders") |
464 | + "bootloaders") |
465 | string += LINE_SEP |
466 | string += FORMAT.format(SEPARATOR) |
467 | return string + LINE_SEP |
468 | @@ -169,7 +169,7 @@ |
469 | local_hwpack.setname(handler.get_field(NAME_FIELD)[0]) |
470 | local_hwpack.setboards(handler.get_field(BOARDS_FIELD)[0]) |
471 | local_hwpack.setbootloaders( |
472 | - handler.get_field(BOOTLOADERS_FIELD)[0]) |
473 | + handler.get_field(BOOTLOADERS_FIELD)[0]) |
474 | self.supported_elements.append(local_hwpack) |
475 | else: |
476 | raise HwpackReaderError("Hardwarepack '%s' cannot be " |
477 | |
478 | === modified file 'linaro_image_tools/hwpack/packages.py' |
479 | --- linaro_image_tools/hwpack/packages.py 2012-09-03 17:12:23 +0000 |
480 | +++ linaro_image_tools/hwpack/packages.py 2013-02-18 14:17:36 +0000 |
481 | @@ -241,7 +241,7 @@ |
482 | name=name, |
483 | relationships=''.join(relationship_strs), |
484 | version=version, |
485 | - ) |
486 | + ) |
487 | control_file_text = self.control_file_template.safe_substitute( |
488 | subst_vars) |
489 | |
490 | @@ -253,7 +253,7 @@ |
491 | new_file.write(name + " " + file_path) |
492 | |
493 | with open(os.path.join( |
494 | - packaging_dir, 'DEBIAN', 'control'), 'w') as control_file: |
495 | + packaging_dir, 'DEBIAN', 'control'), 'w') as control_file: |
496 | control_file.write(control_file_text) |
497 | env = os.environ |
498 | env['LC_ALL'] = 'C' |
499 | @@ -494,7 +494,7 @@ |
500 | "etc/apt/sources.list.d", |
501 | "var/cache/apt/archives/partial", |
502 | "var/lib/apt/lists/partial", |
503 | - ] |
504 | + ] |
505 | for d in dirs: |
506 | os.makedirs(os.path.join(self.tempdir, d)) |
507 | self.set_installed_packages([], reopen=False) |
508 | @@ -575,7 +575,7 @@ |
509 | is reopened. |
510 | """ |
511 | with open( |
512 | - os.path.join(self.tempdir, "var/lib/dpkg/status"), "w") as f: |
513 | + os.path.join(self.tempdir, "var/lib/dpkg/status"), "w") as f: |
514 | f.write( |
515 | get_packages_file( |
516 | packages, extra_text="Status: install ok installed")) |
517 | @@ -658,7 +658,7 @@ |
518 | raise DependencyNotSatisfied( |
519 | "Unable to satisfy dependencies of %s" % |
520 | ", ".join([p.name for p in self.cache.cache |
521 | - if p.is_inst_broken])) |
522 | + if p.is_inst_broken])) |
523 | installed = [] |
524 | for package in self.cache.cache.get_changes(): |
525 | candidate = package.candidate |
526 | @@ -673,7 +673,7 @@ |
527 | logger.debug("Ignored %s" % package.name) |
528 | self.cache.set_installed_packages(installed) |
529 | broken = [p.name for p in self.cache.cache |
530 | - if p.is_inst_broken or p.is_now_broken] |
531 | + if p.is_inst_broken or p.is_now_broken] |
532 | if broken: |
533 | # If this happens then there is a bug, as we should have |
534 | # caught this problem earlier |
535 | @@ -728,7 +728,7 @@ |
536 | raise DependencyNotSatisfied( |
537 | "Unable to satisfy dependencies of %s" % |
538 | ", ".join([p.name for p in self.cache.cache |
539 | - if p.is_inst_broken])) |
540 | + if p.is_inst_broken])) |
541 | |
542 | for package in packages: |
543 | try: |
544 | @@ -750,7 +750,7 @@ |
545 | acqfiles = [] |
546 | # re to remove the repo private key |
547 | deb_url_auth_re = re.compile( |
548 | - r"(?P<transport>.*://)(?P<user>.*):.*@(?P<path>.*$)") |
549 | + r"(?P<transport>.*://)(?P<user>.*):.*@(?P<path>.*$)") |
550 | for package in self.cache.cache.get_changes(): |
551 | if (package.marked_delete or package.marked_keep): |
552 | continue |
553 | |
554 | === modified file 'linaro_image_tools/hwpack/tarfile_matchers.py' |
555 | --- linaro_image_tools/hwpack/tarfile_matchers.py 2012-06-13 14:26:02 +0000 |
556 | +++ linaro_image_tools/hwpack/tarfile_matchers.py 2013-02-18 14:17:36 +0000 |
557 | @@ -149,9 +149,8 @@ |
558 | if self.path not in tarball.getnames(): |
559 | return TarfileMissingPathMismatch(tarball, self.path) |
560 | info = tarball.getmember(self.path) |
561 | - for attr in ( |
562 | - "type", "size", "mode", "linkname", "uid", "gid", |
563 | - "uname", "gname"): |
564 | + for attr in ("type", "size", "mode", "linkname", |
565 | + "uid", "gid", "uname", "gname"): |
566 | expected = getattr(self, attr, None) |
567 | if expected is not None: |
568 | actual = getattr(info, attr) |
569 | @@ -170,7 +169,7 @@ |
570 | for name in tarball.getnames(): |
571 | name_frags = name.split('/') |
572 | if (len(name_frags) == len(path_frags) + 1 and |
573 | - name_frags[:-1] == path_frags): |
574 | + name_frags[:-1] == path_frags): |
575 | contents.append(name_frags[-1]) |
576 | content_mismatch = self.content_matcher.match(contents) |
577 | if content_mismatch: |
578 | |
579 | === modified file 'linaro_image_tools/hwpack/testing.py' |
580 | --- linaro_image_tools/hwpack/testing.py 2012-08-29 15:01:41 +0000 |
581 | +++ linaro_image_tools/hwpack/testing.py 2013-02-18 14:17:36 +0000 |
582 | @@ -39,7 +39,7 @@ |
583 | from linaro_image_tools.hwpack.packages import ( |
584 | get_packages_file, |
585 | FetchedPackage, |
586 | - ) |
587 | +) |
588 | |
589 | |
590 | @contextmanager |
591 | @@ -150,8 +150,7 @@ |
592 | def setUp(self): |
593 | self.rootdir = tempfile.mkdtemp(prefix="hwpack-apt-source-") |
594 | for package in self.packages: |
595 | - with open( |
596 | - os.path.join(self.rootdir, package.filename), 'wb') as f: |
597 | + with open(os.path.join(self.rootdir, package.filename), 'wb') as f: |
598 | f.write(package.content.read()) |
599 | with open(os.path.join(self.rootdir, "Packages"), 'wb') as f: |
600 | f.write(get_packages_file(self.packages)) |
601 | @@ -365,13 +364,13 @@ |
602 | MatchesSetwise(*map(Equals, manifest_lines))))) |
603 | matchers.append(HardwarePackHasFile("pkgs", type=tarfile.DIRTYPE)) |
604 | packages_with_content = [p for p in self.packages |
605 | - if p not in self.packages_without_content] |
606 | + if p not in self.packages_without_content] |
607 | for package in packages_with_content: |
608 | matchers.append(HardwarePackHasFile( |
609 | "pkgs/%s" % package.filename, |
610 | content=package.content.read())) |
611 | package_matchers = [ |
612 | - MatchesPackage(p) for p in packages_with_content] |
613 | + MatchesPackage(p) for p in packages_with_content] |
614 | dep_package_matcher = MatchesStructure( |
615 | name=Equals('hwpack-' + self.metadata.name), |
616 | version=Equals(self.metadata.version), |
617 | @@ -548,7 +547,7 @@ |
618 | msg += ': ' + str(extra_values) |
619 | return Annotate( |
620 | msg, EachOf(remaining_matchers[:common_length]) |
621 | - ).match(not_matched[:common_length]) |
622 | + ).match(not_matched[:common_length]) |
623 | |
624 | |
625 | def parse_packages_file_content(file_content): |
626 | |
627 | === modified file 'linaro_image_tools/hwpack/tests/__init__.py' |
628 | --- linaro_image_tools/hwpack/tests/__init__.py 2012-12-10 17:32:21 +0000 |
629 | +++ linaro_image_tools/hwpack/tests/__init__.py 2013-02-18 14:17:36 +0000 |
630 | @@ -35,7 +35,7 @@ |
631 | 'linaro_image_tools.hwpack.tests.test_script', |
632 | 'linaro_image_tools.hwpack.tests.test_tarfile_matchers', |
633 | 'linaro_image_tools.hwpack.tests.test_testing', |
634 | - ] |
635 | + ] |
636 | loader = unittest.TestLoader() |
637 | suite = loader.loadTestsFromNames(module_names) |
638 | return suite |
639 | |
640 | === modified file 'linaro_image_tools/hwpack/tests/test_builder.py' |
641 | --- linaro_image_tools/hwpack/tests/test_builder.py 2012-09-11 14:28:20 +0000 |
642 | +++ linaro_image_tools/hwpack/tests/test_builder.py 2013-02-18 14:17:36 +0000 |
643 | @@ -30,13 +30,13 @@ |
644 | PackageUnpacker, |
645 | HardwarePackBuilder, |
646 | logger as builder_logger, |
647 | - ) |
648 | +) |
649 | from linaro_image_tools.hwpack.config import HwpackConfigError |
650 | from linaro_image_tools.hwpack.hardwarepack import Metadata |
651 | from linaro_image_tools.hwpack.packages import ( |
652 | FetchedPackage, |
653 | PackageMaker, |
654 | - ) |
655 | +) |
656 | from linaro_image_tools.hwpack.tarfile_matchers import TarfileHasFile |
657 | from linaro_image_tools.hwpack.testing import ( |
658 | AppendingHandler, |
659 | @@ -49,12 +49,12 @@ |
660 | IsHardwarePack, |
661 | MatchesStructure, |
662 | Not, |
663 | - ) |
664 | +) |
665 | from linaro_image_tools.testing import TestCaseWithFixtures |
666 | from linaro_image_tools.tests.fixtures import ( |
667 | MockSomethingFixture, |
668 | MockCmdRunnerPopenFixture, |
669 | - ) |
670 | +) |
671 | |
672 | |
673 | class ConfigFileMissingTests(TestCase): |
674 | @@ -93,19 +93,20 @@ |
675 | file = 'dummyfile' |
676 | with PackageUnpacker() as package_unpacker: |
677 | self.useFixture(MockSomethingFixture( |
678 | - package_unpacker, 'unpack_package', lambda package: None)) |
679 | + package_unpacker, 'unpack_package', lambda package: None)) |
680 | self.useFixture(MockSomethingFixture( |
681 | - os.path, 'exists', lambda file: True)) |
682 | + os.path, 'exists', lambda file: True)) |
683 | tempfile = package_unpacker.get_file(package, file) |
684 | self.assertEquals(tempfile, |
685 | - os.path.join(package_unpacker.get_path(package), file)) |
686 | + os.path.join(package_unpacker.get_path(package), |
687 | + file)) |
688 | |
689 | def test_get_file_raises(self): |
690 | package = 'package' |
691 | file = 'dummyfile' |
692 | with PackageUnpacker() as package_unpacker: |
693 | self.useFixture(MockSomethingFixture( |
694 | - package_unpacker, 'unpack_package', lambda package: None)) |
695 | + package_unpacker, 'unpack_package', lambda package: None)) |
696 | self.assertRaises(AssertionError, package_unpacker.get_file, |
697 | package, file) |
698 | |
699 | @@ -118,9 +119,9 @@ |
700 | file = 'dummyfile' |
701 | with PackageUnpacker() as package_unpacker: |
702 | self.useFixture(MockSomethingFixture( |
703 | - package_unpacker, 'unpack_package', lambda package: None)) |
704 | + package_unpacker, 'unpack_package', lambda package: None)) |
705 | self.useFixture(MockSomethingFixture( |
706 | - os.path, 'exists', lambda file: True)) |
707 | + os.path, 'exists', lambda file: True)) |
708 | tempfile1 = package_unpacker.get_file(package1, file) |
709 | tempfile2 = package_unpacker.get_file(package2, file) |
710 | self.assertNotEquals(tempfile1, tempfile2) |
711 | @@ -128,20 +129,20 @@ |
712 | |
713 | class HardwarePackBuilderTests(TestCaseWithFixtures): |
714 | config_v3 = "\n".join(["format: 3.0", |
715 | - "name: ahwpack", |
716 | - "architectures: armel", |
717 | - "serial_tty: ttySAC1", |
718 | - "partition_layout:", |
719 | - " - bootfs_rootfs", |
720 | - "boot_script: boot.scr", |
721 | - "mmc_id: 0:1", |
722 | - "kernel_file: boot/vmlinuz-*-linaro-omap", |
723 | - "initrd_file: boot/initrd.img-*-linaro-omap", |
724 | - "dtb_file: boot/dt-*-linaro-omap/omap4-panda.dtb", |
725 | - "packages:", |
726 | - " - %s", |
727 | - " - %s", |
728 | - ""]) |
729 | + "name: ahwpack", |
730 | + "architectures: armel", |
731 | + "serial_tty: ttySAC1", |
732 | + "partition_layout:", |
733 | + " - bootfs_rootfs", |
734 | + "boot_script: boot.scr", |
735 | + "mmc_id: 0:1", |
736 | + "kernel_file: boot/vmlinuz-*-linaro-omap", |
737 | + "initrd_file: boot/initrd.img-*-linaro-omap", |
738 | + "dtb_file: boot/dt-*-linaro-omap/omap4-panda.dtb", |
739 | + "packages:", |
740 | + " - %s", |
741 | + " - %s", |
742 | + ""]) |
743 | bootloader_config = "\n".join([" package: %s", |
744 | " in_boot_part: %s", |
745 | ""]) |
746 | @@ -273,7 +274,7 @@ |
747 | builder = HardwarePackBuilder(config.filename, metadata.version, []) |
748 | builder.build() |
749 | hwpack_filename = "hwpack_%s_%s_%s.tar.gz" % ( |
750 | - metadata.name, metadata.version, metadata.architecture) |
751 | + metadata.name, metadata.version, metadata.architecture) |
752 | self.assertThat( |
753 | hwpack_filename, |
754 | IsHardwarePack( |
755 | @@ -433,11 +434,11 @@ |
756 | package_names = ['package0', 'package1', 'package2', 'package3'] |
757 | files = { |
758 | package_names[0]: |
759 | - ["usr/lib/u-boot/omap4_panda/u-boot.img", |
760 | - "usr/share/doc/u-boot-linaro-omap4-panda/copyright"], |
761 | + ["usr/lib/u-boot/omap4_panda/u-boot.img", |
762 | + "usr/share/doc/u-boot-linaro-omap4-panda/copyright"], |
763 | package_names[1]: |
764 | - ["usr/lib/u-boot/omap4_panda/u-boot.img", |
765 | - "some/path/file"], |
766 | + ["usr/lib/u-boot/omap4_panda/u-boot.img", |
767 | + "some/path/file"], |
768 | package_names[2]: [], |
769 | package_names[3]: [], |
770 | } |
771 | |
772 | === modified file 'linaro_image_tools/hwpack/tests/test_config.py' |
773 | --- linaro_image_tools/hwpack/tests/test_config.py 2013-01-03 10:40:12 +0000 |
774 | +++ linaro_image_tools/hwpack/tests/test_config.py 2013-02-18 14:17:36 +0000 |
775 | @@ -87,54 +87,54 @@ |
776 | |
777 | def test_validate_invalid_include_debs(self): |
778 | config = self.get_config( |
779 | - "[hwpack]\nname = ahwpack\n" |
780 | - "include-debs = if you don't mind\n") |
781 | + "[hwpack]\nname = ahwpack\n" |
782 | + "include-debs = if you don't mind\n") |
783 | self.assertValidationError( |
784 | "Invalid value for include-debs: Not a boolean: if you don't mind", |
785 | config) |
786 | |
787 | def test_validate_invalid_supported(self): |
788 | config = self.get_config( |
789 | - "[hwpack]\nname = ahwpack\nsupport = if you pay us\n") |
790 | + "[hwpack]\nname = ahwpack\nsupport = if you pay us\n") |
791 | self.assertValidationError( |
792 | "Invalid value for support: if you pay us", config) |
793 | |
794 | def test_validate_no_packages(self): |
795 | config = self.get_config( |
796 | - "[hwpack]\nname = ahwpack\n\n") |
797 | + "[hwpack]\nname = ahwpack\n\n") |
798 | self.assertValidationError( |
799 | "No packages in the [hwpack] section", config) |
800 | |
801 | def test_validate_empty_packages(self): |
802 | config = self.get_config( |
803 | - "[hwpack]\nname = ahwpack\npackages = \n") |
804 | + "[hwpack]\nname = ahwpack\npackages = \n") |
805 | self.assertValidationError( |
806 | "No packages in the [hwpack] section", config) |
807 | |
808 | def test_validate_invalid_package_name(self): |
809 | config = self.get_config( |
810 | - "[hwpack]\nname = ahwpack\npackages = foo ~~ bar\n") |
811 | + "[hwpack]\nname = ahwpack\npackages = foo ~~ bar\n") |
812 | self.assertValidationError( |
813 | "Invalid value in packages in the [hwpack] section: ~~", |
814 | config) |
815 | |
816 | def test_validate_no_architectures(self): |
817 | config = self.get_config( |
818 | - "[hwpack]\nname = ahwpack\npackages = foo\n") |
819 | + "[hwpack]\nname = ahwpack\npackages = foo\n") |
820 | self.assertValidationError( |
821 | "No architectures in the [hwpack] section", config) |
822 | |
823 | def test_validate_empty_architectures(self): |
824 | config = self.get_config( |
825 | - "[hwpack]\nname = ahwpack\npackages = foo\n" |
826 | - "architectures = \n") |
827 | + "[hwpack]\nname = ahwpack\npackages = foo\n" |
828 | + "architectures = \n") |
829 | self.assertValidationError( |
830 | "No architectures in the [hwpack] section", config) |
831 | |
832 | def test_validate_invalid_package_name_in_assume_installed(self): |
833 | config = self.get_config( |
834 | - "[hwpack]\nname = ahwpack\npackages = foo\n" |
835 | - "architectures = armel\nassume-installed = bar ~~\n") |
836 | + "[hwpack]\nname = ahwpack\npackages = foo\n" |
837 | + "architectures = armel\nassume-installed = bar ~~\n") |
838 | self.assertValidationError( |
839 | "Invalid value in assume-installed in the [hwpack] section: ~~", |
840 | config) |
841 | @@ -151,48 +151,48 @@ |
842 | |
843 | def test_validate_other_section_empty_sources_entry(self): |
844 | config = self.get_config( |
845 | - self.valid_start + "\n[ubuntu]\nsources-entry = \n") |
846 | + self.valid_start + "\n[ubuntu]\nsources-entry = \n") |
847 | self.assertValidationError( |
848 | "The sources-entry in the [ubuntu] section is missing the URI", |
849 | config) |
850 | |
851 | def test_validate_other_section_only_uri_in_sources_entry(self): |
852 | config = self.get_config( |
853 | - self.valid_start + "\n[ubuntu]\nsources-entry = foo\n") |
854 | + self.valid_start + "\n[ubuntu]\nsources-entry = foo\n") |
855 | self.assertValidationError( |
856 | "The sources-entry in the [ubuntu] section is missing the " |
857 | "distribution", config) |
858 | |
859 | def test_validate_other_section_sources_entry_starting_with_deb(self): |
860 | config = self.get_config( |
861 | - self.valid_start |
862 | - + "\n[ubuntu]\nsources-entry = deb http://example.org/ " |
863 | - "foo main\n") |
864 | + self.valid_start |
865 | + + "\n[ubuntu]\nsources-entry = deb http://example.org/ " |
866 | + "foo main\n") |
867 | self.assertValidationError( |
868 | "The sources-entry in the [ubuntu] section shouldn't start " |
869 | "with 'deb'", config) |
870 | |
871 | def test_validate_other_section_sources_entry_starting_with_deb_src(self): |
872 | config = self.get_config( |
873 | - self.valid_start |
874 | - + "\n[ubuntu]\nsources-entry = deb-src http://example.org/ " |
875 | - "foo main\n") |
876 | + self.valid_start |
877 | + + "\n[ubuntu]\nsources-entry = deb-src http://example.org/ " |
878 | + "foo main\n") |
879 | self.assertValidationError( |
880 | "The sources-entry in the [ubuntu] section shouldn't start " |
881 | "with 'deb'", config) |
882 | |
883 | def test_validate_valid_config(self): |
884 | config = self.get_config( |
885 | - self.valid_start |
886 | - + "\n[ubuntu]\nsources-entry = foo bar\n") |
887 | + self.valid_start |
888 | + + "\n[ubuntu]\nsources-entry = foo bar\n") |
889 | self.assertEqual(None, config.validate()) |
890 | |
891 | def test_validate_valid_config_with_dash_in_package_name(self): |
892 | config = self.get_config( |
893 | - "[hwpack]\nname = ahwpack\n" |
894 | - "packages = u-boot\n" |
895 | - "architectures = armel\n\n" |
896 | - "[ubuntu]\nsources-entry = foo bar\n") |
897 | + "[hwpack]\nname = ahwpack\n" |
898 | + "packages = u-boot\n" |
899 | + "architectures = armel\n\n" |
900 | + "[ubuntu]\nsources-entry = foo bar\n") |
901 | self.assertEqual(None, config.validate()) |
902 | |
903 | def test_validate_supported_format(self): |
904 | @@ -202,91 +202,91 @@ |
905 | |
906 | def test_validate_invalid_u_boot_package_name(self): |
907 | config = self.get_config( |
908 | - self.valid_start_v2 + "u_boot_package = ~~\n") |
909 | + self.valid_start_v2 + "u_boot_package = ~~\n") |
910 | self.assertValidationError( |
911 | "Invalid value in u_boot_package in the [hwpack] section: ~~", |
912 | config) |
913 | |
914 | def test_validate_invalid_u_boot_file(self): |
915 | config = self.get_config(self.valid_start_v2 + |
916 | - "u_boot_package = u-boot-linaro-s5pv310\n" \ |
917 | - "u_boot_file = ~~\n") |
918 | + "u_boot_package = u-boot-linaro-s5pv310\n" |
919 | + "u_boot_file = ~~\n") |
920 | self.assertValidationError("Invalid path: ~~", config) |
921 | |
922 | def test_validate_invalid_kernel_file(self): |
923 | config = self.get_config(self.valid_start_v2 + |
924 | - "u-boot-package = u-boot-linaro-s5pv310\n" \ |
925 | - "u-boot-file = u-boot.bin\n" \ |
926 | - "partition_layout = bootfs_rootfs\n"\ |
927 | - "kernel_file = ~~\n") |
928 | + "u-boot-package = u-boot-linaro-s5pv310\n" |
929 | + "u-boot-file = u-boot.bin\n" |
930 | + "partition_layout = bootfs_rootfs\n" |
931 | + "kernel_file = ~~\n") |
932 | self.assertValidationError("Invalid path: ~~", config, |
933 | "_validate_vmlinuz") |
934 | |
935 | def test_validate_empty_kernel_file(self): |
936 | config = self.get_config(self.valid_start_v2 + |
937 | - "u-boot-package = u-boot-linaro-s5pv310\n" \ |
938 | - "u-boot-file = u-boot.bin\n" |
939 | - "partition_layout = bootfs_rootfs\n"\ |
940 | - "kernel_file = \n") |
941 | + "u-boot-package = u-boot-linaro-s5pv310\n" |
942 | + "u-boot-file = u-boot.bin\n" |
943 | + "partition_layout = bootfs_rootfs\n" |
944 | + "kernel_file = \n") |
945 | self.assertValidationError("No kernel_file in the [hwpack] section", |
946 | config, "_validate_vmlinuz") |
947 | |
948 | def test_validate_invalid_initrd_file(self): |
949 | config = self.get_config( |
950 | self.valid_start_v2 + |
951 | - "u-boot-package = u-boot-linaro-s5pv310\n" \ |
952 | - "u-boot-file = u-boot.bin\n" \ |
953 | - "partition_layout = bootfs_rootfs\n"\ |
954 | - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ |
955 | - "initrd_file = ~~\n") |
956 | + "u-boot-package = u-boot-linaro-s5pv310\n" |
957 | + "u-boot-file = u-boot.bin\n" |
958 | + "partition_layout = bootfs_rootfs\n" |
959 | + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n" |
960 | + "initrd_file = ~~\n") |
961 | self.assertValidationError("Invalid path: ~~", config, |
962 | "_validate_initrd") |
963 | |
964 | def test_validate_empty_initrd_file(self): |
965 | config = self.get_config( |
966 | self.valid_start_v2 + |
967 | - "u-boot-package = u-boot-linaro-s5pv310\n" \ |
968 | - "u-boot-file = u-boot.bin\n" |
969 | - "partition_layout = bootfs_rootfs\n"\ |
970 | - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ |
971 | - "initrd_file = \n") |
972 | + "u-boot-package = u-boot-linaro-s5pv310\n" |
973 | + "u-boot-file = u-boot.bin\n" |
974 | + "partition_layout = bootfs_rootfs\n" |
975 | + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n" |
976 | + "initrd_file = \n") |
977 | self.assertValidationError("No initrd_file in the [hwpack] section", |
978 | config, "_validate_initrd") |
979 | |
980 | def test_validate_invalid_boot_script(self): |
981 | config = self.get_config( |
982 | self.valid_start_v2 + |
983 | - "u-boot-package = u-boot-linaro-s5pv310\n" \ |
984 | - "mmc_id = 0:1\n"\ |
985 | - "u-boot-file = u-boot.bin\n" \ |
986 | - "partition_layout = bootfs_rootfs\n"\ |
987 | - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ |
988 | - "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ |
989 | - "u_boot_in_boot_part = No\n"\ |
990 | - "boot_script = ~~\n") |
991 | + "u-boot-package = u-boot-linaro-s5pv310\n" |
992 | + "mmc_id = 0:1\n" |
993 | + "u-boot-file = u-boot.bin\n" |
994 | + "partition_layout = bootfs_rootfs\n" |
995 | + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n" |
996 | + "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n" |
997 | + "u_boot_in_boot_part = No\n" |
998 | + "boot_script = ~~\n") |
999 | self.assertValidationError("Invalid path: ~~", config) |
1000 | |
1001 | def test_validate_invalid_dtb_file(self): |
1002 | config = self.get_config( |
1003 | self.valid_start_v2 + |
1004 | - "u-boot-package = u-boot-linaro-s5pv310\n" \ |
1005 | - "u-boot-file = u-boot.bin\n" \ |
1006 | - "partition_layout = bootfs_rootfs\n"\ |
1007 | - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ |
1008 | - "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ |
1009 | - "boot_script = boot.scr\n"\ |
1010 | - "u_boot_in_boot_part = No\n"\ |
1011 | - "mmc_id = 0:1\n"\ |
1012 | - "dtb_file = ~~\n") |
1013 | + "u-boot-package = u-boot-linaro-s5pv310\n" |
1014 | + "u-boot-file = u-boot.bin\n" |
1015 | + "partition_layout = bootfs_rootfs\n" |
1016 | + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n" |
1017 | + "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n" |
1018 | + "boot_script = boot.scr\n" |
1019 | + "u_boot_in_boot_part = No\n" |
1020 | + "mmc_id = 0:1\n" |
1021 | + "dtb_file = ~~\n") |
1022 | self.assertValidationError("Invalid path: ~~", config) |
1023 | |
1024 | def test_validate_invalid_spl_package_name(self): |
1025 | config = self.get_config( |
1026 | - self.valid_start_v2 + "u-boot-package = u-boot-linaro-s5pv310\n" \ |
1027 | - "u-boot-file = usr/bin/version/MLO\n" \ |
1028 | - "partition_layout = bootfs_rootfs\n"\ |
1029 | - "mmc_id = 0:1\n"\ |
1030 | - "spl_package = ~~\n") |
1031 | + self.valid_start_v2 + "u-boot-package = u-boot-linaro-s5pv310\n" |
1032 | + "u-boot-file = usr/bin/version/MLO\n" |
1033 | + "partition_layout = bootfs_rootfs\n" |
1034 | + "mmc_id = 0:1\n" |
1035 | + "spl_package = ~~\n") |
1036 | self.assertValidationError( |
1037 | "Invalid value in spl_package in the [hwpack] section: ~~", |
1038 | config) |
1039 | @@ -294,18 +294,18 @@ |
1040 | def test_validate_invalid_spl_file(self): |
1041 | config = self.get_config( |
1042 | self.valid_start_v2 + |
1043 | - "u-boot-package = u-boot-linaro-s5pv310\n" \ |
1044 | - "u-boot-file = usr/bin/version/MLO\n" \ |
1045 | - "partition_layout = bootfs_rootfs\n" \ |
1046 | - "spl_package = x-loader--linaro-s5pv310\n" \ |
1047 | - "spl_file = ~~\n") |
1048 | + "u-boot-package = u-boot-linaro-s5pv310\n" |
1049 | + "u-boot-file = usr/bin/version/MLO\n" |
1050 | + "partition_layout = bootfs_rootfs\n" |
1051 | + "spl_package = x-loader--linaro-s5pv310\n" |
1052 | + "spl_file = ~~\n") |
1053 | self.assertValidationError("Invalid path: ~~", config) |
1054 | |
1055 | def test_validate_partition_layout(self): |
1056 | partition_layout = 'apafs_bananfs' |
1057 | - config = self.get_config(self.valid_start_v2 + "u_boot_package = " \ |
1058 | - "u-boot-linaro-s5pv310\nu_boot_file = " \ |
1059 | - "u-boot.bin\npartition_layout = %s\n" % \ |
1060 | + config = self.get_config(self.valid_start_v2 + "u_boot_package = " |
1061 | + "u-boot-linaro-s5pv310\nu_boot_file = " |
1062 | + "u-boot.bin\npartition_layout = %s\n" % |
1063 | partition_layout) |
1064 | self.assertValidationError( |
1065 | "Undefined partition layout %s in the [%s] section. " |
1066 | @@ -323,43 +323,43 @@ |
1067 | def test_validate_u_boot_in_boot_part(self): |
1068 | config = self.get_config( |
1069 | self.valid_start_v2 + |
1070 | - "u-boot-package = u-boot-linaro-s5pv310\n" \ |
1071 | - "u-boot-file = u-boot.bin\n" \ |
1072 | - "partition_layout = bootfs_rootfs\n"\ |
1073 | - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ |
1074 | - "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ |
1075 | - "boot_script = boot.scr\n"\ |
1076 | - "mmc_id = 0:1\n"\ |
1077 | - "u_boot_in_boot_part = Nope\n") |
1078 | + "u-boot-package = u-boot-linaro-s5pv310\n" |
1079 | + "u-boot-file = u-boot.bin\n" |
1080 | + "partition_layout = bootfs_rootfs\n" |
1081 | + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n" |
1082 | + "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n" |
1083 | + "boot_script = boot.scr\n" |
1084 | + "mmc_id = 0:1\n" |
1085 | + "u_boot_in_boot_part = Nope\n") |
1086 | self.assertValidationError( |
1087 | "Invalid value for u_boot_in_boot_part: Nope", config) |
1088 | |
1089 | def test_validate_u_boot_in_boot_part_bool(self): |
1090 | config = self.get_config( |
1091 | self.valid_start_v2 + |
1092 | - "u-boot-package = u-boot-linaro-s5pv310\n" \ |
1093 | - "u-boot-file = u-boot.bin\n" \ |
1094 | - "partition_layout = bootfs_rootfs\n"\ |
1095 | - "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n"\ |
1096 | - "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n"\ |
1097 | - "boot_script = boot.scr\n"\ |
1098 | - "mmc_id = 0:1\n"\ |
1099 | - "u_boot_in_boot_part = True\n") |
1100 | + "u-boot-package = u-boot-linaro-s5pv310\n" |
1101 | + "u-boot-file = u-boot.bin\n" |
1102 | + "partition_layout = bootfs_rootfs\n" |
1103 | + "kernel_file = boot/vmlinuz-3.0.0-1002-linaro-omap\n" |
1104 | + "initrd_file = boot/initrd.img-3.0.0-1002-linaro-omap\n" |
1105 | + "boot_script = boot.scr\n" |
1106 | + "mmc_id = 0:1\n" |
1107 | + "u_boot_in_boot_part = True\n") |
1108 | self.assertValidationError( |
1109 | "Invalid value for u_boot_in_boot_part: True", config) |
1110 | |
1111 | def test_validate_serial_tty(self): |
1112 | config = self.get_config( |
1113 | self.valid_start_v2 + |
1114 | - "u_boot_package = u-boot-linaro-s5pv310\n" \ |
1115 | - "u_boot_file = u-boot.bin\nserial_tty=tty\n") |
1116 | + "u_boot_package = u-boot-linaro-s5pv310\n" |
1117 | + "u_boot_file = u-boot.bin\nserial_tty=tty\n") |
1118 | self.assertValidationError("Invalid serial tty: tty", config, |
1119 | "_validate_serial_tty") |
1120 | config = self.get_config( |
1121 | self.valid_start_v2 + |
1122 | - "u_boot_package = u-boot-linaro-s5pv310\n" \ |
1123 | - "u_boot_file = u-boot.bin\n" \ |
1124 | - "serial_tty=ttxSAC1\n") |
1125 | + "u_boot_package = u-boot-linaro-s5pv310\n" |
1126 | + "u_boot_file = u-boot.bin\n" |
1127 | + "serial_tty=ttxSAC1\n") |
1128 | self.assertValidationError("Invalid serial tty: ttxSAC1", config, |
1129 | "_validate_serial_tty") |
1130 | |
1131 | |
1132 | === modified file 'linaro_image_tools/hwpack/tests/test_config_v3.py' |
1133 | --- linaro_image_tools/hwpack/tests/test_config_v3.py 2013-01-10 13:17:57 +0000 |
1134 | +++ linaro_image_tools/hwpack/tests/test_config_v3.py 2013-02-18 14:17:36 +0000 |
1135 | @@ -41,32 +41,32 @@ |
1136 | "name: ahwpack\npackages: foo\narchitectures: armel\n") |
1137 | valid_start_v3 = valid_start + "format: 3.0\n" |
1138 | valid_complete_v3 = (valid_start_v3 + |
1139 | - "serial_tty: ttySAC1\n" |
1140 | - "partition_layout:\n" |
1141 | - " - bootfs_rootfs\n" |
1142 | - "boot_script: boot.scr\n" |
1143 | - "extra_serial_options:\n" |
1144 | - " - console=tty0\n" |
1145 | - " - console=ttyO2,115200n8\n" |
1146 | - "mmc_id: 0:1\n" |
1147 | - "kernel_file: boot/vmlinuz-*-linaro-omap\n" |
1148 | - "initrd_file: boot/initrd.img-*-linaro-omap\n" |
1149 | - "dtb_file: boot/dt-*-linaro-omap/omap4-panda.dtb\n" |
1150 | - "bootloaders:\n" |
1151 | - " u_boot:\n" |
1152 | - " package: u-boot-linaro-s5pv310\n" |
1153 | - " file: usr/lib/u-boot/smdkv310/u-boot.bin\n" |
1154 | - " spl_package: x-loader-omap4-panda\n" |
1155 | - " spl_file: usr/lib/x-loader/omap4430panda/MLO\n" |
1156 | - " in_boot_part: True\n" |
1157 | - " extra_boot_options:\n" |
1158 | - " - earlyprintk\n" |
1159 | - " - fixrtc\n" |
1160 | - " - nocompcache\n" |
1161 | - " - vram=48M\n" |
1162 | - " - omapfb.vram=0:24M\n" |
1163 | - " - mem=456M@0x80000000\n" |
1164 | - " - mem=512M@0xA0000000\n") |
1165 | + "serial_tty: ttySAC1\n" |
1166 | + "partition_layout:\n" |
1167 | + " - bootfs_rootfs\n" |
1168 | + "boot_script: boot.scr\n" |
1169 | + "extra_serial_options:\n" |
1170 | + " - console=tty0\n" |
1171 | + " - console=ttyO2,115200n8\n" |
1172 | + "mmc_id: 0:1\n" |
1173 | + "kernel_file: boot/vmlinuz-*-linaro-omap\n" |
1174 | + "initrd_file: boot/initrd.img-*-linaro-omap\n" |
1175 | + "dtb_file: boot/dt-*-linaro-omap/omap4-panda.dtb\n" |
1176 | + "bootloaders:\n" |
1177 | + " u_boot:\n" |
1178 | + " package: u-boot-linaro-s5pv310\n" |
1179 | + " file: usr/lib/u-boot/smdkv310/u-boot.bin\n" |
1180 | + " spl_package: x-loader-omap4-panda\n" |
1181 | + " spl_file: usr/lib/x-loader/omap4430panda/MLO\n" |
1182 | + " in_boot_part: True\n" |
1183 | + " extra_boot_options:\n" |
1184 | + " - earlyprintk\n" |
1185 | + " - fixrtc\n" |
1186 | + " - nocompcache\n" |
1187 | + " - vram=48M\n" |
1188 | + " - omapfb.vram=0:24M\n" |
1189 | + " - mem=456M@0x80000000\n" |
1190 | + " - mem=512M@0xA0000000\n") |
1191 | valid_end = "sources:\n sources-entry: foo bar\n" |
1192 | |
1193 | def test_create(self): |
1194 | @@ -97,64 +97,64 @@ |
1195 | |
1196 | def test_validate_invalid_include_debs(self): |
1197 | config = self.get_config( |
1198 | - "name: ahwpack\n" |
1199 | - "include_debs: if you don't mind\n") |
1200 | + "name: ahwpack\n" |
1201 | + "include_debs: if you don't mind\n") |
1202 | self.assertValidationError( |
1203 | "Invalid value for include-debs: if you don't mind", |
1204 | config._validate_include_debs) |
1205 | |
1206 | def test_validate_invalid_supported(self): |
1207 | config = self.get_config( |
1208 | - "name: ahwpack\nsupport: if you pay us\n") |
1209 | + "name: ahwpack\nsupport: if you pay us\n") |
1210 | self.assertValidationError( |
1211 | "Invalid value for support: if you pay us", |
1212 | config._validate_support) |
1213 | |
1214 | def test_validate_no_packages(self): |
1215 | config = self.get_config( |
1216 | - "name: ahwpack\n\n") |
1217 | + "name: ahwpack\n\n") |
1218 | self.assertValidationError( |
1219 | "No packages found in the metadata", config._validate_packages) |
1220 | |
1221 | def test_validate_empty_packages(self): |
1222 | config = self.get_config( |
1223 | - "name: ahwpack\npackages: \n") |
1224 | + "name: ahwpack\npackages: \n") |
1225 | self.assertValidationError( |
1226 | "No packages found in the metadata", config._validate_packages) |
1227 | |
1228 | def test_validate_invalid_package_name(self): |
1229 | config = self.get_config( |
1230 | - "name: ahwpack\npackages: foo ~~ bar\n") |
1231 | + "name: ahwpack\npackages: foo ~~ bar\n") |
1232 | self.assertValidationError( |
1233 | "Invalid value in packages in the metadata: ~~", |
1234 | config._validate_packages) |
1235 | |
1236 | def test_validate_no_architectures(self): |
1237 | config = self.get_config( |
1238 | - "name: ahwpack\npackages: foo\n") |
1239 | + "name: ahwpack\npackages: foo\n") |
1240 | self.assertValidationError( |
1241 | "No architectures found in the metadata", |
1242 | config._validate_architectures) |
1243 | |
1244 | def test_validate_empty_architectures(self): |
1245 | config = self.get_config( |
1246 | - "name: ahwpack\npackages: foo\n" |
1247 | - "architectures: \n") |
1248 | + "name: ahwpack\npackages: foo\n" |
1249 | + "architectures: \n") |
1250 | self.assertValidationError( |
1251 | "No architectures found in the metadata", |
1252 | config._validate_architectures) |
1253 | |
1254 | def test_validate_invalid_package_name_in_assume_installed(self): |
1255 | config = self.get_config( |
1256 | - "name: ahwpack\npackages: foo\n" |
1257 | - "architectures: armel\nassume_installed:\n - bar\n - ~~\n") |
1258 | + "name: ahwpack\npackages: foo\n" |
1259 | + "architectures: armel\nassume_installed:\n - bar\n - ~~\n") |
1260 | self.assertValidationError( |
1261 | "Invalid value in assume-installed in the metadata: ~~", |
1262 | config._validate_assume_installed) |
1263 | |
1264 | def test_validate_other_section_empty_sources_entry(self): |
1265 | config = self.get_config( |
1266 | - self.valid_start + "sources:\n ubuntu: \n") |
1267 | + self.valid_start + "sources:\n ubuntu: \n") |
1268 | self.assertValidationError( |
1269 | "The sources-entry, ubuntu is missing the URI", |
1270 | config._validate_sources) |
1271 | @@ -167,14 +167,16 @@ |
1272 | config._validate_sources) |
1273 | |
1274 | def test_validate_other_section_sources_entry_starting_with_deb(self): |
1275 | - config = self.get_config(self.valid_start + |
1276 | - "sources:\n ubuntu: deb http://example.org/ foo main\n") |
1277 | + config = self.get_config( |
1278 | + self.valid_start + |
1279 | + "sources:\n ubuntu: deb http://example.org/ foo main\n") |
1280 | self.assertValidationError( |
1281 | "The sources-entry, ubuntu shouldn't start with 'deb'", |
1282 | config._validate_sources) |
1283 | |
1284 | def test_validate_other_section_sources_entry_starting_with_deb_src(self): |
1285 | - config = self.get_config(self.valid_start + |
1286 | + config = self.get_config( |
1287 | + self.valid_start + |
1288 | "sources:\n ubuntu: deb-src http://example.org/ foo main\n") |
1289 | self.assertValidationError( |
1290 | "The sources-entry, ubuntu shouldn't start with 'deb'", |
1291 | |
1292 | === modified file 'linaro_image_tools/hwpack/tests/test_hardwarepack.py' |
1293 | --- linaro_image_tools/hwpack/tests/test_hardwarepack.py 2013-01-03 10:40:12 +0000 |
1294 | +++ linaro_image_tools/hwpack/tests/test_hardwarepack.py 2013-02-18 14:17:36 +0000 |
1295 | @@ -36,12 +36,12 @@ |
1296 | MatchesPackageRelationshipList, |
1297 | MatchesStructure, |
1298 | Not, |
1299 | - ) |
1300 | +) |
1301 | from linaro_image_tools.hwpack.hardwarepack_format import ( |
1302 | HardwarePackFormatV1, |
1303 | HardwarePackFormatV2, |
1304 | HardwarePackFormatV3, |
1305 | - ) |
1306 | +) |
1307 | |
1308 | |
1309 | class MetadataTests(TestCase): |
1310 | @@ -287,7 +287,7 @@ |
1311 | |
1312 | def test_format(self): |
1313 | metadata = Metadata("ahwpack", "4", "armel", |
1314 | - format=HardwarePackFormatV3()) |
1315 | + format=HardwarePackFormatV3()) |
1316 | # Need to call also this one! |
1317 | metadata.add_v2_config() |
1318 | metadata.add_v3_config(bootloaders=None) |
1319 | @@ -298,7 +298,7 @@ |
1320 | def test_section_bootloaders(self): |
1321 | bootloaders = {'u_boot': {'file': 'a_file'}} |
1322 | metadata = Metadata("ahwpack", "4", "armel", |
1323 | - format=HardwarePackFormatV3()) |
1324 | + format=HardwarePackFormatV3()) |
1325 | # Need to call also this one! |
1326 | metadata.add_v2_config() |
1327 | metadata.add_v3_config(bootloaders=bootloaders) |
1328 | @@ -309,7 +309,7 @@ |
1329 | |
1330 | def test_section_wireless(self): |
1331 | metadata = Metadata("ahwpack", "4", "armel", |
1332 | - format=HardwarePackFormatV3()) |
1333 | + format=HardwarePackFormatV3()) |
1334 | wireless_list = ['wlan0', 'wl0'] |
1335 | # Need to call also this one! |
1336 | metadata.add_v2_config(wireless_interfaces=wireless_list) |
1337 | @@ -321,7 +321,7 @@ |
1338 | |
1339 | def test_section_wired(self): |
1340 | metadata = Metadata("ahwpack", "4", "armel", |
1341 | - format=HardwarePackFormatV3()) |
1342 | + format=HardwarePackFormatV3()) |
1343 | wired_list = ['eth0', 'usb0'] |
1344 | # Need to call also this one! |
1345 | metadata.add_v2_config(wired_interfaces=wired_list) |
1346 | @@ -332,7 +332,7 @@ |
1347 | |
1348 | def test_section_extra_serial_options(self): |
1349 | metadata = Metadata("ahwpack", "4", "armel", |
1350 | - format=HardwarePackFormatV3()) |
1351 | + format=HardwarePackFormatV3()) |
1352 | options = ['option1', 'option2,option3'] |
1353 | # Need to call also this one! |
1354 | metadata.add_v2_config(extra_serial_options=options) |
1355 | @@ -388,7 +388,7 @@ |
1356 | self.assertThat( |
1357 | tf, |
1358 | HardwarePackHasFile("FORMAT", |
1359 | - content=hwpack.format.__str__() + "\n")) |
1360 | + content=hwpack.format.__str__() + "\n")) |
1361 | |
1362 | def test_creates_metadata_file(self): |
1363 | metadata = Metadata( |
1364 | @@ -432,7 +432,7 @@ |
1365 | self.assertThat( |
1366 | tf, |
1367 | HardwarePackHasFile("pkgs/%s" % package.filename, |
1368 | - content=package.content.read())) |
1369 | + content=package.content.read())) |
1370 | |
1371 | def test_adds_multiple_packages_at_once(self): |
1372 | package1 = DummyFetchedPackage("foo", "1.1") |
1373 | @@ -443,11 +443,11 @@ |
1374 | self.assertThat( |
1375 | tf, |
1376 | HardwarePackHasFile("pkgs/%s" % package1.filename, |
1377 | - content=package1.content.read())) |
1378 | + content=package1.content.read())) |
1379 | self.assertThat( |
1380 | tf, |
1381 | HardwarePackHasFile("pkgs/%s" % package2.filename, |
1382 | - content=package2.content.read())) |
1383 | + content=package2.content.read())) |
1384 | |
1385 | def test_adds_multiple_in_multiple_steps(self): |
1386 | package1 = DummyFetchedPackage("foo", "1.1") |
1387 | @@ -459,11 +459,11 @@ |
1388 | self.assertThat( |
1389 | tf, |
1390 | HardwarePackHasFile("pkgs/%s" % package1.filename, |
1391 | - content=package1.content.read())) |
1392 | + content=package1.content.read())) |
1393 | self.assertThat( |
1394 | tf, |
1395 | HardwarePackHasFile("pkgs/%s" % package2.filename, |
1396 | - content=package2.content.read())) |
1397 | + content=package2.content.read())) |
1398 | |
1399 | def test_add_packages_without_content_leaves_out_debs(self): |
1400 | package1 = DummyFetchedPackage("foo", "1.1", no_content=True) |
1401 | @@ -582,7 +582,7 @@ |
1402 | tf = self.get_tarfile(hwpack) |
1403 | self.assertThat( |
1404 | tf, HardwarePackHasFile("sources.list.d/ubuntu.list", |
1405 | - content="deb " + source + "\n")) |
1406 | + content="deb " + source + "\n")) |
1407 | |
1408 | def test_adds_multiple_sources_list_files(self): |
1409 | hwpack = HardwarePack(self.metadata) |
1410 | @@ -592,10 +592,10 @@ |
1411 | tf = self.get_tarfile(hwpack) |
1412 | self.assertThat( |
1413 | tf, HardwarePackHasFile("sources.list.d/ubuntu.list", |
1414 | - content="deb " + source1 + "\n")) |
1415 | + content="deb " + source1 + "\n")) |
1416 | self.assertThat( |
1417 | tf, HardwarePackHasFile("sources.list.d/linaro.list", |
1418 | - content="deb " + source2 + "\n")) |
1419 | + content="deb " + source2 + "\n")) |
1420 | |
1421 | def test_overwrites_sources_list_file(self): |
1422 | hwpack = HardwarePack(self.metadata) |
1423 | @@ -606,7 +606,7 @@ |
1424 | tf = self.get_tarfile(hwpack) |
1425 | self.assertThat( |
1426 | tf, HardwarePackHasFile("sources.list.d/ubuntu.list", |
1427 | - content="deb " + new_source + "\n")) |
1428 | + content="deb " + new_source + "\n")) |
1429 | |
1430 | def test_creates_sources_list_gpg_dir(self): |
1431 | hwpack = HardwarePack(self.metadata) |
1432 | |
1433 | === modified file 'linaro_image_tools/hwpack/tests/test_hwpack_converter.py' |
1434 | --- linaro_image_tools/hwpack/tests/test_hwpack_converter.py 2012-12-27 10:29:42 +0000 |
1435 | +++ linaro_image_tools/hwpack/tests/test_hwpack_converter.py 2013-02-18 14:17:36 +0000 |
1436 | @@ -24,13 +24,13 @@ |
1437 | from linaro_image_tools.tests.fixtures import ( |
1438 | CreateTempDirFixture, |
1439 | CreateTempFileFixture, |
1440 | - ) |
1441 | +) |
1442 | |
1443 | from linaro_image_tools.hwpack.hwpack_convert import ( |
1444 | HwpackConverter, |
1445 | HwpackConverterException, |
1446 | check_and_validate_args, |
1447 | - ) |
1448 | +) |
1449 | |
1450 | |
1451 | class Args(): |
1452 | @@ -71,8 +71,8 @@ |
1453 | def test_basic_parse(self): |
1454 | ini_format = '[hwpack]\nformat=2.0\nsupport=supported' |
1455 | output_format = "format: '3.0'\nsupport: supported\n" |
1456 | - input_file = self.useFixture(CreateTempFileFixture(ini_format)).\ |
1457 | - get_file_name() |
1458 | + input_file = self.useFixture( |
1459 | + CreateTempFileFixture(ini_format)).get_file_name() |
1460 | output_file = self.useFixture(CreateTempFileFixture()).get_file_name() |
1461 | converter = HwpackConverter(input_file, output_file) |
1462 | converter._parse() |
1463 | @@ -84,8 +84,8 @@ |
1464 | """ |
1465 | ini_format = '[hwpack]\nformat=2.0\narchitectures=armhf armel' |
1466 | output_format = "format: '3.0'\narchitectures:\n- armhf\n- armel\n" |
1467 | - input_file = self.useFixture(CreateTempFileFixture(ini_format)).\ |
1468 | - get_file_name() |
1469 | + input_file = self.useFixture( |
1470 | + CreateTempFileFixture(ini_format)).get_file_name() |
1471 | output_file = self.useFixture(CreateTempFileFixture()).get_file_name() |
1472 | converter = HwpackConverter(input_file, output_file) |
1473 | converter._parse() |
1474 | @@ -94,13 +94,13 @@ |
1475 | def test_bootloaders(self): |
1476 | """Tests the correct creation of the bootloaders part.""" |
1477 | ini_format = ("[hwpack]\nformat=2.0\nu_boot_package=a_package\n" |
1478 | - "u_boot_file=a_file\nu_boot_in_boot_part=Yes\n" |
1479 | - "u_boot_dd=33") |
1480 | + "u_boot_file=a_file\nu_boot_in_boot_part=Yes\n" |
1481 | + "u_boot_dd=33") |
1482 | out_format = ("format: '3.0'\nbootloaders:\n u_boot:\n dd: '33'" |
1483 | - "\n file: a_file\n in_boot_part: true\n" |
1484 | - " package: a_package\n") |
1485 | - input_file = self.useFixture(CreateTempFileFixture(ini_format)).\ |
1486 | - get_file_name() |
1487 | + "\n file: a_file\n in_boot_part: true\n" |
1488 | + " package: a_package\n") |
1489 | + input_file = self.useFixture( |
1490 | + CreateTempFileFixture(ini_format)).get_file_name() |
1491 | output_file = self.useFixture(CreateTempFileFixture()).get_file_name() |
1492 | converter = HwpackConverter(input_file, output_file) |
1493 | converter._parse() |
1494 | @@ -109,12 +109,12 @@ |
1495 | def test_extra_boot_options(self): |
1496 | """Tests the correct creation of the extra_boot_options part.""" |
1497 | ini_format = ("[hwpack]\nformat=2.0\nu_boot_package=a_package\n" |
1498 | - "extra_boot_options=opt1 opt2") |
1499 | + "extra_boot_options=opt1 opt2") |
1500 | out_format = ("format: '3.0'\nbootloaders:\n u_boot:\n " |
1501 | - " extra_boot_options:\n - opt1\n " |
1502 | - "- opt2\n package: a_package\n") |
1503 | - input_file = self.useFixture(CreateTempFileFixture(ini_format)).\ |
1504 | - get_file_name() |
1505 | + " extra_boot_options:\n - opt1\n " |
1506 | + "- opt2\n package: a_package\n") |
1507 | + input_file = self.useFixture( |
1508 | + CreateTempFileFixture(ini_format)).get_file_name() |
1509 | output_file = self.useFixture(CreateTempFileFixture()).get_file_name() |
1510 | converter = HwpackConverter(input_file, output_file) |
1511 | converter._parse() |
1512 | @@ -124,8 +124,8 @@ |
1513 | """Tests the correct creation of the extra_serial_options part.""" |
1514 | ini_format = ("[hwpack]\nformat=2.0\nextra_serial_options=opt1 opt2") |
1515 | out_format = ("format: '3.0'\nextra_serial_options:\n- opt1\n- opt2\n") |
1516 | - input_file = self.useFixture(CreateTempFileFixture(ini_format)).\ |
1517 | - get_file_name() |
1518 | + input_file = self.useFixture( |
1519 | + CreateTempFileFixture(ini_format)).get_file_name() |
1520 | output_file = self.useFixture(CreateTempFileFixture()).get_file_name() |
1521 | converter = HwpackConverter(input_file, output_file) |
1522 | converter._parse() |
1523 | @@ -134,11 +134,11 @@ |
1524 | def test_assume_installed(self): |
1525 | """Tests the correct creation of the extra_serial_options part.""" |
1526 | ini_format = ("[hwpack]\nformat=2.0\nassume-installed=install1 " |
1527 | - "install2") |
1528 | + "install2") |
1529 | out_format = ("format: '3.0'\nassume_installed:\n- install1\n- " |
1530 | - "install2\n") |
1531 | - input_file = self.useFixture(CreateTempFileFixture(ini_format)).\ |
1532 | - get_file_name() |
1533 | + "install2\n") |
1534 | + input_file = self.useFixture( |
1535 | + CreateTempFileFixture(ini_format)).get_file_name() |
1536 | output_file = self.useFixture(CreateTempFileFixture()).get_file_name() |
1537 | converter = HwpackConverter(input_file, output_file) |
1538 | converter._parse() |
1539 | @@ -148,8 +148,8 @@ |
1540 | """Tests the correct creation of the extra_serial_options part.""" |
1541 | ini_format = ("[hwpack]\nformat=2.0\ninclude-debs=yes") |
1542 | out_format = ("format: '3.0'\ninclude_debs: true\n") |
1543 | - input_file = self.useFixture(CreateTempFileFixture(ini_format)).\ |
1544 | - get_file_name() |
1545 | + input_file = self.useFixture( |
1546 | + CreateTempFileFixture(ini_format)).get_file_name() |
1547 | output_file = self.useFixture(CreateTempFileFixture()).get_file_name() |
1548 | converter = HwpackConverter(input_file, output_file) |
1549 | converter._parse() |
1550 | @@ -160,8 +160,8 @@ |
1551 | ini_format = ("[hwpack]\nformat=2.0\ndtb_file=boot/a-*-path/file.dtb") |
1552 | out_format = ("format: '3.0'\ndtb_files:\n- board.dtb: " |
1553 | "boot/a-*-path/file.dtb\n") |
1554 | - input_file = self.useFixture(CreateTempFileFixture(ini_format)).\ |
1555 | - get_file_name() |
1556 | + input_file = self.useFixture( |
1557 | + CreateTempFileFixture(ini_format)).get_file_name() |
1558 | output_file = self.useFixture(CreateTempFileFixture()).get_file_name() |
1559 | converter = HwpackConverter(input_file, output_file) |
1560 | converter._parse() |
1561 | @@ -175,8 +175,8 @@ |
1562 | not a string.""" |
1563 | ini_format = ("[hwpack]\nformat=2.0\nmmc_id=1:1") |
1564 | out_format = ("format: '3.0'\nmmc_id: '1:1'\n") |
1565 | - input_file = self.useFixture(CreateTempFileFixture(ini_format)).\ |
1566 | - get_file_name() |
1567 | + input_file = self.useFixture( |
1568 | + CreateTempFileFixture(ini_format)).get_file_name() |
1569 | output_file = self.useFixture(CreateTempFileFixture()).get_file_name() |
1570 | converter = HwpackConverter(input_file, output_file) |
1571 | converter._parse() |
1572 | |
1573 | === modified file 'linaro_image_tools/hwpack/tests/test_hwpack_reader.py' |
1574 | --- linaro_image_tools/hwpack/tests/test_hwpack_reader.py 2012-07-25 13:05:16 +0000 |
1575 | +++ linaro_image_tools/hwpack/tests/test_hwpack_reader.py 2013-02-18 14:17:36 +0000 |
1576 | @@ -22,17 +22,17 @@ |
1577 | from linaro_image_tools.testing import TestCaseWithFixtures |
1578 | from linaro_image_tools.tests.fixtures import ( |
1579 | CreateTempDirFixture, |
1580 | - ) |
1581 | +) |
1582 | |
1583 | from linaro_image_tools.media_create.tests.fixtures import ( |
1584 | CreateTarballFixture, |
1585 | - ) |
1586 | +) |
1587 | |
1588 | from linaro_image_tools.hwpack.hwpack_reader import ( |
1589 | Hwpack, |
1590 | HwpackReader, |
1591 | HwpackReaderError, |
1592 | - ) |
1593 | +) |
1594 | |
1595 | |
1596 | class HwpackReaderTests(TestCaseWithFixtures): |
1597 | @@ -41,13 +41,13 @@ |
1598 | def setUp(self): |
1599 | super(HwpackReaderTests, self).setUp() |
1600 | self.metadata = ("format: 3.0\nversion: '1'\nname: test-hwpack\n" |
1601 | - "architecture: armel\norigin: Linaro") |
1602 | + "architecture: armel\norigin: Linaro") |
1603 | self.hwpack = Hwpack() |
1604 | self.hwpack.setname('test-hwpack') |
1605 | self.tar_dir_fixture = CreateTempDirFixture() |
1606 | self.useFixture(self.tar_dir_fixture) |
1607 | self.tarball_fixture = CreateTarballFixture( |
1608 | - self.tar_dir_fixture.get_temp_dir()) |
1609 | + self.tar_dir_fixture.get_temp_dir()) |
1610 | self.useFixture(self.tarball_fixture) |
1611 | |
1612 | def tearDown(self): |
1613 | @@ -104,11 +104,11 @@ |
1614 | |
1615 | def test_hwpack_metadata_read_with_bootloaders(self): |
1616 | self.metadata += ("\nboards:\n panda:\n support: supported\n " |
1617 | - "bootloaders:\n u_boot:\n file: a_file\n") |
1618 | + "bootloaders:\n u_boot:\n file: a_file\n") |
1619 | tarball = self.add_to_tarball([('metadata', self.metadata)]) |
1620 | reader = HwpackReader([tarball]) |
1621 | reader._read_hwpacks_metadata() |
1622 | self.hwpack.sethwpack(tarball) |
1623 | self.hwpack.setboards({'panda': {'support': 'supported', 'bootloaders': |
1624 | - {'u_boot': {'file': 'a_file'}}}}) |
1625 | + {'u_boot': {'file': 'a_file'}}}}) |
1626 | self.assertEqual(self.hwpack, reader.supported_elements[0]) |
1627 | |
1628 | === modified file 'linaro_image_tools/hwpack/tests/test_packages.py' |
1629 | --- linaro_image_tools/hwpack/tests/test_packages.py 2012-06-13 14:53:32 +0000 |
1630 | +++ linaro_image_tools/hwpack/tests/test_packages.py 2013-02-18 14:17:36 +0000 |
1631 | @@ -44,13 +44,13 @@ |
1632 | PackageMaker, |
1633 | stringify_relationship, |
1634 | TemporaryDirectoryManager, |
1635 | - ) |
1636 | +) |
1637 | from linaro_image_tools.hwpack.testing import ( |
1638 | AptSourceFixture, |
1639 | ContextManagerFixture, |
1640 | DummyFetchedPackage, |
1641 | MatchesPackage, |
1642 | - ) |
1643 | +) |
1644 | from linaro_image_tools.testing import TestCaseWithFixtures |
1645 | |
1646 | |
1647 | @@ -65,11 +65,10 @@ |
1648 | Size: %(size)d |
1649 | Architecture: armel |
1650 | MD5sum: %(md5)s |
1651 | - \n""" % { |
1652 | - 'filename': package.filename, |
1653 | - 'size': package.size, |
1654 | - 'md5': package.md5, |
1655 | - }), get_packages_file([package])) |
1656 | + \n""" % {'filename': package.filename, |
1657 | + 'size': package.size, |
1658 | + 'md5': package.md5, |
1659 | + }), get_packages_file([package])) |
1660 | |
1661 | def test_two_stanzas(self): |
1662 | package1 = DummyFetchedPackage("foo", "1.1") |
1663 | @@ -88,7 +87,7 @@ |
1664 | """ % { |
1665 | 'filename': package.filename, |
1666 | 'size': package.size, |
1667 | - }) |
1668 | + }) |
1669 | stanza += relationships |
1670 | stanza += "MD5sum: %s\n\n" % package.md5 |
1671 | return stanza |
1672 | @@ -145,11 +144,11 @@ |
1673 | Size: %(size)d |
1674 | Architecture: all |
1675 | MD5sum: %(md5)s |
1676 | - \n""" % { |
1677 | - 'filename': package.filename, |
1678 | - 'size': package.size, |
1679 | - 'md5': package.md5, |
1680 | - }), get_packages_file([package], extra_text="Status: bar")) |
1681 | + \n""" % {'filename': package.filename, |
1682 | + 'size': package.size, |
1683 | + 'md5': package.md5, |
1684 | + }), get_packages_file([package], |
1685 | + extra_text="Status: bar")) |
1686 | |
1687 | |
1688 | class StringifyRelationshipTests(TestCaseWithFixtures): |
1689 | @@ -404,7 +403,7 @@ |
1690 | 'Provides': 'bar, baz (= 1.0)', |
1691 | 'Replaces': 'bar, baz (>= 1.0)', |
1692 | 'Breaks': 'bar, baz (>= 1.0)', |
1693 | - }) |
1694 | + }) |
1695 | |
1696 | def test_unknown_field_name_fails(self): |
1697 | maker = PackageMaker() |
1698 | @@ -706,7 +705,7 @@ |
1699 | self.assertEqual(target_package, created_package) |
1700 | |
1701 | def create_package_and_assert_from_apt_translates_relationship( |
1702 | - self, relationship): |
1703 | + self, relationship): |
1704 | kwargs = {} |
1705 | kwargs[relationship] = "bar | baz (>= 1.0), zap" |
1706 | target_package = DummyFetchedPackage("foo", "1.0", **kwargs) |
1707 | @@ -771,7 +770,7 @@ |
1708 | self.assertEqual(target_package, created_package) |
1709 | |
1710 | def create_package_and_assert_from_deb_translates_relationships( |
1711 | - self, relationships): |
1712 | + self, relationships): |
1713 | maker = PackageMaker() |
1714 | self.useFixture(ContextManagerFixture(maker)) |
1715 | deb_file_path = maker.make_package('foo', '1.0', relationships) |
1716 | |
1717 | === modified file 'linaro_image_tools/hwpack/tests/test_script.py' |
1718 | --- linaro_image_tools/hwpack/tests/test_script.py 2013-01-10 13:17:57 +0000 |
1719 | +++ linaro_image_tools/hwpack/tests/test_script.py 2013-02-18 14:17:36 +0000 |
1720 | @@ -30,7 +30,7 @@ |
1721 | ConfigFileFixture, |
1722 | DummyFetchedPackage, |
1723 | IsHardwarePack, |
1724 | - ) |
1725 | +) |
1726 | from linaro_image_tools.hwpack.config import Config |
1727 | from linaro_image_tools.testing import TestCaseWithFixtures |
1728 | from linaro_image_tools.utils import find_command |
1729 | |
1730 | === modified file 'linaro_image_tools/hwpack/tests/test_tarfile_matchers.py' |
1731 | --- linaro_image_tools/hwpack/tests/test_tarfile_matchers.py 2012-06-13 14:26:02 +0000 |
1732 | +++ linaro_image_tools/hwpack/tests/test_tarfile_matchers.py 2013-02-18 14:17:36 +0000 |
1733 | @@ -27,7 +27,7 @@ |
1734 | TarfileHasFile, |
1735 | TarfileMissingPathMismatch, |
1736 | TarfileWrongValueMismatch, |
1737 | - ) |
1738 | +) |
1739 | from linaro_image_tools.hwpack.testing import test_tarfile |
1740 | |
1741 | |
1742 | @@ -182,7 +182,7 @@ |
1743 | |
1744 | def test_mismatches_wrong_uname(self): |
1745 | with test_tarfile( |
1746 | - contents=[("foo", "")], default_uname="someuser") as tf: |
1747 | + contents=[("foo", "")], default_uname="someuser") as tf: |
1748 | matcher = TarfileHasFile("foo", uname="otheruser") |
1749 | mismatch = matcher.match(tf) |
1750 | self.assertValueMismatch( |
1751 | @@ -190,7 +190,7 @@ |
1752 | |
1753 | def test_mismatches_wrong_gname(self): |
1754 | with test_tarfile( |
1755 | - contents=[("foo", "")], default_gname="somegroup") as tf: |
1756 | + contents=[("foo", "")], default_gname="somegroup") as tf: |
1757 | matcher = TarfileHasFile("foo", gname="othergroup") |
1758 | mismatch = matcher.match(tf) |
1759 | self.assertValueMismatch( |
1760 | |
1761 | === modified file 'linaro_image_tools/hwpack/tests/test_testing.py' |
1762 | --- linaro_image_tools/hwpack/tests/test_testing.py 2012-06-13 14:26:02 +0000 |
1763 | +++ linaro_image_tools/hwpack/tests/test_testing.py 2013-02-18 14:17:36 +0000 |
1764 | @@ -30,7 +30,7 @@ |
1765 | Equals, |
1766 | Mismatch, |
1767 | NotEquals, |
1768 | - ) |
1769 | +) |
1770 | from linaro_image_tools.hwpack.testing import ( |
1771 | DummyFetchedPackage, |
1772 | EachOf, |
1773 | @@ -40,10 +40,10 @@ |
1774 | MatchesStructure, |
1775 | MatchesSetwise, |
1776 | parse_packages_file_content, |
1777 | - ) |
1778 | +) |
1779 | from linaro_image_tools.hwpack.packages import ( |
1780 | get_packages_file, |
1781 | - ) |
1782 | +) |
1783 | |
1784 | |
1785 | def run_doctest(obj, name): |
1786 | @@ -117,7 +117,7 @@ |
1787 | observed = DummyFetchedPackage("foo", "1.1", depends="bar") |
1788 | expected = DummyFetchedPackage("foo", "1.1", depends="baz") |
1789 | self.assertRaises(AssertionError, self.assertThat, observed, |
1790 | - MatchesPackage(expected)) |
1791 | + MatchesPackage(expected)) |
1792 | |
1793 | def test_skip_one_attribute(self): |
1794 | observed = DummyFetchedPackage("foo", "1.1", depends="bar") |
1795 | |
1796 | === modified file 'linaro_image_tools/media_create/__init__.py' |
1797 | --- linaro_image_tools/media_create/__init__.py 2012-12-05 14:54:29 +0000 |
1798 | +++ linaro_image_tools/media_create/__init__.py 2013-02-18 14:17:36 +0000 |
1799 | @@ -98,7 +98,7 @@ |
1800 | parser.add_argument( |
1801 | '--read-hwpack', dest='readhwpack', action='store_true', |
1802 | help=('Read the hardware pack and print information about the ' |
1803 | - 'supported boards and bootloaders.')) |
1804 | + 'supported boards and bootloaders.')) |
1805 | parser.add_argument( |
1806 | '--dev', dest='dev', choices=KNOWN_BOARDS, |
1807 | help='Generate an SD card or image for the given board.') |
1808 | |
1809 | === modified file 'linaro_image_tools/media_create/android_boards.py' |
1810 | --- linaro_image_tools/media_create/android_boards.py 2013-01-07 12:40:41 +0000 |
1811 | +++ linaro_image_tools/media_create/android_boards.py 2013-02-18 14:17:36 +0000 |
1812 | @@ -51,7 +51,7 @@ |
1813 | align_up, |
1814 | install_mx5_boot_loader, |
1815 | make_boot_script, |
1816 | - ) |
1817 | +) |
1818 | from linaro_image_tools.utils import DEFAULT_LOGGER_NAME |
1819 | |
1820 | logger = logging.getLogger(DEFAULT_LOGGER_NAME) |
1821 | @@ -108,7 +108,7 @@ |
1822 | self._extra_serial_options = value |
1823 | |
1824 | extra_serial_options = property(_get_extra_serial_options, |
1825 | - _set_extra_serial_options) |
1826 | + _set_extra_serial_options) |
1827 | |
1828 | def _get_live_serial_options(self): |
1829 | serial_options = self._live_serial_options |
1830 | @@ -180,7 +180,7 @@ |
1831 | return ( |
1832 | "%(serial_options)s " |
1833 | "%(boot_args_options)s" |
1834 | - % replacements) |
1835 | + % replacements) |
1836 | |
1837 | def _get_boot_env(self, consoles): |
1838 | """Get the boot environment for this board. |
1839 | @@ -205,7 +205,7 @@ |
1840 | # TODO: Use partition_mounted() here to make sure the partition is |
1841 | # always umounted after we're done. |
1842 | cmd_runner.run(['mount', boot_partition, boot_disk], |
1843 | - as_root=True).wait() |
1844 | + as_root=True).wait() |
1845 | |
1846 | boot_env = self._get_boot_env(consoles) |
1847 | cmdline_filepath = os.path.join(boot_disk, "cmdline") |
1848 | @@ -260,13 +260,13 @@ |
1849 | # If extra_part is True an extra primary partition will be added. |
1850 | # Due to a maximum of 4 primary partitions cache data will be placed in |
1851 | # a extended partition |
1852 | - if extra_part == True: |
1853 | - assert start_addr > 0, ("Not possible to add extra partition" \ |
1854 | + if extra_part is True: |
1855 | + assert start_addr > 0, ("Not possible to add extra partition" |
1856 | "when boot partition starts at '0'") |
1857 | return '%s,%s,%s,*\n%s,%s,L\n%s,-,E\n%s,%s,L\n%s,%s,L\n%s,,,-' % ( |
1858 | - boot_start, boot_len, partition_type, system_start, _system_len, |
1859 | - cache_start, cache_start, _cache_len, userdata_start, |
1860 | - _userdata_len, sdcard_start) |
1861 | + boot_start, boot_len, partition_type, system_start, |
1862 | + _system_len, cache_start, cache_start, _cache_len, |
1863 | + userdata_start, _userdata_len, sdcard_start) |
1864 | |
1865 | return '%s,%s,%s,*\n%s,%s,L\n%s,%s,L\n%s,-,E\n%s,%s,L\n%s,,,-' % ( |
1866 | boot_start, boot_len, partition_type, system_start, _system_len, |
1867 | @@ -403,7 +403,7 @@ |
1868 | self._extra_serial_options = value |
1869 | |
1870 | extra_serial_options = property(_get_extra_serial_options, |
1871 | - _set_extra_serial_options) |
1872 | + _set_extra_serial_options) |
1873 | |
1874 | def _get_android_specific_args(self): |
1875 | android_args = self._android_specific_args |
1876 | @@ -452,7 +452,7 @@ |
1877 | class AndroidSamsungConfig(AndroidBoardConfig): |
1878 | def get_sfdisk_cmd(self, should_align_boot_part=False): |
1879 | loaders_min_len = (self.samsung_bl1_start + self.samsung_bl1_len + |
1880 | - self.samsung_bl2_len + self.samsung_env_len) |
1881 | + self.samsung_bl2_len + self.samsung_env_len) |
1882 | |
1883 | loader_start, loader_end, loader_len = align_partition( |
1884 | 1, loaders_min_len, 1, PART_ALIGN_S) |
1885 | @@ -515,7 +515,7 @@ |
1886 | 'snowball_sd': AndroidSnowballSdConfig, |
1887 | 'vexpress': AndroidVexpressConfig, |
1888 | 'vexpress-a9': AndroidVexpressConfig, |
1889 | - } |
1890 | +} |
1891 | |
1892 | |
1893 | def get_board_config(board): |
1894 | |
1895 | === modified file 'linaro_image_tools/media_create/boards.py' |
1896 | --- linaro_image_tools/media_create/boards.py 2013-01-14 14:56:31 +0000 |
1897 | +++ linaro_image_tools/media_create/boards.py 2013-02-18 14:17:36 +0000 |
1898 | @@ -42,7 +42,7 @@ |
1899 | SECTOR_SIZE, |
1900 | partition_mounted, |
1901 | register_loopback, |
1902 | - ) |
1903 | +) |
1904 | |
1905 | from linaro_image_tools.hwpack.hwpack_fields import ( |
1906 | BOOTFS, |
1907 | @@ -76,7 +76,7 @@ |
1908 | SPL_IN_BOOT_PART_FIELD, |
1909 | WIRED_INTERFACES_FIELD, |
1910 | WIRELESS_INTERFACES_FIELD, |
1911 | - ) |
1912 | +) |
1913 | |
1914 | logger = logging.getLogger(__name__) |
1915 | |
1916 | @@ -253,7 +253,7 @@ |
1917 | |
1918 | def set_metadata(self, hwpacks, bootloader=None, board=None): |
1919 | self.hardwarepack_handler = HardwarepackHandler(hwpacks, bootloader, |
1920 | - board) |
1921 | + board) |
1922 | with self.hardwarepack_handler: |
1923 | self.hwpack_format = self.hardwarepack_handler.get_format() |
1924 | if (self.hwpack_format == self.hardwarepack_handler.FORMAT_1): |
1925 | @@ -317,8 +317,8 @@ |
1926 | elif self.partition_layout == BOOTFS16: |
1927 | self.fat_size = 16 |
1928 | else: |
1929 | - raise AssertionError("Unknown partition layout '%s'." % \ |
1930 | - self.partition_layout) |
1931 | + raise AssertionError("Unknown partition layout '%s'." % |
1932 | + self.partition_layout) |
1933 | |
1934 | self.mmc_option = self.get_metadata_field(MMC_ID_FIELD) |
1935 | if self.mmc_option: |
1936 | @@ -329,11 +329,11 @@ |
1937 | boot_min_size = self.get_metadata_field(BOOT_MIN_SIZE_FIELD) |
1938 | if boot_min_size: |
1939 | self.BOOT_MIN_SIZE_S = align_up(int(boot_min_size) * 1024 ** 2, |
1940 | - SECTOR_SIZE) / SECTOR_SIZE |
1941 | + SECTOR_SIZE) / SECTOR_SIZE |
1942 | root_min_size = self.get_metadata_field(ROOT_MIN_SIZE_FIELD) |
1943 | if root_min_size: |
1944 | self.ROOT_MIN_SIZE_S = align_up(int(root_min_size) * 1024 ** 2, |
1945 | - SECTOR_SIZE) / SECTOR_SIZE |
1946 | + SECTOR_SIZE) / SECTOR_SIZE |
1947 | loader_min_size = self.get_metadata_field(LOADER_MIN_SIZE_FIELD) |
1948 | if loader_min_size: |
1949 | self.LOADER_MIN_SIZE_S = ( |
1950 | @@ -495,11 +495,11 @@ |
1951 | boot_end + 1, self.ROOT_MIN_SIZE_S, PART_ALIGN_S, PART_ALIGN_S) |
1952 | |
1953 | return '%s,%s,0xDA\n%s,%s,0x0C,*\n%s,,,-' % ( |
1954 | - loader_start, loader_len, boot_start, boot_len, root_start) |
1955 | + loader_start, loader_len, boot_start, boot_len, root_start) |
1956 | |
1957 | def get_sfdisk_cmd(self, should_align_boot_part=False): |
1958 | if (self.partition_layout in ['bootfs_rootfs', 'bootfs16_rootfs'] or |
1959 | - self.board == 'snowball_sd'): |
1960 | + self.board == 'snowball_sd'): |
1961 | return self.get_normal_sfdisk_cmd(should_align_boot_part) |
1962 | elif self.partition_layout in ['reserved_bootfs_rootfs']: |
1963 | return self.get_reserved_sfdisk_cmd(should_align_boot_part) |
1964 | @@ -523,8 +523,8 @@ |
1965 | "%(uimage_path)suImage; ")) % replacements |
1966 | if i_img_data is not None: |
1967 | boot_script += ( |
1968 | - ("%(fatload_command)s mmc %(mmc_option)s %(initrd_addr)s " + |
1969 | - "%(uimage_path)suInitrd; ")) % replacements |
1970 | + ("%(fatload_command)s mmc %(mmc_option)s %(initrd_addr)s " + |
1971 | + "%(uimage_path)suInitrd; ")) % replacements |
1972 | if d_img_data is not None: |
1973 | assert self.dtb_addr is not None, ( |
1974 | "Need a dtb_addr when passing d_img_data") |
1975 | @@ -604,7 +604,7 @@ |
1976 | (k_img_data, i_img_data, d_img_data) = self._get_kflavor_files( |
1977 | parts_dir) |
1978 | boot_env = self._get_boot_env(is_live, is_lowmem, consoles, rootfs_id, |
1979 | - i_img_data, d_img_data) |
1980 | + i_img_data, d_img_data) |
1981 | |
1982 | if self.hwpack_format == HardwarepackHandler.FORMAT_1: |
1983 | self._make_boot_files( |
1984 | @@ -664,22 +664,22 @@ |
1985 | assert from_file is not None, "No source file name given." |
1986 | if max_size is not None: |
1987 | assert os.path.getsize(from_file) <= max_size, ( |
1988 | - "'%s' is larger than %s" % (from_file, max_size)) |
1989 | + "'%s' is larger than %s" % (from_file, max_size)) |
1990 | logger.info("Writing '%s' to '%s' at %s." % (from_file, to_file, seek)) |
1991 | _dd(from_file, to_file, seek=seek) |
1992 | |
1993 | def install_samsung_boot_loader(self, samsung_spl_file, bootloader_file, |
1994 | boot_device_or_file): |
1995 | self._dd_file(samsung_spl_file, boot_device_or_file, |
1996 | - self.samsung_bl1_start, |
1997 | - self.samsung_bl1_len * SECTOR_SIZE) |
1998 | + self.samsung_bl1_start, |
1999 | + self.samsung_bl1_len * SECTOR_SIZE) |
2000 | self._dd_file(bootloader_file, boot_device_or_file, |
2001 | - self.samsung_bl2_start, |
2002 | - self.samsung_bl2_len * SECTOR_SIZE) |
2003 | + self.samsung_bl2_start, |
2004 | + self.samsung_bl2_len * SECTOR_SIZE) |
2005 | |
2006 | def _make_boot_files_v2(self, boot_env, chroot_dir, boot_dir, |
2007 | - boot_device_or_file, k_img_data, i_img_data, |
2008 | - d_img_data): |
2009 | + boot_device_or_file, k_img_data, i_img_data, |
2010 | + d_img_data): |
2011 | with self.hardwarepack_handler: |
2012 | spl_file = self.get_file('spl_file') |
2013 | if self.spl_in_boot_part: |
2014 | @@ -698,7 +698,7 @@ |
2015 | bootloader_file = self.get_file('bootloader_file') |
2016 | if self.bootloader_dd: |
2017 | self._dd_file(bootloader_file, boot_device_or_file, |
2018 | - self.bootloader_dd) |
2019 | + self.bootloader_dd) |
2020 | |
2021 | make_uImage(self.load_addr, k_img_data, boot_dir) |
2022 | |
2023 | @@ -716,7 +716,7 @@ |
2024 | make_boot_ini(boot_script_path, boot_dir) |
2025 | |
2026 | if (self.snowball_startup_files_config is not None and |
2027 | - self.board != 'snowball_sd'): |
2028 | + self.board != 'snowball_sd'): |
2029 | self.populate_raw_partition(boot_device_or_file, chroot_dir) |
2030 | |
2031 | if self.env_dd: |
2032 | @@ -727,7 +727,7 @@ |
2033 | env_size = self.samsung_env_len * SECTOR_SIZE |
2034 | env_file = make_flashable_env(boot_env, env_size) |
2035 | self._dd_file(env_file, boot_device_or_file, |
2036 | - self.samsung_env_start) |
2037 | + self.samsung_env_start) |
2038 | |
2039 | def _make_boot_files(self, boot_env, chroot_dir, boot_dir, |
2040 | boot_device_or_file, k_img_data, i_img_data, |
2041 | @@ -856,8 +856,8 @@ |
2042 | if not self.dtb_file or not dtb: |
2043 | logger.warn("Could not find a valid dtb file, skipping it.") |
2044 | |
2045 | - logger.info("Will use kernel=%s, initrd=%s, dtb=%s." % \ |
2046 | - (kernel, initrd, dtb)) |
2047 | + logger.info("Will use kernel=%s, initrd=%s, dtb=%s." % |
2048 | + (kernel, initrd, dtb)) |
2049 | return (kernel, initrd, dtb) |
2050 | |
2051 | def populate_raw_partition(self, media, boot_dir): |
2052 | @@ -1116,7 +1116,7 @@ |
2053 | boot_end + 1, self.ROOT_MIN_SIZE_S, PART_ALIGN_S, PART_ALIGN_S) |
2054 | |
2055 | return '%s,%s,0xDA\n%s,%s,0x0C,*\n%s,,,-' % ( |
2056 | - loader_start, loader_len, boot_start, boot_len, root_start) |
2057 | + loader_start, loader_len, boot_start, boot_len, root_start) |
2058 | |
2059 | def _make_boot_files(self, boot_env, chroot_dir, boot_dir, |
2060 | boot_device_or_file, k_img_data, i_img_data, |
2061 | @@ -1136,9 +1136,9 @@ |
2062 | with open(toc_filename, 'wb') as toc: |
2063 | self.create_toc(toc, new_files) |
2064 | self.install_snowball_boot_loader(toc_filename, new_files, |
2065 | - boot_device_or_file, |
2066 | - self.SNOWBALL_LOADER_START_S, |
2067 | - self.delete_startupfiles) |
2068 | + boot_device_or_file, |
2069 | + self.SNOWBALL_LOADER_START_S, |
2070 | + self.delete_startupfiles) |
2071 | self.delete_file(toc_filename) |
2072 | if self.delete_startupfiles: |
2073 | self.delete_file(os.path.join(config_files_dir, |
2074 | @@ -1285,7 +1285,8 @@ |
2075 | # XXX: delete this method when hwpacks V1 can die |
2076 | assert self.hwpack_format == HardwarepackHandler.FORMAT_1 |
2077 | with self.hardwarepack_handler: |
2078 | - bootloader_file = self.get_file('bootloader_file', |
2079 | + bootloader_file = self.get_file( |
2080 | + 'bootloader_file', |
2081 | default=os.path.join( |
2082 | chroot_dir, 'usr', 'lib', 'u-boot', self.bootloader_flavor, |
2083 | 'u-boot.imx')) |
2084 | @@ -1391,18 +1392,18 @@ |
2085 | return "" |
2086 | |
2087 | def _make_boot_files_v2(self, boot_env, chroot_dir, boot_dir, |
2088 | - boot_device_or_file, k_img_data, i_img_data, |
2089 | - d_img_data): |
2090 | + boot_device_or_file, k_img_data, i_img_data, |
2091 | + d_img_data): |
2092 | output_dir = os.path.dirname(boot_device_or_file) |
2093 | |
2094 | # There are 2 kinds of models now, VE and Foundation |
2095 | bw_ve = _get_file_matching("%s/boot/img.axf" % chroot_dir) |
2096 | bw_foundation = _get_file_matching("%s/boot/img-foundation.axf" % |
2097 | - chroot_dir) |
2098 | + chroot_dir) |
2099 | |
2100 | for filename in (bw_ve, bw_foundation, k_img_data, |
2101 | i_img_data, d_img_data): |
2102 | - if filename != None: |
2103 | + if filename is not None: |
2104 | copy_drop(filename, output_dir) |
2105 | |
2106 | |
2107 | @@ -1414,7 +1415,7 @@ |
2108 | def get_v1_sfdisk_cmd(self, should_align_boot_part=False): |
2109 | # bootloaders partition needs to hold BL1, U-Boot environment, and BL2 |
2110 | loaders_min_len = (self.samsung_bl1_start + self.samsung_bl1_len + |
2111 | - self.samsung_bl2_len + self.samsung_env_len) |
2112 | + self.samsung_bl2_len + self.samsung_env_len) |
2113 | |
2114 | # bootloaders partition |
2115 | loaders_start, loaders_end, loaders_len = align_partition( |
2116 | @@ -1439,7 +1440,8 @@ |
2117 | d_img_data): |
2118 | # XXX: delete this method when hwpacks V1 can die |
2119 | assert self.hwpack_format == HardwarepackHandler.FORMAT_1 |
2120 | - self.install_samsung_boot_loader(self._get_samsung_spl(chroot_dir), |
2121 | + self.install_samsung_boot_loader( |
2122 | + self._get_samsung_spl(chroot_dir), |
2123 | self._get_samsung_bootloader(chroot_dir), boot_device_or_file) |
2124 | env_size = self.samsung_env_len * SECTOR_SIZE |
2125 | env_file = make_flashable_env(boot_env, env_size) |
2126 | @@ -1503,12 +1505,12 @@ |
2127 | spl_file = os.path.join(chroot_dir, 'boot', 'u-boot-mmc-spl.bin') |
2128 | assert os.path.getsize(spl_file) <= ( |
2129 | self.samsung_bl1_len * SECTOR_SIZE), ( |
2130 | - "%s is larger than Samsung BL1 size" % spl_file) |
2131 | + "%s is larger than Samsung BL1 size" % spl_file) |
2132 | _dd(spl_file, boot_device_or_file, seek=self.samsung_bl1_start) |
2133 | uboot_file = os.path.join(chroot_dir, 'boot', 'u-boot.bin') |
2134 | assert os.path.getsize(uboot_file) <= ( |
2135 | self.samsung_bl2_len * SECTOR_SIZE), ( |
2136 | - "%s is larger than Samsung BL2 size" % uboot_file) |
2137 | + "%s is larger than Samsung BL2 size" % uboot_file) |
2138 | _dd(uboot_file, boot_device_or_file, seek=self.samsung_bl2_start) |
2139 | |
2140 | |
2141 | @@ -1683,21 +1685,25 @@ |
2142 | img_loop = register_loopback(boot_device_or_file, 0, img_size) |
2143 | |
2144 | # install bootloader |
2145 | - cmd_runner.run([self.BOOTLOADER_CMD, '--boot-directory=%s' % boot_dir, |
2146 | - '--modules', 'part_msdos', img_loop], |
2147 | - as_root=True).wait() |
2148 | + cmd_runner.run([self.BOOTLOADER_CMD, |
2149 | + '--boot-directory=%s' % boot_dir, |
2150 | + '--modules', 'part_msdos', img_loop], |
2151 | + as_root=True).wait() |
2152 | |
2153 | # generate loader config file |
2154 | loader_config = self.BOOTLOADER_CFG % (os.path.basename(k_img_data), |
2155 | - self.extra_serial_options, os.path.basename(i_img_data)) |
2156 | + self.extra_serial_options, |
2157 | + os.path.basename(i_img_data)) |
2158 | |
2159 | _, tmpfile = tempfile.mkstemp() |
2160 | atexit.register(os.unlink, tmpfile) |
2161 | with open(tmpfile, 'w') as fd: |
2162 | fd.write(loader_config) |
2163 | |
2164 | - cmd_runner.run(['cp', tmpfile, os.path.join(boot_dir, |
2165 | - self.BOOTLOADER_CFG_FILE)], as_root=True).wait() |
2166 | + cmd_runner.run(['cp', tmpfile, |
2167 | + os.path.join( |
2168 | + boot_dir, |
2169 | + self.BOOTLOADER_CFG_FILE)], as_root=True).wait() |
2170 | |
2171 | def _make_boot_files_v2(self, boot_env, chroot_dir, boot_dir, |
2172 | boot_device_or_file, k_img_data, i_img_data, |
2173 | @@ -1733,7 +1739,7 @@ |
2174 | 'ux500': Ux500Config, |
2175 | 'vexpress': VexpressConfig, |
2176 | 'vexpress-a9': VexpressA9Config, |
2177 | - } |
2178 | +} |
2179 | |
2180 | |
2181 | def get_board_config(board): |
2182 | |
2183 | === modified file 'linaro_image_tools/media_create/check_device.py' |
2184 | --- linaro_image_tools/media_create/check_device.py 2012-06-13 14:26:02 +0000 |
2185 | +++ linaro_image_tools/media_create/check_device.py 2013-02-18 14:17:36 +0000 |
2186 | @@ -111,8 +111,8 @@ |
2187 | |
2188 | |
2189 | def confirm_device_selection_and_ensure_it_is_ready( |
2190 | - device, |
2191 | - yes_to_mmc_selection=False): |
2192 | + device, |
2193 | + yes_to_mmc_selection=False): |
2194 | """Confirm this is the device to use and ensure it's ready. |
2195 | |
2196 | If the device exists, the user is asked to confirm that this is the |
2197 | |
2198 | === modified file 'linaro_image_tools/media_create/chroot_utils.py' |
2199 | --- linaro_image_tools/media_create/chroot_utils.py 2012-12-05 13:01:06 +0000 |
2200 | +++ linaro_image_tools/media_create/chroot_utils.py 2013-02-18 14:17:36 +0000 |
2201 | @@ -24,7 +24,7 @@ |
2202 | from linaro_image_tools.utils import ( |
2203 | is_arm_host, |
2204 | find_command, |
2205 | - ) |
2206 | +) |
2207 | from linaro_image_tools.hwpack.handler import HardwarepackHandler |
2208 | |
2209 | # It'd be nice if we could use atexit here, but all the things we need to undo |
2210 | @@ -45,8 +45,8 @@ |
2211 | |
2212 | |
2213 | def install_hwpacks( |
2214 | - rootfs_dir, tmp_dir, tools_dir, hwpack_force_yes, verified_files, |
2215 | - extract_kpkgs=False, *hwpack_files): |
2216 | + rootfs_dir, tmp_dir, tools_dir, hwpack_force_yes, verified_files, |
2217 | + extract_kpkgs=False, *hwpack_files): |
2218 | """Install the given hwpacks onto the given rootfs.""" |
2219 | |
2220 | # In case we just want to extract the kernel packages, don't force qemu |
2221 | |
2222 | === modified file 'linaro_image_tools/media_create/partitions.py' |
2223 | --- linaro_image_tools/media_create/partitions.py 2012-10-22 06:57:20 +0000 |
2224 | +++ linaro_image_tools/media_create/partitions.py 2013-02-18 14:17:36 +0000 |
2225 | @@ -32,7 +32,7 @@ |
2226 | Disk, |
2227 | PARTITION_NORMAL, |
2228 | PARTITION_EXTENDED, |
2229 | - ) |
2230 | +) |
2231 | |
2232 | from linaro_image_tools import cmd_runner |
2233 | |
2234 | @@ -54,7 +54,8 @@ |
2235 | |
2236 | |
2237 | def setup_android_partitions(board_config, media, image_size, bootfs_label, |
2238 | - should_create_partitions, should_align_boot_part=False): |
2239 | + should_create_partitions, |
2240 | + should_align_boot_part=False): |
2241 | cylinders = None |
2242 | if not media.is_block_device: |
2243 | image_size_in_bytes = get_partition_size_in_bytes(image_size) |
2244 | @@ -304,7 +305,7 @@ |
2245 | for partition in disk.partitions: |
2246 | assert partition.type == PARTITION_NORMAL, ( |
2247 | "Parted should only return normal partitions but got type %i" % |
2248 | - partition.type) |
2249 | + partition.type) |
2250 | if 'boot' in partition.getFlagsAsString(): |
2251 | geometry = partition.geometry |
2252 | vfat_offset = geometry.start * SECTOR_SIZE |
2253 | |
2254 | === modified file 'linaro_image_tools/media_create/rootfs.py' |
2255 | --- linaro_image_tools/media_create/rootfs.py 2012-08-05 09:21:10 +0000 |
2256 | +++ linaro_image_tools/media_create/rootfs.py 2013-02-18 14:17:36 +0000 |
2257 | @@ -65,7 +65,7 @@ |
2258 | |
2259 | mount_options = rootfs_mount_options(rootfs_type) |
2260 | fstab_additions = ["%s / %s %s 0 1" % ( |
2261 | - rootfs_id, rootfs_type, mount_options)] |
2262 | + rootfs_id, rootfs_type, mount_options)] |
2263 | if should_create_swap: |
2264 | print "\nCreating SWAP File\n" |
2265 | if has_space_left_for_swap(root_disk, swap_size): |
2266 | @@ -88,7 +88,7 @@ |
2267 | |
2268 | print "\nCreating /etc/flash-kernel.conf\n" |
2269 | create_flash_kernel_config( |
2270 | - root_disk, mmc_device_id, 1 + partition_offset) |
2271 | + root_disk, mmc_device_id, 1 + partition_offset) |
2272 | |
2273 | if board_config is not None: |
2274 | print "\nUpdating /etc/network/interfaces\n" |
2275 | @@ -123,7 +123,7 @@ |
2276 | Uses the given partition number to figure out the boot partition. |
2277 | """ |
2278 | target_boot_dev = '/dev/mmcblk%dp%s' % ( |
2279 | - mmc_device_id, boot_partition_number) |
2280 | + mmc_device_id, boot_partition_number) |
2281 | flash_kernel = os.path.join(root_disk, 'etc', 'flash-kernel.conf') |
2282 | write_data_to_protected_file( |
2283 | flash_kernel, "UBOOT_PART=%s\n" % target_boot_dev) |
2284 | |
2285 | === modified file 'linaro_image_tools/media_create/tests/__init__.py' |
2286 | --- linaro_image_tools/media_create/tests/__init__.py 2012-12-10 17:32:21 +0000 |
2287 | +++ linaro_image_tools/media_create/tests/__init__.py 2013-02-18 14:17:36 +0000 |
2288 | @@ -22,7 +22,7 @@ |
2289 | module_names = [ |
2290 | 'linaro_image_tools.media_create.tests.test_media_create', |
2291 | 'linaro_image_tools.media_create.tests.test_android_boards', |
2292 | - ] |
2293 | + ] |
2294 | loader = unittest.TestLoader() |
2295 | suite = loader.loadTestsFromNames(module_names) |
2296 | return suite |
2297 | |
2298 | === modified file 'linaro_image_tools/media_create/tests/test_android_boards.py' |
2299 | --- linaro_image_tools/media_create/tests/test_android_boards.py 2013-01-03 13:55:33 +0000 |
2300 | +++ linaro_image_tools/media_create/tests/test_android_boards.py 2013-02-18 14:17:36 +0000 |
2301 | @@ -21,12 +21,12 @@ |
2302 | |
2303 | from linaro_image_tools.media_create.boards import ( |
2304 | BoardConfigException, |
2305 | - ) |
2306 | +) |
2307 | |
2308 | from linaro_image_tools.media_create.android_boards import ( |
2309 | AndroidBeagleConfig, |
2310 | get_board_config, |
2311 | - ) |
2312 | +) |
2313 | |
2314 | from linaro_image_tools.testing import TestCaseWithFixtures |
2315 | from linaro_image_tools.tests.fixtures import CreateTempFileFixture |
2316 | @@ -80,18 +80,18 @@ |
2317 | hwpack_format + hwpack_android_args + hwpack_bootloader_flavor + |
2318 | hwpack_dtb_addr + hwpack_dtb_name + hwpack_extra_boot + |
2319 | hwpack_extra_serial |
2320 | - ) |
2321 | + ) |
2322 | |
2323 | android_hwpack_mx6 = ( |
2324 | android_hwpack_panda + hwpack_initrd_addr + hwpack_kernel_addr + |
2325 | hwpack_load_addr |
2326 | - ) |
2327 | + ) |
2328 | |
2329 | android_hwpack_snowball_sd = ( |
2330 | hwpack_android_args + hwpack_boot_script + hwpack_dtb_addr + |
2331 | hwpack_dtb_name + hwpack_extra_boot + hwpack_extra_serial + |
2332 | hwpack_fdt_high + hwpack_format + hwpack_initrd_addr |
2333 | - ) |
2334 | + ) |
2335 | |
2336 | android_hwpack_snowball_emmc = ( |
2337 | android_hwpack_snowball_sd + hwpack_initrd_high + hwpack_mmc_option) |
2338 | @@ -156,10 +156,11 @@ |
2339 | def test_extra_boot_args_options(self): |
2340 | """The field extra_boot_args_options should be a concatenated string. |
2341 | Testing presence of a field defined in the parent class.""" |
2342 | - values = {'dtb_name': 'a_name', |
2343 | - 'extra_boot_args_options': ['earlyprintk', 'mem=128M@0', |
2344 | - 'mali.mali_mem=64M@128M'] |
2345 | - } |
2346 | + values = { |
2347 | + 'dtb_name': 'a_name', |
2348 | + 'extra_boot_args_options': ['earlyprintk', 'mem=128M@0', |
2349 | + 'mali.mali_mem=64M@128M'] |
2350 | + } |
2351 | yaml_conf = self.android_hwpack_extra_boot % values |
2352 | name = self._get_tmp_file_name(yaml_conf) |
2353 | self.config.from_file(name) |
2354 | @@ -179,7 +180,7 @@ |
2355 | "initrd_addr": '0x12000000', |
2356 | "kernel_addr": '0x10000000', |
2357 | "load_addr": '0x10008000', |
2358 | - } |
2359 | + } |
2360 | expected = { |
2361 | 'bootargs': 'console=ttymxc0,115200n8 ' |
2362 | 'rootwait ro earlyprintk rootdelay=1 fixrtc ' |
2363 | @@ -222,7 +223,7 @@ |
2364 | "mem=456M@0x80000000", |
2365 | "mem=512M@0xA0000000"], |
2366 | "extra_serial_options": ["console=ttyO2,115200n8"], |
2367 | - } |
2368 | + } |
2369 | expected = { |
2370 | 'bootargs': 'console=ttyO2,115200n8 ' |
2371 | 'rootwait ro earlyprintk fixrtc ' |
2372 | @@ -270,7 +271,7 @@ |
2373 | "fdt_high": '0x05000000', |
2374 | "initrd_addr": '0x05000000', |
2375 | "initrd_high": '0x06000000', |
2376 | - } |
2377 | + } |
2378 | expected = { |
2379 | 'bootargs': 'console=ttyAMA2,115200n8 ' |
2380 | 'rootwait ro earlyprintk ' |
2381 | @@ -319,7 +320,7 @@ |
2382 | "initrd_addr": '0x05000000', |
2383 | "initrd_high": '0x06000000', |
2384 | "mmc_option": '0:2' |
2385 | - } |
2386 | + } |
2387 | expected = { |
2388 | 'bootargs': 'console=ttyAMA2,115200n8 ' |
2389 | 'rootwait ro earlyprintk ' |
2390 | @@ -353,8 +354,10 @@ |
2391 | |
2392 | def test_android_origen(self): |
2393 | values = { |
2394 | - "extra_serial_options": ["console=tty0", "console=ttySAC2,115200n8"], |
2395 | - "android_specific_args": ["init=/init", "androidboot.console=ttySAC2"] |
2396 | + "extra_serial_options": ["console=tty0", |
2397 | + "console=ttySAC2,115200n8"], |
2398 | + "android_specific_args": ["init=/init", |
2399 | + "androidboot.console=ttySAC2"] |
2400 | } |
2401 | expected = { |
2402 | 'bootargs': 'console=tty0 console=ttySAC2,115200n8 ' |
2403 | @@ -462,7 +465,7 @@ |
2404 | 'initrd_high': '0xffffffff'} |
2405 | config = ((self.hwpack_format + self.hwpack_extra_boot + |
2406 | self.hwpack_extra_serial + self.hwpack_android_args) % |
2407 | - values) |
2408 | + values) |
2409 | self.assertBootEnv(expected, config=config, board='mx53loco') |
2410 | |
2411 | def test_android_mx5_old(self): |
2412 | |
2413 | === modified file 'linaro_image_tools/media_create/tests/test_media_create.py' |
2414 | --- linaro_image_tools/media_create/tests/test_media_create.py 2013-01-15 18:45:34 +0000 |
2415 | +++ linaro_image_tools/media_create/tests/test_media_create.py 2013-02-18 14:17:36 +0000 |
2416 | @@ -47,7 +47,7 @@ |
2417 | check_device, |
2418 | partitions, |
2419 | rootfs, |
2420 | - ) |
2421 | +) |
2422 | from linaro_image_tools.media_create.boards import ( |
2423 | SECTOR_SIZE, |
2424 | align_up, |
2425 | @@ -65,10 +65,10 @@ |
2426 | _run_mkimage, |
2427 | BoardConfig, |
2428 | get_board_config, |
2429 | - ) |
2430 | +) |
2431 | from linaro_image_tools.media_create.android_boards import ( |
2432 | AndroidSnowballEmmcConfig, |
2433 | - ) |
2434 | +) |
2435 | from linaro_image_tools.media_create.chroot_utils import ( |
2436 | copy_file, |
2437 | install_hwpack, |
2438 | @@ -78,7 +78,7 @@ |
2439 | prepare_chroot, |
2440 | run_local_atexit_funcs, |
2441 | temporarily_overwrite_file_on_dir, |
2442 | - ) |
2443 | +) |
2444 | from linaro_image_tools.media_create.partitions import ( |
2445 | HEADS, |
2446 | MIN_IMAGE_SIZE, |
2447 | @@ -100,7 +100,7 @@ |
2448 | run_sfdisk_commands, |
2449 | setup_partitions, |
2450 | wait_partition_to_settle, |
2451 | - ) |
2452 | +) |
2453 | from linaro_image_tools.media_create.rootfs import ( |
2454 | append_to_fstab, |
2455 | create_flash_kernel_config, |
2456 | @@ -110,20 +110,20 @@ |
2457 | rootfs_mount_options, |
2458 | update_network_interfaces, |
2459 | write_data_to_protected_file, |
2460 | - ) |
2461 | +) |
2462 | from linaro_image_tools.media_create.tests.fixtures import ( |
2463 | CreateTarballFixture, |
2464 | MockRunSfdiskCommandsFixture, |
2465 | - ) |
2466 | +) |
2467 | from linaro_image_tools.media_create.unpack_binary_tarball import ( |
2468 | unpack_binary_tarball, |
2469 | - ) |
2470 | +) |
2471 | from linaro_image_tools.testing import TestCaseWithFixtures |
2472 | from linaro_image_tools.tests.fixtures import ( |
2473 | CreateTempDirFixture, |
2474 | MockCmdRunnerPopenFixture, |
2475 | MockSomethingFixture, |
2476 | - ) |
2477 | +) |
2478 | from linaro_image_tools.utils import find_command, preferred_tools_dir |
2479 | |
2480 | from linaro_image_tools.hwpack.testing import ContextManagerFixture |
2481 | @@ -149,7 +149,7 @@ |
2482 | metadata = ("format: 3.0\nname: ahwpack\nversion: 4\narchitecture: " |
2483 | "armel\norigin: linaro\n") |
2484 | metadata += ("bootloaders:\n u_boot:\n file: a_file\n uefi:\n file: " |
2485 | - "b_file\n") |
2486 | + "b_file\n") |
2487 | data = '3.0' |
2488 | format = "%s\n" % data |
2489 | tarball = self.add_to_tarball( |
2490 | @@ -162,9 +162,9 @@ |
2491 | metadata = ("format: 3.0\nname: ahwpack\nversion: 4\narchitecture: " |
2492 | "armel\norigin: linaro\n") |
2493 | metadata += ("bootloaders:\n u_boot:\n file: a_file\n uefi:\n file: " |
2494 | - "b_file\n") |
2495 | + "b_file\n") |
2496 | metadata += ("boards:\n panda:\n bootloaders:\n u_boot:\n " |
2497 | - "file: panda_file") |
2498 | + "file: panda_file") |
2499 | data = '3.0' |
2500 | format = "%s\n" % data |
2501 | tarball = self.add_to_tarball( |
2502 | @@ -177,12 +177,12 @@ |
2503 | metadata = ("format: 3.0\nname: ahwpack\nversion: 4\narchitecture: " |
2504 | "armel\norigin: linaro\n") |
2505 | metadata += ("bootloaders:\n u_boot:\n file: a_file\n uefi:\n file: " |
2506 | - "b_file\n") |
2507 | + "b_file\n") |
2508 | metadata += ("boards:\n panda:\n bootloaders:\n u_boot:\n " |
2509 | - "file: panda_file\n uefi:\n file: " |
2510 | - "uefi_panda_file\n") |
2511 | + "file: panda_file\n uefi:\n file: " |
2512 | + "uefi_panda_file\n") |
2513 | metadata += (" panda-lt:\n bootloaders:\n u_boot:\n " |
2514 | - "file: panda_lt_file") |
2515 | + "file: panda_lt_file") |
2516 | data = '3.0' |
2517 | format = "%s\n" % data |
2518 | tarball = self.add_to_tarball( |
2519 | @@ -190,7 +190,7 @@ |
2520 | hp = HardwarepackHandler([tarball], board='panda', bootloader='uefi') |
2521 | with hp: |
2522 | self.assertEquals(hp.get_field('bootloader_file')[0], |
2523 | - 'uefi_panda_file') |
2524 | + 'uefi_panda_file') |
2525 | |
2526 | def add_to_tarball(self, files, tarball=None): |
2527 | if tarball is None: |
2528 | @@ -368,13 +368,14 @@ |
2529 | format = "3.0\n" |
2530 | |
2531 | names = ['package0', 'package1', 'package2'] |
2532 | - files = {names[0]: |
2533 | - ["usr/lib/u-boot/omap4_panda/u-boot.img", |
2534 | - "usr/share/doc/u-boot-linaro-omap4-panda/copyright"], |
2535 | - names[1]: ["usr/lib/u-boot/omap4_panda/u-boot2.img", |
2536 | - "foo/bar", |
2537 | - "flim/flam"], |
2538 | - names[2]: ["some/path/config"]} |
2539 | + files = { |
2540 | + names[0]: |
2541 | + ["usr/lib/u-boot/omap4_panda/u-boot.img", |
2542 | + "usr/share/doc/u-boot-linaro-omap4-panda/copyright"], |
2543 | + names[1]: ["usr/lib/u-boot/omap4_panda/u-boot2.img", |
2544 | + "foo/bar", |
2545 | + "flim/flam"], |
2546 | + names[2]: ["some/path/config"]} |
2547 | |
2548 | # Generate some test packages |
2549 | maker = PackageMaker() |
2550 | @@ -425,8 +426,8 @@ |
2551 | |
2552 | def test_does_not_set_if_old_format(self): |
2553 | self.useFixture(MockSomethingFixture( |
2554 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2555 | - self.MockHardwarepackHandler)) |
2556 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2557 | + self.MockHardwarepackHandler)) |
2558 | |
2559 | board_conf = BoardConfig() |
2560 | board_conf.set_metadata('ahwpack.tar.gz') |
2561 | @@ -434,13 +435,13 @@ |
2562 | |
2563 | def test_sets_kernel_addr(self): |
2564 | self.useFixture(MockSomethingFixture( |
2565 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2566 | - self.MockHardwarepackHandler)) |
2567 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2568 | + self.MockHardwarepackHandler)) |
2569 | field_to_test = 'kernel_addr' |
2570 | data_to_set = '0x8123ABCD' |
2571 | self.MockHardwarepackHandler.metadata_dict = { |
2572 | field_to_test: data_to_set, |
2573 | - } |
2574 | + } |
2575 | |
2576 | board_conf = BoardConfig() |
2577 | board_conf.set_metadata('ahwpack.tar.gz') |
2578 | @@ -448,13 +449,13 @@ |
2579 | |
2580 | def test_sets_initrd_addr(self): |
2581 | self.useFixture(MockSomethingFixture( |
2582 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2583 | - self.MockHardwarepackHandler)) |
2584 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2585 | + self.MockHardwarepackHandler)) |
2586 | field_to_test = 'initrd_addr' |
2587 | data_to_set = '0x8123ABCD' |
2588 | self.MockHardwarepackHandler.metadata_dict = { |
2589 | field_to_test: data_to_set, |
2590 | - } |
2591 | + } |
2592 | |
2593 | board_conf = BoardConfig() |
2594 | board_conf.set_metadata('ahwpack.tar.gz') |
2595 | @@ -462,13 +463,13 @@ |
2596 | |
2597 | def test_sets_load_addr(self): |
2598 | self.useFixture(MockSomethingFixture( |
2599 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2600 | - self.MockHardwarepackHandler)) |
2601 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2602 | + self.MockHardwarepackHandler)) |
2603 | field_to_test = 'load_addr' |
2604 | data_to_set = '0x8123ABCD' |
2605 | self.MockHardwarepackHandler.metadata_dict = { |
2606 | field_to_test: data_to_set, |
2607 | - } |
2608 | + } |
2609 | |
2610 | board_conf = BoardConfig() |
2611 | board_conf.set_metadata('ahwpack.tar.gz') |
2612 | @@ -476,13 +477,13 @@ |
2613 | |
2614 | def test_sets_serial_tty(self): |
2615 | self.useFixture(MockSomethingFixture( |
2616 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2617 | - self.MockHardwarepackHandler)) |
2618 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2619 | + self.MockHardwarepackHandler)) |
2620 | field_to_test = 'serial_tty' |
2621 | data_to_set = 'ttyAA' |
2622 | self.MockHardwarepackHandler.metadata_dict = { |
2623 | field_to_test: data_to_set, |
2624 | - } |
2625 | + } |
2626 | |
2627 | board_conf = BoardConfig() |
2628 | board_conf.set_metadata('ahwpack.tar.gz') |
2629 | @@ -490,13 +491,13 @@ |
2630 | |
2631 | def test_sets_wired_interfaces(self): |
2632 | self.useFixture(MockSomethingFixture( |
2633 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2634 | - self.MockHardwarepackHandler)) |
2635 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2636 | + self.MockHardwarepackHandler)) |
2637 | field_to_test = 'wired_interfaces' |
2638 | data_to_set = 'eth0 eth1' |
2639 | self.MockHardwarepackHandler.metadata_dict = { |
2640 | field_to_test: data_to_set, |
2641 | - } |
2642 | + } |
2643 | |
2644 | board_conf = BoardConfig() |
2645 | board_conf.set_metadata('ahwpack.tar.gz') |
2646 | @@ -504,13 +505,13 @@ |
2647 | |
2648 | def test_sets_wireless_interfaces(self): |
2649 | self.useFixture(MockSomethingFixture( |
2650 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2651 | - self.MockHardwarepackHandler)) |
2652 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2653 | + self.MockHardwarepackHandler)) |
2654 | field_to_test = 'wireless_interfaces' |
2655 | data_to_set = 'wlan0 wl1' |
2656 | self.MockHardwarepackHandler.metadata_dict = { |
2657 | field_to_test: data_to_set, |
2658 | - } |
2659 | + } |
2660 | |
2661 | board_conf = BoardConfig() |
2662 | board_conf.set_metadata('ahwpack.tar.gz') |
2663 | @@ -518,13 +519,13 @@ |
2664 | |
2665 | def test_sets_mmc_id(self): |
2666 | self.useFixture(MockSomethingFixture( |
2667 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2668 | - self.MockHardwarepackHandler)) |
2669 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2670 | + self.MockHardwarepackHandler)) |
2671 | field_to_test = 'mmc_id' |
2672 | data_to_set = '0:1' |
2673 | self.MockHardwarepackHandler.metadata_dict = { |
2674 | field_to_test: data_to_set, |
2675 | - } |
2676 | + } |
2677 | |
2678 | board_conf = BoardConfig() |
2679 | board_conf.set_metadata('ahwpack.tar.gz') |
2680 | @@ -534,15 +535,15 @@ |
2681 | |
2682 | def test_sets_boot_min_size(self): |
2683 | self.useFixture(MockSomethingFixture( |
2684 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2685 | - self.MockHardwarepackHandler)) |
2686 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2687 | + self.MockHardwarepackHandler)) |
2688 | field_to_test = 'boot_min_size' |
2689 | data_to_set = '100' |
2690 | expected = align_up(int(data_to_set) * 1024 * 1024, |
2691 | SECTOR_SIZE) / SECTOR_SIZE |
2692 | self.MockHardwarepackHandler.metadata_dict = { |
2693 | field_to_test: data_to_set, |
2694 | - } |
2695 | + } |
2696 | |
2697 | board_conf = BoardConfig() |
2698 | board_conf.set_metadata('ahwpack.tar.gz') |
2699 | @@ -550,15 +551,15 @@ |
2700 | |
2701 | def test_sets_root_min_size(self): |
2702 | self.useFixture(MockSomethingFixture( |
2703 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2704 | - self.MockHardwarepackHandler)) |
2705 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2706 | + self.MockHardwarepackHandler)) |
2707 | field_to_test = 'root_min_size' |
2708 | data_to_set = '3' |
2709 | expected = align_up(int(data_to_set) * 1024 * 1024, |
2710 | SECTOR_SIZE) / SECTOR_SIZE |
2711 | self.MockHardwarepackHandler.metadata_dict = { |
2712 | field_to_test: data_to_set, |
2713 | - } |
2714 | + } |
2715 | |
2716 | board_conf = BoardConfig() |
2717 | board_conf.set_metadata('ahwpack.tar.gz') |
2718 | @@ -566,15 +567,15 @@ |
2719 | |
2720 | def test_sets_loader_min_size(self): |
2721 | self.useFixture(MockSomethingFixture( |
2722 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2723 | - self.MockHardwarepackHandler)) |
2724 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2725 | + self.MockHardwarepackHandler)) |
2726 | field_to_test = 'loader_min_size' |
2727 | data_to_set = '2' |
2728 | expected = align_up(int(data_to_set) * 1024 * 1024, |
2729 | SECTOR_SIZE) / SECTOR_SIZE |
2730 | self.MockHardwarepackHandler.metadata_dict = { |
2731 | field_to_test: data_to_set, |
2732 | - } |
2733 | + } |
2734 | |
2735 | board_conf = BoardConfig() |
2736 | board_conf.set_metadata('ahwpack.tar.gz') |
2737 | @@ -582,13 +583,13 @@ |
2738 | |
2739 | def test_sets_partition_layout_32(self): |
2740 | self.useFixture(MockSomethingFixture( |
2741 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2742 | - self.MockHardwarepackHandler)) |
2743 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2744 | + self.MockHardwarepackHandler)) |
2745 | field_to_test = 'partition_layout' |
2746 | data_to_set = 'bootfs_rootfs' |
2747 | self.MockHardwarepackHandler.metadata_dict = { |
2748 | field_to_test: data_to_set, |
2749 | - } |
2750 | + } |
2751 | |
2752 | board_conf = BoardConfig() |
2753 | board_conf.set_metadata('ahwpack.tar.gz') |
2754 | @@ -596,13 +597,13 @@ |
2755 | |
2756 | def test_sets_partition_layout_16(self): |
2757 | self.useFixture(MockSomethingFixture( |
2758 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2759 | - self.MockHardwarepackHandler)) |
2760 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2761 | + self.MockHardwarepackHandler)) |
2762 | field_to_test = 'partition_layout' |
2763 | data_to_set = 'bootfs16_rootfs' |
2764 | self.MockHardwarepackHandler.metadata_dict = { |
2765 | field_to_test: data_to_set, |
2766 | - } |
2767 | + } |
2768 | |
2769 | board_conf = BoardConfig() |
2770 | board_conf.set_metadata('ahwpack.tar.gz') |
2771 | @@ -610,13 +611,13 @@ |
2772 | |
2773 | def test_sets_partition_layout_raises(self): |
2774 | self.useFixture(MockSomethingFixture( |
2775 | - linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2776 | - self.MockHardwarepackHandler)) |
2777 | + linaro_image_tools.media_create.boards, 'HardwarepackHandler', |
2778 | + self.MockHardwarepackHandler)) |
2779 | field_to_test = 'partition_layout' |
2780 | data_to_set = 'bootfs_bogus_rootfs' |
2781 | self.MockHardwarepackHandler.metadata_dict = { |
2782 | field_to_test: data_to_set, |
2783 | - } |
2784 | + } |
2785 | |
2786 | board_conf = BoardConfig() |
2787 | self.assertRaises( |
2788 | @@ -628,11 +629,11 @@ |
2789 | self.MockHardwarepackHandler)) |
2790 | field_to_test = 'bootloader_copy_files' |
2791 | data_to_set = {'package': |
2792 | - [{"source1": "dest1"}, |
2793 | - {"source2": "dest2"}]} |
2794 | + [{"source1": "dest1"}, |
2795 | + {"source2": "dest2"}]} |
2796 | self.MockHardwarepackHandler.metadata_dict = { |
2797 | field_to_test: data_to_set, |
2798 | - } |
2799 | + } |
2800 | |
2801 | board_conf = BoardConfig() |
2802 | board_conf.set_metadata('ahwpack.tar.gz') |
2803 | @@ -867,14 +868,14 @@ |
2804 | #Create the test's input data structures |
2805 | zero = '\x00\x00\x00\x00' |
2806 | line1 = zero + zero + zero + zero + zero + 'b' + zero + zero + \ |
2807 | - '\x00\x00\x00' |
2808 | + '\x00\x00\x00' |
2809 | maxint = '\xFF\xFF\xFF\x7F' |
2810 | minint = '\xFF\xFF\xFF\xFF' |
2811 | line2 = maxint + maxint + zero + minint + minint + \ |
2812 | - 'hello' + zero + '\x00\x00\x00' |
2813 | + 'hello' + zero + '\x00\x00\x00' |
2814 | line3 = '\x01\x00\x00\x00' '\x64\x00\x00\x00' + zero + \ |
2815 | - '\x05\x00\x00\x00' '\x05\x00\x00\x00' \ |
2816 | - 'hello' + zero + '\x00\x00\x00' |
2817 | + '\x05\x00\x00\x00' '\x05\x00\x00\x00' \ |
2818 | + 'hello' + zero + '\x00\x00\x00' |
2819 | self.expected = line1 + line2 + line3 |
2820 | self.board_conf = boards.SnowballEmmcConfig() |
2821 | |
2822 | @@ -884,11 +885,11 @@ |
2823 | files = [] |
2824 | for line in src_data: |
2825 | files.append({'section_name': line[5], |
2826 | - 'filename': 'N/A', |
2827 | - 'align': line[3], |
2828 | - 'offset': line[0], |
2829 | - 'size': line[1], |
2830 | - 'load_adress': 'N/A'}) |
2831 | + 'filename': 'N/A', |
2832 | + 'align': line[3], |
2833 | + 'offset': line[0], |
2834 | + 'size': line[1], |
2835 | + 'load_adress': 'N/A'}) |
2836 | return files |
2837 | |
2838 | def test_create_toc_normal_case(self): |
2839 | @@ -905,7 +906,8 @@ |
2840 | actual = f.read() |
2841 | self.assertEquals(96, len(actual)) |
2842 | for i in range(len(actual)): |
2843 | - self.assertEquals(self.expected[i], actual[i], 'Mismatch at ix' \ |
2844 | + self.assertEquals( |
2845 | + self.expected[i], actual[i], 'Mismatch at ix' |
2846 | ' %d, ref=%c, actual=%c' % (i, self.expected[i], actual[i])) |
2847 | |
2848 | def test_create_toc_error_too_large_section_name(self): |
2849 | @@ -990,7 +992,7 @@ |
2850 | ofs = [self.snowball_config.TOC_SIZE, |
2851 | self.snowball_config.TOC_SIZE + len('ISSW'), 0x160000, |
2852 | 0x170000, 0xBA0000, 0xC1F000] |
2853 | - size = [len('ISSW'), len('X-LOADER'), len('MEM_INIT'), \ |
2854 | + size = [len('ISSW'), len('X-LOADER'), len('MEM_INIT'), |
2855 | len('PWR_MGT'), len('NORMAL'), len('UBOOT_ENV')] |
2856 | i = 0 |
2857 | for line in src_data: |
2858 | @@ -1006,8 +1008,9 @@ |
2859 | |
2860 | def test_get_file_info_relative_path(self): |
2861 | # Create a config file |
2862 | - cfg_file = os.path.join(self.temp_bootdir_path, |
2863 | - self.snowball_config.snowball_startup_files_config) |
2864 | + cfg_file = os.path.join( |
2865 | + self.temp_bootdir_path, |
2866 | + self.snowball_config.snowball_startup_files_config) |
2867 | uboot_file = 'u-boot.bin' |
2868 | with open(cfg_file, 'w') as f: |
2869 | f.write('%s %s %i %#x %s\n' % ('NORMAL', uboot_file, 0, |
2870 | @@ -1020,8 +1023,9 @@ |
2871 | |
2872 | def test_get_file_info_abs_path(self): |
2873 | # Create a config file |
2874 | - cfg_file = os.path.join(self.temp_bootdir_path, |
2875 | - self.snowball_config.snowball_startup_files_config) |
2876 | + cfg_file = os.path.join( |
2877 | + self.temp_bootdir_path, |
2878 | + self.snowball_config.snowball_startup_files_config) |
2879 | uboot_dir = tempfile.mkdtemp(dir=self.tempdir) |
2880 | uboot_file = os.path.join(uboot_dir, 'u-boot.bin') |
2881 | uboot_relative_file = uboot_file.replace(self.tempdir, '') |
2882 | @@ -1035,8 +1039,9 @@ |
2883 | |
2884 | def test_get_file_info_raises(self): |
2885 | # Create a config file |
2886 | - cfg_file = os.path.join(self.temp_bootdir_path, |
2887 | - self.snowball_config.snowball_startup_files_config) |
2888 | + cfg_file = os.path.join( |
2889 | + self.temp_bootdir_path, |
2890 | + self.snowball_config.snowball_startup_files_config) |
2891 | with open(cfg_file, 'w') as f: |
2892 | f.write('%s %s %i %#x %s\n' % ('NORMAL', 'u-boot.bin', 0, |
2893 | 0xBA0000, '9')) |
2894 | @@ -1055,7 +1060,8 @@ |
2895 | tmpfile.write(filedata) |
2896 | tmpfile.close() |
2897 | files = self.setupFiles() |
2898 | - self.assertRaises(AssertionError, |
2899 | + self.assertRaises( |
2900 | + AssertionError, |
2901 | self.snowball_config.install_snowball_boot_loader, |
2902 | toc_filename, files, "boot_device_or_file", |
2903 | self.snowball_config.SNOWBALL_LOADER_START_S) |
2904 | @@ -1064,23 +1070,24 @@ |
2905 | fixture = self.useFixture(MockCmdRunnerPopenFixture()) |
2906 | toc_filename = self.createTempFileAsFixture() |
2907 | files = self.setupFiles() |
2908 | - self.snowball_config.install_snowball_boot_loader(toc_filename, |
2909 | + self.snowball_config.install_snowball_boot_loader( |
2910 | + toc_filename, |
2911 | files, "boot_device_or_file", |
2912 | self.snowball_config.SNOWBALL_LOADER_START_S) |
2913 | expected = [ |
2914 | - '%s dd if=%s of=boot_device_or_file bs=512 conv=notrunc' \ |
2915 | + '%s dd if=%s of=boot_device_or_file bs=512 conv=notrunc' |
2916 | ' seek=%s' % (sudo_args, toc_filename, |
2917 | self.snowball_config.SNOWBALL_LOADER_START_S), |
2918 | - '%s dd if=%s/boot_image_issw.bin of=boot_device_or_file bs=512' \ |
2919 | + '%s dd if=%s/boot_image_issw.bin of=boot_device_or_file bs=512' |
2920 | ' conv=notrunc seek=257' % (sudo_args, self.temp_bootdir_path), |
2921 | - '%s dd if=%s/boot_image_x-loader.bin of=boot_device_or_file' \ |
2922 | + '%s dd if=%s/boot_image_x-loader.bin of=boot_device_or_file' |
2923 | ' bs=1 conv=notrunc seek=131588' |
2924 | % (sudo_args, self.temp_bootdir_path), |
2925 | - '%s dd if=%s/mem_init.bin of=boot_device_or_file bs=512' \ |
2926 | + '%s dd if=%s/mem_init.bin of=boot_device_or_file bs=512' |
2927 | ' conv=notrunc seek=3072' % (sudo_args, self.temp_bootdir_path), |
2928 | - '%s dd if=%s/power_management.bin of=boot_device_or_file bs=512' \ |
2929 | + '%s dd if=%s/power_management.bin of=boot_device_or_file bs=512' |
2930 | ' conv=notrunc seek=3200' % (sudo_args, self.temp_bootdir_path), |
2931 | - '%s dd if=%s/u-boot.bin of=boot_device_or_file bs=512' \ |
2932 | + '%s dd if=%s/u-boot.bin of=boot_device_or_file bs=512' |
2933 | ' conv=notrunc seek=24064' % (sudo_args, self.temp_bootdir_path), |
2934 | '%s dd if=%s/u-boot-env.bin of=boot_device_or_file bs=512' |
2935 | ' conv=notrunc seek=25080' % (sudo_args, self.temp_bootdir_path)] |
2936 | @@ -1091,30 +1098,31 @@ |
2937 | fixture = self.useFixture(MockCmdRunnerPopenFixture()) |
2938 | toc_filename = self.createTempFileAsFixture() |
2939 | files = self.setupFiles() |
2940 | - self.snowball_config.install_snowball_boot_loader(toc_filename, |
2941 | + self.snowball_config.install_snowball_boot_loader( |
2942 | + toc_filename, |
2943 | files, "boot_device_or_file", |
2944 | self.snowball_config.SNOWBALL_LOADER_START_S, True) |
2945 | expected = [ |
2946 | - '%s dd if=%s of=boot_device_or_file bs=512 conv=notrunc' \ |
2947 | + '%s dd if=%s of=boot_device_or_file bs=512 conv=notrunc' |
2948 | ' seek=%s' % (sudo_args, toc_filename, |
2949 | self.snowball_config.SNOWBALL_LOADER_START_S), |
2950 | - '%s dd if=%s/boot_image_issw.bin of=boot_device_or_file bs=512' \ |
2951 | + '%s dd if=%s/boot_image_issw.bin of=boot_device_or_file bs=512' |
2952 | ' conv=notrunc seek=257' % (sudo_args, self.temp_bootdir_path), |
2953 | '%s rm %s/boot_image_issw.bin' % (sudo_args, |
2954 | self.temp_bootdir_path), |
2955 | - '%s dd if=%s/boot_image_x-loader.bin of=boot_device_or_file' \ |
2956 | + '%s dd if=%s/boot_image_x-loader.bin of=boot_device_or_file' |
2957 | ' bs=1 conv=notrunc seek=131588' |
2958 | % (sudo_args, self.temp_bootdir_path), |
2959 | '%s rm %s/boot_image_x-loader.bin' % (sudo_args, |
2960 | self.temp_bootdir_path), |
2961 | - '%s dd if=%s/mem_init.bin of=boot_device_or_file bs=512' \ |
2962 | + '%s dd if=%s/mem_init.bin of=boot_device_or_file bs=512' |
2963 | ' conv=notrunc seek=3072' % (sudo_args, self.temp_bootdir_path), |
2964 | '%s rm %s/mem_init.bin' % (sudo_args, self.temp_bootdir_path), |
2965 | - '%s dd if=%s/power_management.bin of=boot_device_or_file bs=512' \ |
2966 | + '%s dd if=%s/power_management.bin of=boot_device_or_file bs=512' |
2967 | ' conv=notrunc seek=3200' % (sudo_args, self.temp_bootdir_path), |
2968 | '%s rm %s/power_management.bin' % (sudo_args, |
2969 | self.temp_bootdir_path), |
2970 | - '%s dd if=%s/u-boot.bin of=boot_device_or_file bs=512' \ |
2971 | + '%s dd if=%s/u-boot.bin of=boot_device_or_file bs=512' |
2972 | ' conv=notrunc seek=24064' % (sudo_args, self.temp_bootdir_path), |
2973 | '%s rm %s/u-boot.bin' % (sudo_args, self.temp_bootdir_path), |
2974 | '%s dd if=%s/u-boot-env.bin of=boot_device_or_file bs=512' |
2975 | @@ -1132,19 +1140,19 @@ |
2976 | toc_filename, files, "boot_device_or_file", |
2977 | board_conf.SNOWBALL_LOADER_START_S) |
2978 | expected = [ |
2979 | - '%s dd if=%s of=boot_device_or_file bs=512 conv=notrunc' \ |
2980 | + '%s dd if=%s of=boot_device_or_file bs=512 conv=notrunc' |
2981 | ' seek=%s' % (sudo_args, toc_filename, |
2982 | board_conf.SNOWBALL_LOADER_START_S), |
2983 | - '%s dd if=%s/boot_image_issw.bin of=boot_device_or_file bs=512' \ |
2984 | + '%s dd if=%s/boot_image_issw.bin of=boot_device_or_file bs=512' |
2985 | ' conv=notrunc seek=257' % (sudo_args, self.temp_bootdir_path), |
2986 | - '%s dd if=%s/boot_image_x-loader.bin of=boot_device_or_file' \ |
2987 | + '%s dd if=%s/boot_image_x-loader.bin of=boot_device_or_file' |
2988 | ' bs=1 conv=notrunc seek=131588' |
2989 | % (sudo_args, self.temp_bootdir_path), |
2990 | - '%s dd if=%s/mem_init.bin of=boot_device_or_file bs=512' \ |
2991 | + '%s dd if=%s/mem_init.bin of=boot_device_or_file bs=512' |
2992 | ' conv=notrunc seek=3072' % (sudo_args, self.temp_bootdir_path), |
2993 | - '%s dd if=%s/power_management.bin of=boot_device_or_file bs=512' \ |
2994 | + '%s dd if=%s/power_management.bin of=boot_device_or_file bs=512' |
2995 | ' conv=notrunc seek=3200' % (sudo_args, self.temp_bootdir_path), |
2996 | - '%s dd if=%s/u-boot.bin of=boot_device_or_file bs=512' \ |
2997 | + '%s dd if=%s/u-boot.bin of=boot_device_or_file bs=512' |
2998 | ' conv=notrunc seek=24064' % (sudo_args, self.temp_bootdir_path), |
2999 | '%s dd if=%s/u-boot-env.bin of=boot_device_or_file bs=512' |
3000 | ' conv=notrunc seek=25080' % (sudo_args, self.temp_bootdir_path)] |
3001 | @@ -1153,8 +1161,10 @@ |
3002 | |
3003 | def test_snowball_make_boot_files(self): |
3004 | fixture = self.useFixture(MockCmdRunnerPopenFixture()) |
3005 | - self.useFixture(MockSomethingFixture(tempfile, 'mkstemp', |
3006 | - lambda: (-1, '/tmp/temp_snowball_make_boot_files'))) |
3007 | + self.useFixture( |
3008 | + MockSomethingFixture(tempfile, 'mkstemp', |
3009 | + lambda: |
3010 | + (-1, '/tmp/temp_snowball_make_boot_files'))) |
3011 | self.setupFiles() |
3012 | k_img_file = os.path.join(self.tempdir, 'vmlinuz-1-ux500') |
3013 | i_img_file = os.path.join(self.tempdir, 'initrd.img-1-ux500') |
3014 | @@ -1164,39 +1174,40 @@ |
3015 | rootfs_id="UUID=test_boot_env_uuid", |
3016 | i_img_data=None, d_img_data=None) |
3017 | self.snowball_config._make_boot_files(boot_env, self.tempdir, |
3018 | - self.temp_bootdir_path, 'boot_device_or_file', k_img_file, |
3019 | - i_img_file, None) |
3020 | + self.temp_bootdir_path, |
3021 | + 'boot_device_or_file', |
3022 | + k_img_file, i_img_file, None) |
3023 | expected = [ |
3024 | - '%s mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e' \ |
3025 | + '%s mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e' |
3026 | ' 0x00008000 -n Linux -d %s %s/boot/uImage' % (sudo_args, |
3027 | k_img_file, self.tempdir), |
3028 | '%s cp /tmp/temp_snowball_make_boot_files %s/boot/boot.txt' |
3029 | % (sudo_args, self.tempdir), |
3030 | - '%s mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n boot' \ |
3031 | + '%s mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n boot' |
3032 | ' script -d %s/boot/boot.txt %s/boot/flash.scr' |
3033 | % (sudo_args, self.tempdir, self.tempdir), |
3034 | - '%s dd if=/tmp/temp_snowball_make_boot_files' \ |
3035 | + '%s dd if=/tmp/temp_snowball_make_boot_files' |
3036 | ' of=boot_device_or_file bs=512 conv=notrunc seek=256' |
3037 | % (sudo_args), |
3038 | - '%s dd if=%s/boot/boot_image_issw.bin of=boot_device_or_file' \ |
3039 | + '%s dd if=%s/boot/boot_image_issw.bin of=boot_device_or_file' |
3040 | ' bs=512 conv=notrunc seek=257' % (sudo_args, self.tempdir), |
3041 | '%s rm %s/boot_image_issw.bin' % (sudo_args, |
3042 | self.temp_bootdir_path), |
3043 | - '%s dd if=%s/boot/boot_image_x-loader.bin of=boot_device_or_file' \ |
3044 | + '%s dd if=%s/boot/boot_image_x-loader.bin of=boot_device_or_file' |
3045 | ' bs=1 conv=notrunc seek=131588' % (sudo_args, self.tempdir), |
3046 | '%s rm %s/boot_image_x-loader.bin' % (sudo_args, |
3047 | self.temp_bootdir_path), |
3048 | - '%s dd if=%s/boot/mem_init.bin of=boot_device_or_file bs=512' \ |
3049 | + '%s dd if=%s/boot/mem_init.bin of=boot_device_or_file bs=512' |
3050 | ' conv=notrunc seek=3072' % (sudo_args, self.tempdir), |
3051 | '%s rm %s/mem_init.bin' % (sudo_args, self.temp_bootdir_path), |
3052 | - '%s dd if=%s/boot/power_management.bin of=boot_device_or_file' \ |
3053 | + '%s dd if=%s/boot/power_management.bin of=boot_device_or_file' |
3054 | ' bs=512 conv=notrunc seek=3200' % (sudo_args, self.tempdir), |
3055 | '%s rm %s/power_management.bin' % (sudo_args, |
3056 | self.temp_bootdir_path), |
3057 | - '%s dd if=%s/boot/u-boot.bin of=boot_device_or_file bs=512' \ |
3058 | + '%s dd if=%s/boot/u-boot.bin of=boot_device_or_file bs=512' |
3059 | ' conv=notrunc seek=24064' % (sudo_args, self.tempdir), |
3060 | '%s rm %s/u-boot.bin' % (sudo_args, self.temp_bootdir_path), |
3061 | - '%s dd if=%s/boot/u-boot-env.bin of=boot_device_or_file bs=512' \ |
3062 | + '%s dd if=%s/boot/u-boot-env.bin of=boot_device_or_file bs=512' |
3063 | ' conv=notrunc seek=25080' % (sudo_args, self.tempdir), |
3064 | '%s rm %s/u-boot-env.bin' % (sudo_args, self.temp_bootdir_path), |
3065 | '%s rm /tmp/temp_snowball_make_boot_files' % (sudo_args), |
3066 | @@ -1232,7 +1243,7 @@ |
3067 | |
3068 | for name in dir(boards): |
3069 | attr = getattr(boards, name) |
3070 | - if type(attr) == types.FunctionType: |
3071 | + if isinstance(attr, types.FunctionType): |
3072 | self.useFixture(MockSomethingFixture( |
3073 | linaro_image_tools.media_create.boards, name, |
3074 | mock_func_creator(name))) |
3075 | @@ -1347,7 +1358,7 @@ |
3076 | self.funcs_calls.append('install_samsung_boot_loader') |
3077 | |
3078 | self.useFixture(MockSomethingFixture(os.path, 'exists', |
3079 | - lambda file: True)) |
3080 | + lambda file: True)) |
3081 | board_conf.hardwarepack_handler = ( |
3082 | TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) |
3083 | board_conf.hardwarepack_handler.get_format = ( |
3084 | @@ -1428,7 +1439,7 @@ |
3085 | |
3086 | for name in dir(boards): |
3087 | attr = getattr(boards, name) |
3088 | - if type(attr) == types.FunctionType: |
3089 | + if isinstance(attr, types.FunctionType): |
3090 | self.useFixture(MockSomethingFixture( |
3091 | linaro_image_tools.media_create.boards, name, |
3092 | mock_func_creator(name))) |
3093 | @@ -1461,21 +1472,21 @@ |
3094 | lambda *args, **kwargs: self.funcs_calls.append(name)) |
3095 | |
3096 | self.useFixture(MockSomethingFixture( |
3097 | - linaro_image_tools.media_create.boards.SnowballEmmcConfig, |
3098 | - 'get_file_info', |
3099 | - mock_func_creator('get_file_info'))) |
3100 | - self.useFixture(MockSomethingFixture( |
3101 | - linaro_image_tools.media_create.boards.SnowballEmmcConfig, |
3102 | - 'create_toc', |
3103 | - mock_func_creator('create_toc'))) |
3104 | - self.useFixture(MockSomethingFixture( |
3105 | - linaro_image_tools.media_create.boards.SnowballEmmcConfig, |
3106 | - 'install_snowball_boot_loader', |
3107 | - mock_func_creator('install_snowball_boot_loader'))) |
3108 | - self.useFixture(MockSomethingFixture( |
3109 | - linaro_image_tools.media_create.boards.SnowballEmmcConfig, |
3110 | - 'delete_file', |
3111 | - mock_func_creator('delete_file'))) |
3112 | + linaro_image_tools.media_create.boards.SnowballEmmcConfig, |
3113 | + 'get_file_info', |
3114 | + mock_func_creator('get_file_info'))) |
3115 | + self.useFixture(MockSomethingFixture( |
3116 | + linaro_image_tools.media_create.boards.SnowballEmmcConfig, |
3117 | + 'create_toc', |
3118 | + mock_func_creator('create_toc'))) |
3119 | + self.useFixture(MockSomethingFixture( |
3120 | + linaro_image_tools.media_create.boards.SnowballEmmcConfig, |
3121 | + 'install_snowball_boot_loader', |
3122 | + mock_func_creator('install_snowball_boot_loader'))) |
3123 | + self.useFixture(MockSomethingFixture( |
3124 | + linaro_image_tools.media_create.boards.SnowballEmmcConfig, |
3125 | + 'delete_file', |
3126 | + mock_func_creator('delete_file'))) |
3127 | self.populate_raw_partition(boards.SnowballEmmcConfig()) |
3128 | expected = ['get_file_info', 'create_toc', |
3129 | 'install_snowball_boot_loader', 'delete_file', |
3130 | @@ -1515,7 +1526,7 @@ |
3131 | |
3132 | def test_arndale_raw(self): |
3133 | self.useFixture(MockSomethingFixture(os.path, 'getsize', |
3134 | - lambda file: 1)) |
3135 | + lambda file: 1)) |
3136 | |
3137 | self.populate_raw_partition(boards.ArndaleConfig()) |
3138 | expected = ['_dd', '_dd', '_dd'] |
3139 | @@ -1563,24 +1574,24 @@ |
3140 | expected_commands = ['sudo -E cp boot/u-boot.bin ./startupfiles'] |
3141 | |
3142 | self.useFixture(MockSomethingFixture( |
3143 | - android_boards.AndroidSnowballEmmcConfig, |
3144 | - 'get_file_info', |
3145 | - mock_func_creator('get_file_info'))) |
3146 | - self.useFixture(MockSomethingFixture( |
3147 | - android_boards.AndroidSnowballEmmcConfig, |
3148 | - 'create_toc', |
3149 | - mock_func_creator('create_toc'))) |
3150 | - self.useFixture(MockSomethingFixture( |
3151 | - android_boards.AndroidSnowballEmmcConfig, |
3152 | - 'install_snowball_boot_loader', |
3153 | - mock_func_creator('install_snowball_boot_loader'))) |
3154 | - self.useFixture(MockSomethingFixture( |
3155 | - android_boards.AndroidSnowballEmmcConfig, |
3156 | - 'delete_file', |
3157 | - mock_func_creator('delete_file'))) |
3158 | + android_boards.AndroidSnowballEmmcConfig, |
3159 | + 'get_file_info', |
3160 | + mock_func_creator('get_file_info'))) |
3161 | + self.useFixture(MockSomethingFixture( |
3162 | + android_boards.AndroidSnowballEmmcConfig, |
3163 | + 'create_toc', |
3164 | + mock_func_creator('create_toc'))) |
3165 | + self.useFixture(MockSomethingFixture( |
3166 | + android_boards.AndroidSnowballEmmcConfig, |
3167 | + 'install_snowball_boot_loader', |
3168 | + mock_func_creator('install_snowball_boot_loader'))) |
3169 | + self.useFixture(MockSomethingFixture( |
3170 | + android_boards.AndroidSnowballEmmcConfig, |
3171 | + 'delete_file', |
3172 | + mock_func_creator('delete_file'))) |
3173 | self.populate_raw_partition(android_boards.AndroidSnowballEmmcConfig()) |
3174 | expected_calls = ['get_file_info', 'create_toc', |
3175 | - 'install_snowball_boot_loader', 'delete_file'] |
3176 | + 'install_snowball_boot_loader', 'delete_file'] |
3177 | # Test that we copy the u-boot files to the local startupfiles dir. |
3178 | self.assertEqual(expected_commands, fixture.mock.commands_executed) |
3179 | # Test that we run the Snowball populate_raw_partition() and only |
3180 | @@ -1664,12 +1675,13 @@ |
3181 | def test_align_partition_4_mib_4_mib(self): |
3182 | expected = (4 * 1024 * 1024, 8 * 1024 * 1024 - 1, 4 * 1024 * 1024) |
3183 | self.assertEqual(expected, |
3184 | - align_partition(1, 1, 4 * 1024 * 1024, 4 * 1024 * 1024)) |
3185 | + align_partition(1, 1, |
3186 | + 4 * 1024 * 1024, 4 * 1024 * 1024)) |
3187 | |
3188 | def test_align_partition_none_4_mib(self): |
3189 | expected = (1, 4 * 1024 * 1024 - 1, 4 * 1024 * 1024 - 1) |
3190 | self.assertEqual(expected, |
3191 | - align_partition(1, 1, 1, 4 * 1024 * 1024)) |
3192 | + align_partition(1, 1, 1, 4 * 1024 * 1024)) |
3193 | |
3194 | |
3195 | class TestFixForBug697824(TestCaseWithFixtures): |
3196 | @@ -1686,7 +1698,7 @@ |
3197 | config._make_boot_files = MagicMock() |
3198 | config._make_boot_files_v2 = MagicMock() |
3199 | config.set_appropriate_serial_tty = MagicMock( |
3200 | - side_effect=set_appropriate_serial_tty_mock) |
3201 | + side_effect=set_appropriate_serial_tty_mock) |
3202 | |
3203 | def test_omap_make_boot_files(self): |
3204 | self.set_appropriate_serial_tty_called = False |
3205 | @@ -1900,10 +1912,10 @@ |
3206 | board_conf = get_board_config('origen') |
3207 | board_conf.partition_layout = 'reserved_bootfs_rootfs' |
3208 | board_conf.LOADER_MIN_SIZE_S = ( |
3209 | - board_conf.samsung_bl1_start + |
3210 | - board_conf.samsung_bl1_len + |
3211 | - board_conf.samsung_bl2_len + |
3212 | - board_conf.samsung_env_len) |
3213 | + board_conf.samsung_bl1_start + |
3214 | + board_conf.samsung_bl1_len + |
3215 | + board_conf.samsung_bl2_len + |
3216 | + board_conf.samsung_env_len) |
3217 | self.assertEquals( |
3218 | '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', |
3219 | board_conf.get_sfdisk_cmd()) |
3220 | @@ -1912,10 +1924,10 @@ |
3221 | board_conf = get_board_config('origen_quad') |
3222 | board_conf.partition_layout = 'reserved_bootfs_rootfs' |
3223 | board_conf.LOADER_MIN_SIZE_S = ( |
3224 | - board_conf.samsung_bl1_start + |
3225 | - board_conf.samsung_bl1_len + |
3226 | - board_conf.samsung_bl2_len + |
3227 | - board_conf.samsung_env_len) |
3228 | + board_conf.samsung_bl1_start + |
3229 | + board_conf.samsung_bl1_len + |
3230 | + board_conf.samsung_bl2_len + |
3231 | + board_conf.samsung_env_len) |
3232 | self.assertEquals( |
3233 | '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-', |
3234 | board_conf.get_sfdisk_cmd()) |
3235 | @@ -1989,12 +2001,12 @@ |
3236 | rootfs_id="UUID=deadbeef", i_img_data="initrd", d_img_data=None) |
3237 | expected = { |
3238 | 'bootargs': 'console=ttySAC1,115200n8 root=UUID=deadbeef ' |
3239 | - 'rootwait ro', |
3240 | - 'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; ' |
3241 | - 'fatload mmc 0:2 0x42000000 uInitrd; ' |
3242 | - 'bootm 0x40007000 0x42000000', |
3243 | - 'ethact': 'smc911x-0', |
3244 | - 'ethaddr': '00:40:5c:26:0a:5b', |
3245 | + 'rootwait ro', |
3246 | + 'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; ' |
3247 | + 'fatload mmc 0:2 0x42000000 uInitrd; ' |
3248 | + 'bootm 0x40007000 0x42000000', |
3249 | + 'ethact': 'smc911x-0', |
3250 | + 'ethaddr': '00:40:5c:26:0a:5b', |
3251 | 'fdt_high': '0xffffffff', |
3252 | 'initrd_high': '0xffffffff'} |
3253 | self.assertEqual(expected, boot_commands) |
3254 | @@ -2006,10 +2018,10 @@ |
3255 | rootfs_id="UUID=deadbeef", i_img_data="initrd", d_img_data=None) |
3256 | expected = { |
3257 | 'bootargs': 'console=ttySAC2,115200n8 root=UUID=deadbeef ' |
3258 | - 'rootwait ro', |
3259 | - 'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; ' |
3260 | - 'fatload mmc 0:2 0x42000000 uInitrd; ' |
3261 | - 'bootm 0x40007000 0x42000000', |
3262 | + 'rootwait ro', |
3263 | + 'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; ' |
3264 | + 'fatload mmc 0:2 0x42000000 uInitrd; ' |
3265 | + 'bootm 0x40007000 0x42000000', |
3266 | 'fdt_high': '0xffffffff', |
3267 | 'initrd_high': '0xffffffff'} |
3268 | self.assertEqual(expected, boot_commands) |
3269 | @@ -2022,9 +2034,9 @@ |
3270 | expected = { |
3271 | 'bootargs': 'console=ttySAC2,115200n8 root=UUID=deadbeef ' |
3272 | 'rootwait ro', |
3273 | - 'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; ' |
3274 | - 'fatload mmc 0:2 0x42000000 uInitrd; ' |
3275 | - 'bootm 0x40007000 0x42000000', |
3276 | + 'bootcmd': 'fatload mmc 0:2 0x40007000 uImage; ' |
3277 | + 'fatload mmc 0:2 0x42000000 uInitrd; ' |
3278 | + 'bootm 0x40007000 0x42000000', |
3279 | 'fdt_high': '0xffffffff', |
3280 | 'initrd_high': '0xffffffff'} |
3281 | self.assertEqual(expected, boot_commands) |
3282 | @@ -2037,12 +2049,12 @@ |
3283 | expected = { |
3284 | 'bootargs': 'root=UUID=deadbeef rootwait ro', |
3285 | 'bootcmd': 'fatload mmc 0:2 None uImage; ' |
3286 | - 'fatload mmc 0:2 None uInitrd; ' |
3287 | - 'bootm None None', |
3288 | - 'ethact': 'smc911x-0', |
3289 | - 'ethaddr': '00:40:5c:26:0a:5b', |
3290 | - 'fdt_high': '0xffffffff', |
3291 | - 'initrd_high': '0xffffffff'} |
3292 | + 'fatload mmc 0:2 None uInitrd; ' |
3293 | + 'bootm None None', |
3294 | + 'ethact': 'smc911x-0', |
3295 | + 'ethaddr': '00:40:5c:26:0a:5b', |
3296 | + 'fdt_high': '0xffffffff', |
3297 | + 'initrd_high': '0xffffffff'} |
3298 | self.assertEqual(expected, boot_commands) |
3299 | |
3300 | def test_ux500(self): |
3301 | @@ -2360,9 +2372,10 @@ |
3302 | self.useFixture(MockSomethingFixture( |
3303 | os.path, "getsize", |
3304 | lambda s: (BoardConfig.LOADER_MIN_SIZE_S - 1) * SECTOR_SIZE + 1)) |
3305 | - self.assertRaises(AssertionError, |
3306 | + self.assertRaises( |
3307 | + AssertionError, |
3308 | install_mx5_boot_loader, "imx_file", "boot_device_or_file", |
3309 | - BoardConfig.LOADER_MIN_SIZE_S) |
3310 | + BoardConfig.LOADER_MIN_SIZE_S) |
3311 | |
3312 | def test_install_omap_boot_loader(self): |
3313 | fixture = self._mock_Popen() |
3314 | @@ -2409,10 +2422,12 @@ |
3315 | chroot_dir_value = 'chroot_dir' |
3316 | board_conf._get_samsung_spl = MagicMock() |
3317 | board_conf._get_samsung_spl.return_value = ("%s/%s/SPL" % |
3318 | - (chroot_dir_value, bootloader_flavor)) |
3319 | + (chroot_dir_value, |
3320 | + bootloader_flavor)) |
3321 | board_conf._get_samsung_bootloader = MagicMock() |
3322 | board_conf._get_samsung_bootloader.return_value = ("%s/%s/uboot" % |
3323 | - (chroot_dir_value, bootloader_flavor)) |
3324 | + (chroot_dir_value, |
3325 | + bootloader_flavor)) |
3326 | board_conf.hardwarepack_handler = ( |
3327 | TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz')) |
3328 | board_conf.hardwarepack_handler.get_format = ( |
3329 | @@ -2462,7 +2477,7 @@ |
3330 | board_conf, bootloader_flavor, chroot_dir_value = \ |
3331 | self._set_up_board_config('arndale') |
3332 | self.useFixture(MockSomethingFixture(os.path, 'getsize', |
3333 | - lambda file: 1)) |
3334 | + lambda file: 1)) |
3335 | board_conf.install_samsung_boot_loader( |
3336 | board_conf._get_samsung_spl(chroot_dir_value), |
3337 | board_conf._get_samsung_bootloader(chroot_dir_value), |
3338 | @@ -2843,9 +2858,9 @@ |
3339 | self.assertEqual(0, wait_partition_to_settle(media)) |
3340 | |
3341 | def test_wait_partitions_to_settle_raises_SubcommandNonZeroReturnValue( |
3342 | - self): |
3343 | + self): |
3344 | def mock_run(args, as_root=False, chroot=None, stdin=None, stdout=None, |
3345 | - stderr=None, cwd=None): |
3346 | + stderr=None, cwd=None): |
3347 | raise cmd_runner.SubcommandNonZeroReturnValue(args, 1) |
3348 | |
3349 | self.useFixture(MockSomethingFixture( |
3350 | @@ -2857,8 +2872,8 @@ |
3351 | media.is_block_device = True |
3352 | |
3353 | self.assertRaises(cmd_runner.SubcommandNonZeroReturnValue, |
3354 | - wait_partition_to_settle, |
3355 | - media) |
3356 | + wait_partition_to_settle, |
3357 | + media) |
3358 | |
3359 | |
3360 | class TestPartitionSetup(TestCaseWithFixtures): |
3361 | @@ -2873,7 +2888,7 @@ |
3362 | (16384 * SECTOR_SIZE, 15746 * SECTOR_SIZE), |
3363 | (32768 * SECTOR_SIZE, (self.linux_image_size - |
3364 | 32768 * SECTOR_SIZE)) |
3365 | - ] |
3366 | + ] |
3367 | self.android_image_size = 256 * 1024 ** 2 |
3368 | # Extended partition info takes 32 sectors from the first ext partition |
3369 | ext_part_size = 32 |
3370 | @@ -2885,7 +2900,7 @@ |
3371 | (131072 - ext_part_size) * SECTOR_SIZE), |
3372 | ((426047 + ext_part_size) * SECTOR_SIZE, |
3373 | self.android_image_size - (426047 + ext_part_size) * SECTOR_SIZE) |
3374 | - ] |
3375 | + ] |
3376 | |
3377 | self.android_snowball_offsets_and_sizes = [ |
3378 | (8192 * SECTOR_SIZE, 24639 * SECTOR_SIZE), |
3379 | @@ -2895,7 +2910,7 @@ |
3380 | (294975 * SECTOR_SIZE, 131072 * SECTOR_SIZE), |
3381 | ((426047 + ext_part_size) * SECTOR_SIZE, |
3382 | self.android_image_size - (426047 + ext_part_size) * SECTOR_SIZE) |
3383 | - ] |
3384 | + ] |
3385 | |
3386 | def tearDown(self): |
3387 | super(TestPartitionSetup, self).tearDown() |
3388 | @@ -2909,14 +2924,14 @@ |
3389 | def _create_android_tmpfile(self): |
3390 | # boot, system, cache, (extended), userdata and sdcard partitions |
3391 | return self._create_qemu_img_with_partitions( |
3392 | - '63,32768,0x0C,*\n32831,65536,L\n98367,65536,L\n294975,-,E\n' \ |
3393 | - '294975,131072,L\n426047,,,-', '%s' % self.android_image_size) |
3394 | + '63,32768,0x0C,*\n32831,65536,L\n98367,65536,L\n294975,-,E\n' |
3395 | + '294975,131072,L\n426047,,,-', '%s' % self.android_image_size) |
3396 | |
3397 | def _create_snowball_android_tmpfile(self): |
3398 | # raw, boot, system, cache, (extended), userdata and sdcard partitions |
3399 | return self._create_qemu_img_with_partitions( |
3400 | - '256,7936,0xDA\n8192,24639,0x0C,*\n32831,65536,L\n' \ |
3401 | - '98367,-,E\n98367,65536,L\n294975,131072,L\n' \ |
3402 | + '256,7936,0xDA\n8192,24639,0x0C,*\n32831,65536,L\n' |
3403 | + '98367,-,E\n98367,65536,L\n294975,131072,L\n' |
3404 | '426047,,,-', '%s' % self.android_image_size) |
3405 | |
3406 | def test_check_min_size_small(self): |
3407 | @@ -3144,7 +3159,7 @@ |
3408 | board_conf, Media(tmpfile), '2G', 'boot', |
3409 | 'root', 'ext3', True, True, True) |
3410 | self.assertEqual( |
3411 | - # This is the call that would create a 2 GiB image file. |
3412 | + # This is the call that would create a 2 GiB image file. |
3413 | ['dd of=%s bs=1 seek=2147483648 count=0' % tmpfile, |
3414 | '%s sfdisk -l %s' % (sudo_args, tmpfile), |
3415 | # This call would partition the image file. |
3416 | @@ -3214,8 +3229,8 @@ |
3417 | media = Media(tmpfile) |
3418 | media.is_block_device = True |
3419 | self.assertRaises(dbus.exceptions.DBusException, |
3420 | - _get_device_file_for_partition_number, |
3421 | - media.path, partition) |
3422 | + _get_device_file_for_partition_number, |
3423 | + media.path, partition) |
3424 | |
3425 | def test_get_device_file_for_partition_number(self): |
3426 | class Namespace: |
3427 | @@ -3357,13 +3372,13 @@ |
3428 | TestSetMetadata.MockHardwarepackHandler('ahwpack.tar.gz') |
3429 | self.config.hardwarepack_handler.get_format = lambda: '3.0' |
3430 | self.config.hardwarepack_handler.get_file = \ |
3431 | - lambda file_alias: ['file1', 'file2'] |
3432 | + lambda file_alias: ['file1', 'file2'] |
3433 | self.config.hardwarepack_handler.get_file_from_package = \ |
3434 | self.get_file_from_package |
3435 | self.config.bootloader_copy_files = { |
3436 | "package1": |
3437 | - [{"file1": "/boot/"}, |
3438 | - {"file2": "/boot/grub/renamed"}]} |
3439 | + [{"file1": "/boot/"}, |
3440 | + {"file2": "/boot/grub/renamed"}]} |
3441 | |
3442 | self.popen_fixture = self.useFixture(MockCmdRunnerPopenFixture()) |
3443 | self.useFixture(MockSomethingFixture( |
3444 | @@ -3403,7 +3418,8 @@ |
3445 | self.config.bootloader = "u_boot" |
3446 | self.call_populate_boot(self.config) |
3447 | expected_calls = self.expected_calls[:] |
3448 | - expected_calls.insert(2, |
3449 | + expected_calls.insert( |
3450 | + 2, |
3451 | '%s cp -v chroot_dir/usr/lib/u-boot/bootloader_flavor/u-boot.bin ' |
3452 | 'boot_disk' % sudo_args) |
3453 | self.assertEquals( |
3454 | @@ -3430,12 +3446,12 @@ |
3455 | expected_calls = self.expected_calls[:] |
3456 | expected_calls.insert(2, '%s mkdir -p boot_disk/boot' % sudo_args) |
3457 | expected_calls.insert(3, |
3458 | - '%s cp -v file1 ' |
3459 | - 'boot_disk/boot/' % sudo_args) |
3460 | + '%s cp -v file1 ' |
3461 | + 'boot_disk/boot/' % sudo_args) |
3462 | expected_calls.insert(4, '%s mkdir -p boot_disk/boot/grub' % sudo_args) |
3463 | expected_calls.insert(5, |
3464 | - '%s cp -v file2 ' |
3465 | - 'boot_disk/boot/grub/renamed' % sudo_args) |
3466 | + '%s cp -v file2 ' |
3467 | + 'boot_disk/boot/grub/renamed' % sudo_args) |
3468 | self.assertEquals( |
3469 | expected_calls, self.popen_fixture.mock.commands_executed) |
3470 | self.assertEquals(self.expected_args, self.saved_args) |
3471 | @@ -3524,7 +3540,7 @@ |
3472 | '%s mv %s %s %s' % ( |
3473 | sudo_args, contents_bin, contents_etc, root_disk), |
3474 | '%s dd if=/dev/zero of=%s bs=1M count=100' % ( |
3475 | - sudo_args, swap_file), |
3476 | + sudo_args, swap_file), |
3477 | '%s mkswap %s' % (sudo_args, swap_file), |
3478 | 'sync', |
3479 | '%s umount %s' % (sudo_args, root_disk)] |
3480 | @@ -3603,8 +3619,8 @@ |
3481 | |
3482 | def test_update_interfaces_no_interfaces_no_update(self): |
3483 | self.useFixture(MockSomethingFixture( |
3484 | - rootfs, 'write_data_to_protected_file', |
3485 | - self.mock_write_data_to_protected_file)) |
3486 | + rootfs, 'write_data_to_protected_file', |
3487 | + self.mock_write_data_to_protected_file)) |
3488 | tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir() |
3489 | os.makedirs(os.path.join(tempdir, 'etc', 'network')) |
3490 | if_path = os.path.join(tempdir, 'etc', 'network', 'interfaces') |
3491 | @@ -3614,8 +3630,8 @@ |
3492 | |
3493 | def test_update_interfaces_creates_entry(self): |
3494 | self.useFixture(MockSomethingFixture( |
3495 | - rootfs, 'write_data_to_protected_file', |
3496 | - self.mock_write_data_to_protected_file)) |
3497 | + rootfs, 'write_data_to_protected_file', |
3498 | + self.mock_write_data_to_protected_file)) |
3499 | tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir() |
3500 | os.makedirs(os.path.join(tempdir, 'etc', 'network')) |
3501 | if_path = os.path.join(tempdir, 'etc', 'network', 'interfaces') |
3502 | @@ -3630,8 +3646,8 @@ |
3503 | |
3504 | def test_update_interfaces_creates_entries(self): |
3505 | self.useFixture(MockSomethingFixture( |
3506 | - rootfs, 'write_data_to_protected_file', |
3507 | - self.mock_write_data_to_protected_file)) |
3508 | + rootfs, 'write_data_to_protected_file', |
3509 | + self.mock_write_data_to_protected_file)) |
3510 | tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir() |
3511 | os.makedirs(os.path.join(tempdir, 'etc', 'network')) |
3512 | if_path = os.path.join(tempdir, 'etc', 'network', 'interfaces') |
3513 | @@ -3650,8 +3666,8 @@ |
3514 | |
3515 | def test_update_interfaces_leaves_original(self): |
3516 | self.useFixture(MockSomethingFixture( |
3517 | - rootfs, 'write_data_to_protected_file', |
3518 | - self.mock_write_data_to_protected_file)) |
3519 | + rootfs, 'write_data_to_protected_file', |
3520 | + self.mock_write_data_to_protected_file)) |
3521 | tempdir = self.useFixture(CreateTempDirFixture()).get_temp_dir() |
3522 | os.makedirs(os.path.join(tempdir, 'etc', 'network')) |
3523 | if_path = os.path.join(tempdir, 'etc', 'network', 'interfaces') |
3524 | @@ -3791,11 +3807,11 @@ |
3525 | class TestInstallHWPack(TestCaseWithFixtures): |
3526 | def create_minimal_v3_hwpack(self, location, name, version, architecture): |
3527 | metadata = "\n".join([ |
3528 | - "name: " + name, |
3529 | - "version: " + version, |
3530 | - "architecture: " + architecture, |
3531 | - "format: 3.0" |
3532 | - ]) |
3533 | + "name: " + name, |
3534 | + "version: " + version, |
3535 | + "architecture: " + architecture, |
3536 | + "format: 3.0" |
3537 | + ]) |
3538 | print metadata |
3539 | tar_file = tarfile.open(location, mode='w:gz') |
3540 | tarinfo = tarfile.TarInfo("metadata") |
3541 | @@ -3806,7 +3822,7 @@ |
3542 | def mock_prepare_chroot(self, chroot_dir, tmp_dir): |
3543 | def fake_prepare_chroot(chroot_dir, tmp_dir): |
3544 | cmd_runner.run(['prepare_chroot %s %s' % (chroot_dir, tmp_dir)], |
3545 | - as_root=True).wait() |
3546 | + as_root=True).wait() |
3547 | self.useFixture(MockSomethingFixture( |
3548 | linaro_image_tools.media_create.chroot_utils, 'prepare_chroot', |
3549 | fake_prepare_chroot)) |
3550 | |
3551 | === modified file 'linaro_image_tools/tests/__init__.py' |
3552 | --- linaro_image_tools/tests/__init__.py 2012-12-10 17:32:21 +0000 |
3553 | +++ linaro_image_tools/tests/__init__.py 2013-02-18 14:17:36 +0000 |
3554 | @@ -21,7 +21,7 @@ |
3555 | from linaro_image_tools.hwpack.tests import test_suite as hwpack_suite |
3556 | from linaro_image_tools.media_create.tests import ( |
3557 | test_suite as media_create_suite, |
3558 | - ) |
3559 | +) |
3560 | from linaro_image_tools.utils import has_command |
3561 | |
3562 | |
3563 | @@ -29,7 +29,7 @@ |
3564 | module_names = [ |
3565 | 'linaro_image_tools.tests.test_cmd_runner', |
3566 | 'linaro_image_tools.tests.test_utils', |
3567 | - ] |
3568 | + ] |
3569 | # if pyflakes is installed and we're running from a bzr checkout... |
3570 | if has_command('pyflakes') and not os.path.isabs(__file__): |
3571 | # ...also run the pyflakes test |
3572 | |
3573 | === modified file 'linaro_image_tools/tests/test_cmd_runner.py' |
3574 | --- linaro_image_tools/tests/test_cmd_runner.py 2012-06-07 13:22:47 +0000 |
3575 | +++ linaro_image_tools/tests/test_cmd_runner.py 2013-02-18 14:17:36 +0000 |
3576 | @@ -24,7 +24,7 @@ |
3577 | from linaro_image_tools.tests.fixtures import ( |
3578 | MockCmdRunnerPopenFixture, |
3579 | MockSomethingFixture, |
3580 | - ) |
3581 | +) |
3582 | |
3583 | |
3584 | sudo_args = " ".join(cmd_runner.SUDO_ARGS) |
3585 | |
3586 | === modified file 'linaro_image_tools/tests/test_pep8.py' |
3587 | --- linaro_image_tools/tests/test_pep8.py 2012-06-13 16:10:46 +0000 |
3588 | +++ linaro_image_tools/tests/test_pep8.py 2013-02-18 14:17:36 +0000 |
3589 | @@ -29,10 +29,11 @@ |
3590 | # can be re-enabled once we drop support for natty. |
3591 | ignore = ['E202'] |
3592 | # Ignore return code. |
3593 | - proc = subprocess.Popen(['pep8', |
3594 | - '--repeat', |
3595 | - '--ignore=%s' % ','.join(ignore), |
3596 | - '.'], |
3597 | + proc = subprocess.Popen( |
3598 | + ['pep8', |
3599 | + '--repeat', |
3600 | + '--ignore=%s' % ','.join(ignore), |
3601 | + '.'], |
3602 | stdout=subprocess.PIPE, |
3603 | stderr=subprocess.PIPE) |
3604 | (stdout, stderr) = proc.communicate() |
3605 | |
3606 | === modified file 'linaro_image_tools/tests/test_pyflakes.py' |
3607 | --- linaro_image_tools/tests/test_pyflakes.py 2012-06-07 13:22:47 +0000 |
3608 | +++ linaro_image_tools/tests/test_pyflakes.py 2013-02-18 14:17:36 +0000 |
3609 | @@ -25,8 +25,8 @@ |
3610 | def test_pyflakes(self): |
3611 | # ignore return code |
3612 | proc = subprocess.Popen(['pyflakes', '.'], |
3613 | - stdout=subprocess.PIPE, |
3614 | - stderr=subprocess.PIPE) |
3615 | + stdout=subprocess.PIPE, |
3616 | + stderr=subprocess.PIPE) |
3617 | (stdout, stderr) = proc.communicate() |
3618 | self.assertEquals('', stdout) |
3619 | self.assertEquals('', stderr) |
3620 | |
3621 | === modified file 'linaro_image_tools/tests/test_utils.py' |
3622 | --- linaro_image_tools/tests/test_utils.py 2013-01-30 11:28:51 +0000 |
3623 | +++ linaro_image_tools/tests/test_utils.py 2013-02-18 14:17:36 +0000 |
3624 | @@ -32,7 +32,7 @@ |
3625 | CreateTempDirFixture, |
3626 | MockCmdRunnerPopenFixture, |
3627 | MockSomethingFixture, |
3628 | - ) |
3629 | +) |
3630 | from linaro_image_tools.utils import ( |
3631 | IncompatibleOptions, |
3632 | InvalidHwpackFile, |
3633 | @@ -48,7 +48,7 @@ |
3634 | preferred_tools_dir, |
3635 | prep_media_path, |
3636 | verify_file_integrity, |
3637 | - ) |
3638 | +) |
3639 | |
3640 | |
3641 | sudo_args = " ".join(cmd_runner.SUDO_ARGS) |
3642 | @@ -154,9 +154,9 @@ |
3643 | hash_filename = "dummy-file.txt" |
3644 | signature_filename = hash_filename + ".asc" |
3645 | result, verified_files = check_file_integrity_and_log_errors( |
3646 | - [signature_filename], |
3647 | - self.filenames_in_shafile[0], |
3648 | - [self.filenames_in_shafile[1]]) |
3649 | + [signature_filename], |
3650 | + self.filenames_in_shafile[0], |
3651 | + [self.filenames_in_shafile[1]]) |
3652 | self.assertEqual(self.filenames_in_shafile, verified_files) |
3653 | |
3654 | # The sha1sums are faked as passing and all commands return 0, so |
3655 | @@ -165,14 +165,14 @@ |
3656 | |
3657 | def test_check_file_integrity_and_print_errors_fail_sha1sum(self): |
3658 | logging.getLogger().setLevel(100) # Disable logging messages to screen |
3659 | - self.useFixture(MockSomethingFixture(cmd_runner, 'Popen', |
3660 | - self.MockCmdRunnerPopen_sha1sum_fail())) |
3661 | + self.useFixture(MockSomethingFixture( |
3662 | + cmd_runner, 'Popen', self.MockCmdRunnerPopen_sha1sum_fail())) |
3663 | hash_filename = "dummy-file.txt" |
3664 | signature_filename = hash_filename + ".asc" |
3665 | result, verified_files = check_file_integrity_and_log_errors( |
3666 | - [signature_filename], |
3667 | - self.filenames_in_shafile[0], |
3668 | - [self.filenames_in_shafile[1]]) |
3669 | + [signature_filename], |
3670 | + self.filenames_in_shafile[0], |
3671 | + [self.filenames_in_shafile[1]]) |
3672 | self.assertEqual([], verified_files) |
3673 | |
3674 | # The sha1sums are faked as failing and all commands return 0, so |
3675 | @@ -182,14 +182,14 @@ |
3676 | |
3677 | def test_check_file_integrity_and_print_errors_fail_gpg(self): |
3678 | logging.getLogger().setLevel(100) # Disable logging messages to screen |
3679 | - self.useFixture(MockSomethingFixture(cmd_runner, 'Popen', |
3680 | - self.MockCmdRunnerPopen_wait_fails())) |
3681 | + self.useFixture(MockSomethingFixture( |
3682 | + cmd_runner, 'Popen', self.MockCmdRunnerPopen_wait_fails())) |
3683 | hash_filename = "dummy-file.txt" |
3684 | signature_filename = hash_filename + ".asc" |
3685 | result, verified_files = check_file_integrity_and_log_errors( |
3686 | - [signature_filename], |
3687 | - self.filenames_in_shafile[0], |
3688 | - [self.filenames_in_shafile[1]]) |
3689 | + [signature_filename], |
3690 | + self.filenames_in_shafile[0], |
3691 | + [self.filenames_in_shafile[1]]) |
3692 | self.assertEqual([], verified_files) |
3693 | |
3694 | # The sha1sums are faked as passing and all commands return 1, so |
3695 | @@ -272,10 +272,9 @@ |
3696 | MockCmdRunnerPopenFixture(self.output_string)) |
3697 | install_package_providing('mkfs.vfat') |
3698 | self.assertEqual( |
3699 | - ['apt-get -s install dosfstools', |
3700 | - '%s apt-get --yes install dosfstools' % |
3701 | - sudo_args], |
3702 | - fixture.mock.commands_executed) |
3703 | + ['apt-get -s install dosfstools', |
3704 | + '%s apt-get --yes install dosfstools' % sudo_args], |
3705 | + fixture.mock.commands_executed) |
3706 | |
3707 | def test_package_installation_refused(self): |
3708 | self.useFixture(MockSomethingFixture(sys, |
3709 | |
3710 | === modified file 'linaro_image_tools/utils.py' |
3711 | --- linaro_image_tools/utils.py 2013-01-30 11:28:51 +0000 |
3712 | +++ linaro_image_tools/utils.py 2013-02-18 14:17:36 +0000 |
3713 | @@ -129,11 +129,11 @@ |
3714 | |
3715 | try: |
3716 | sha1sums_out, _ = cmd_runner.Popen( |
3717 | - ['sha1sum', '-c', hash_file], |
3718 | - stdout=subprocess.PIPE, |
3719 | - stderr=subprocess.STDOUT, |
3720 | - cwd=sha_cwd |
3721 | - ).communicate() |
3722 | + ['sha1sum', '-c', hash_file], |
3723 | + stdout=subprocess.PIPE, |
3724 | + stderr=subprocess.STDOUT, |
3725 | + cwd=sha_cwd |
3726 | + ).communicate() |
3727 | except cmd_runner.SubcommandNonZeroReturnValue as inst: |
3728 | sha1sums_out = inst.stdout |
3729 | |
3730 | @@ -171,7 +171,7 @@ |
3731 | |
3732 | for verified_file in verified_files: |
3733 | logger.info('Hash verification of file {0} OK.'.format( |
3734 | - verified_file)) |
3735 | + verified_file)) |
3736 | return True, verified_files |
3737 | |
3738 | |
3739 | @@ -214,15 +214,15 @@ |
3740 | print "Package installation is necessary to continue. Exiting." |
3741 | sys.exit(1) |
3742 | print ("Installing required command '%s' from package '%s'..." |
3743 | - % (command, package)) |
3744 | + % (command, package)) |
3745 | cmd_runner.run(['apt-get', '--yes', 'install', package], |
3746 | - as_root=True).wait() |
3747 | + as_root=True).wait() |
3748 | except EOFError: |
3749 | raise PackageInstallationRefused( |
3750 | - "Package installation interrupted: input error.") |
3751 | + "Package installation interrupted: input error.") |
3752 | except KeyboardInterrupt: |
3753 | raise PackageInstallationRefused( |
3754 | - "Package installation interrupted by the user.") |
3755 | + "Package installation interrupted by the user.") |
3756 | |
3757 | |
3758 | def has_command(command): |
3759 | |
3760 | === modified file 'setup.py' |
3761 | --- setup.py 2012-03-23 18:08:37 +0000 |
3762 | +++ setup.py 2013-02-18 14:17:36 +0000 |
3763 | @@ -6,17 +6,17 @@ |
3764 | |
3765 | |
3766 | DistUtilsExtra.auto.setup( |
3767 | - name="linaro-image-tools", |
3768 | - version=__version__, |
3769 | - description="Tools to create and write Linaro images", |
3770 | - url="https://launchpad.net/linaro-image-tools", |
3771 | - license="GPL v3 or later", |
3772 | - author='Linaro Infrastructure team', |
3773 | - author_email="linaro-dev@lists.linaro.org", |
3774 | + name="linaro-image-tools", |
3775 | + version=__version__, |
3776 | + description="Tools to create and write Linaro images", |
3777 | + url="https://launchpad.net/linaro-image-tools", |
3778 | + license="GPL v3 or later", |
3779 | + author='Linaro Infrastructure team', |
3780 | + author_email="linaro-dev@lists.linaro.org", |
3781 | |
3782 | - scripts=[ |
3783 | - "initrd-do", |
3784 | - "linaro-hwpack-create", "linaro-hwpack-install", |
3785 | - "linaro-media-create", "linaro-android-media-create", |
3786 | - "linaro-hwpack-replace"], |
3787 | - ) |
3788 | + scripts=[ |
3789 | + "initrd-do", |
3790 | + "linaro-hwpack-create", "linaro-hwpack-install", |
3791 | + "linaro-media-create", "linaro-android-media-create", |
3792 | + "linaro-hwpack-replace"], |
3793 | +) |
Hello Stevan!
Thanks for fixing all those PEP8 errors!
Everything looks good to me, I ran the tests on a 12.10 clean install, and I do not see any PEP8 tests failing. There are some that should be related to the command-not-found problem in another bug.
As far as this concerns PEP8, it looks good to me.