diff options
| author | Tom Zanussi <tom.zanussi@intel.com> | 2012-04-11 14:05:08 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-04-14 22:58:14 +0100 |
| commit | 6f527e23e045fd948fddf6775705f4f7f7feefd6 (patch) | |
| tree | 0b2b822c4f8dd3d7183871af8c5edabeae5d066d /scripts/lib | |
| parent | 0a4a7578b84059d598aa775cc6362e1ef68ec3b3 (diff) | |
| download | poky-6f527e23e045fd948fddf6775705f4f7f7feefd6.tar.gz | |
yocto-bsp: enable property value display of nested properties
Previous versions of yocto-bsp mapped every input element to a unique
variable name, which is what the current property value display code
expects. When that was changed to a nested form, the display code
wasn't updated to match - this updated does that.
Fixes [YOCTO #2222]
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/bsp/engine.py | 56 | ||||
| -rw-r--r-- | scripts/lib/bsp/kernel.py | 2 |
2 files changed, 55 insertions, 3 deletions
diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py index d2f0735a65..8e53f00bd2 100644 --- a/scripts/lib/bsp/engine.py +++ b/scripts/lib/bsp/engine.py | |||
| @@ -1222,8 +1222,7 @@ def yocto_bsp_create(machine, arch, scripts_path, bsp_output_dir, codedump, prop | |||
| 1222 | context = create_context(machine, arch, scripts_path) | 1222 | context = create_context(machine, arch, scripts_path) |
| 1223 | target_files = expand_targets(context, bsp_output_dir) | 1223 | target_files = expand_targets(context, bsp_output_dir) |
| 1224 | 1224 | ||
| 1225 | if not properties: | 1225 | input_lines = gather_inputlines(target_files) |
| 1226 | input_lines = gather_inputlines(target_files) | ||
| 1227 | 1226 | ||
| 1228 | program_lines = [] | 1227 | program_lines = [] |
| 1229 | 1228 | ||
| @@ -1316,6 +1315,44 @@ def yocto_bsp_list_properties(arch, scripts_path, properties_file): | |||
| 1316 | print_dict(properties) | 1315 | print_dict(properties) |
| 1317 | 1316 | ||
| 1318 | 1317 | ||
| 1318 | def split_nested_property(property): | ||
| 1319 | """ | ||
| 1320 | A property name of the form x.y describes a nested property | ||
| 1321 | i.e. the property y is contained within x and can be addressed | ||
| 1322 | using standard JSON syntax for nested properties. Note that if a | ||
| 1323 | property name itself contains '.', it should be contained in | ||
| 1324 | double quotes. | ||
| 1325 | """ | ||
| 1326 | splittable_property = "" | ||
| 1327 | in_quotes = False | ||
| 1328 | for c in property: | ||
| 1329 | if c == '.' and not in_quotes: | ||
| 1330 | splittable_property += '\n' | ||
| 1331 | continue | ||
| 1332 | if c == '"': | ||
| 1333 | in_quotes = not in_quotes | ||
| 1334 | splittable_property += c | ||
| 1335 | |||
| 1336 | split_properties = splittable_property.split('\n') | ||
| 1337 | |||
| 1338 | if len(split_properties) > 1: | ||
| 1339 | return split_properties | ||
| 1340 | |||
| 1341 | return None | ||
| 1342 | |||
| 1343 | |||
| 1344 | def find_input_line_group(substring, input_lines): | ||
| 1345 | """ | ||
| 1346 | Find and return the InputLineGroup containing the specified substring. | ||
| 1347 | """ | ||
| 1348 | for line in input_lines: | ||
| 1349 | if isinstance(line, InputLineGroup): | ||
| 1350 | if substring in line.group[0].line: | ||
| 1351 | return line | ||
| 1352 | |||
| 1353 | return None | ||
| 1354 | |||
| 1355 | |||
| 1319 | def find_input_line(name, input_lines): | 1356 | def find_input_line(name, input_lines): |
| 1320 | """ | 1357 | """ |
| 1321 | Find the input line with the specified name. | 1358 | Find the input line with the specified name. |
| @@ -1330,6 +1367,8 @@ def find_input_line(name, input_lines): | |||
| 1330 | try: | 1367 | try: |
| 1331 | if line.props["name"] == name: | 1368 | if line.props["name"] == name: |
| 1332 | return line | 1369 | return line |
| 1370 | if line.props["name"] + "_" + line.props["nameappend"] == name: | ||
| 1371 | return line | ||
| 1333 | except KeyError: | 1372 | except KeyError: |
| 1334 | pass | 1373 | pass |
| 1335 | 1374 | ||
| @@ -1363,6 +1402,17 @@ def yocto_bsp_list_property_values(arch, property, scripts_path, properties_file | |||
| 1363 | 1402 | ||
| 1364 | properties = get_properties(input_lines) | 1403 | properties = get_properties(input_lines) |
| 1365 | 1404 | ||
| 1405 | nested_properties = split_nested_property(property) | ||
| 1406 | if nested_properties: | ||
| 1407 | # currently the outer property of a nested property always | ||
| 1408 | # corresponds to an input line group | ||
| 1409 | input_line_group = find_input_line_group(nested_properties[0], input_lines) | ||
| 1410 | if input_line_group: | ||
| 1411 | input_lines[:] = input_line_group.group[1:] | ||
| 1412 | # The inner property of a nested property name is the | ||
| 1413 | # actual property name we want, so reset to that | ||
| 1414 | property = nested_properties[1] | ||
| 1415 | |||
| 1366 | input_line = find_input_line(property, input_lines) | 1416 | input_line = find_input_line(property, input_lines) |
| 1367 | if not input_line: | 1417 | if not input_line: |
| 1368 | print "Couldn't find values for property %s" % property | 1418 | print "Couldn't find values for property %s" % property |
| @@ -1376,6 +1426,8 @@ def yocto_bsp_list_property_values(arch, property, scripts_path, properties_file | |||
| 1376 | elif type == "choicelist" or type == "checklist": | 1426 | elif type == "choicelist" or type == "checklist": |
| 1377 | try: | 1427 | try: |
| 1378 | gen_fn = input_line.props["gen"] | 1428 | gen_fn = input_line.props["gen"] |
| 1429 | if nested_properties: | ||
| 1430 | context["filename"] = nested_properties[0] | ||
| 1379 | values_list = input_line.gen_choices_list(context, False) | 1431 | values_list = input_line.gen_choices_list(context, False) |
| 1380 | except KeyError: | 1432 | except KeyError: |
| 1381 | for choice in input_line.choices: | 1433 | for choice in input_line.choices: |
diff --git a/scripts/lib/bsp/kernel.py b/scripts/lib/bsp/kernel.py index b4e7fbf062..360851b205 100644 --- a/scripts/lib/bsp/kernel.py +++ b/scripts/lib/bsp/kernel.py | |||
| @@ -657,7 +657,7 @@ def find_giturl(context): | |||
| 657 | bbs = glob.glob(bbglob) | 657 | bbs = glob.glob(bbglob) |
| 658 | for kernel in bbs: | 658 | for kernel in bbs: |
| 659 | filename = os.path.splitext(os.path.basename(kernel))[0] | 659 | filename = os.path.splitext(os.path.basename(kernel))[0] |
| 660 | if filename == filebase: | 660 | if filename in filebase: |
| 661 | giturl = extract_giturl(kernel) | 661 | giturl = extract_giturl(kernel) |
| 662 | return giturl | 662 | return giturl |
| 663 | 663 | ||
