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

Proposed by Milo Casagrande
Status: Merged
Approved by: Данило Шеган
Approved revision: 600
Merged at revision: 596
Proposed branch: lp:~milo/linaro-image-tools/hwpack-args
Merge into: lp:linaro-image-tools/11.11
Prerequisite: lp:~milo/linaro-image-tools/android-boards
Diff against target: 97 lines (+20/-3)
3 files modified
linaro-android-media-create (+8/-0)
linaro_image_tools/media_create/__init__.py (+4/-3)
linaro_image_tools/utils.py (+8/-0)
To merge this branch: bzr merge lp:~milo/linaro-image-tools/hwpack-args
Reviewer Review Type Date Requested Status
Данило Шеган (community) Approve
Review via email: mp+138235@code.launchpad.net

Commit message

Added command line option for Android hwpack.

Description of the change

The proposed branch adds support for the new l-a-m-c command line option to pass and Android hwpack.
A small refactoring has been done: the debug option has been moved as a common option to all the args parser.

To post a comment you must log in.
594. By Milo Casagrande

Merged android-boards into hwpack-args.

595. By Milo Casagrande

Merged android-boards into hwpack-args.

596. By Milo Casagrande

Merged android-boards into hwpack-args.

597. By Milo Casagrande

Merged android-boards into hwpack-args.

598. By Milo Casagrande

Merged android-boards into hwpack-args.

599. By Milo Casagrande

Merged android-boards into hwpack-args.

600. By Milo Casagrande

Merged android-boards into hwpack-args.

Revision history for this message
Данило Шеган (danilo) wrote :

Revert the atexit.register change (as discussed), and good to go.

review: Approve
601. By Milo Casagrande

Reverted atexit call.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro-android-media-create'
2--- linaro-android-media-create 2012-12-28 16:00:31 +0000
3+++ linaro-android-media-create 2012-12-28 16:00:32 +0000
4@@ -41,6 +41,7 @@
5 )
6 from linaro_image_tools.media_create import get_android_args_parser
7 from linaro_image_tools.utils import (
8+ additional_android_option_checks,
9 ensure_command,
10 get_logger
11 )
12@@ -93,6 +94,8 @@
13
14 logger = get_logger(debug=args.debug)
15
16+ additional_android_option_checks(args)
17+
18 # If --help was specified this won't execute.
19 # Create temp dir and initialize rest of path vars.
20 TMP_DIR = tempfile.mkdtemp()
21@@ -107,6 +110,11 @@
22 SDCARD_DISK = os.path.join(TMP_DIR, 'sdcard-disc')
23
24 board_config = get_board_config(args.dev)
25+ if args.hwpack:
26+ board_config.from_file(args.hwpack)
27+ else:
28+ logger.warning("No Android hwpack provided: default board values "
29+ "will be used.")
30 board_config.add_boot_args(args.extra_boot_args)
31 board_config.add_boot_args_from_file(args.extra_boot_args_file)
32
33
34=== modified file 'linaro_image_tools/media_create/__init__.py'
35--- linaro_image_tools/media_create/__init__.py 2012-10-22 06:57:20 +0000
36+++ linaro_image_tools/media_create/__init__.py 2012-12-28 16:00:32 +0000
37@@ -78,6 +78,7 @@
38 parser.add_argument(
39 '--extra-boot-args-file', dest='extra_boot_args_file',
40 required=False, help=('File containing extra boot arguments.'))
41+ parser.add_argument("--debug", action="store_true")
42
43
44 def get_args_parser():
45@@ -173,7 +174,6 @@
46 help="Select a bootloader from a hardware pack that contains more "
47 "than one. If not specified, it will default to '%s'." %
48 DEFAULT_BOOTLOADER)
49- parser.add_argument("--debug", action="store_true")
50
51 add_common_options(parser)
52 return parser
53@@ -189,6 +189,9 @@
54 '--image-file', '--image_file', dest='device',
55 help='File where we should write the image file.')
56 parser.add_argument(
57+ '--hwpack', required=False,
58+ help=('An Android hardware pack file with the board configuration.'))
59+ parser.add_argument(
60 '--image-size', '--image_size', default='2G',
61 help=('The image size, specified in mega/giga bytes (e.g. 3000M or '
62 '3G); use with --image_file only'))
63@@ -202,7 +205,6 @@
64 '--console', action='append', dest='consoles', default=[],
65 help=('Add a console to kernel boot parameter; this parameter can be '
66 'defined multiple times.'))
67-
68 parser.add_argument(
69 '--system', default='system.tar.bz2', required=True,
70 help=('The tarball containing the Android system paritition'))
71@@ -212,7 +214,6 @@
72 parser.add_argument(
73 '--boot', default='boot.tar.bz2', required=True,
74 help=('The tarball containing the Android root partition'))
75-
76 parser.add_argument(
77 '--no-part', dest='should_create_partitions', action='store_false',
78 help='Reuse existing partitions on the given media.')
79
80=== modified file 'linaro_image_tools/utils.py'
81--- linaro_image_tools/utils.py 2012-10-22 06:57:20 +0000
82+++ linaro_image_tools/utils.py 2012-12-28 16:00:32 +0000
83@@ -346,6 +346,14 @@
84 "--hwpack argument (%s) is not a regular file" % hwpack)
85
86
87+def additional_android_option_checks(args):
88+ """Checks that some of the args passed to l-a-m-c are valid."""
89+ if args.hwpack:
90+ if not os.path.isfile(args.hwpack):
91+ raise InvalidHwpackFile(
92+ "--hwpack argument (%s) is not a regular file" % args.hwpack)
93+
94+
95 def check_required_args(args):
96 """Check that the required args are passed."""
97 if args.dev is None:

Subscribers

People subscribed via source and target branches