diff options
| -rw-r--r-- | scripts/lib/bsp/help.py | 29 | ||||
| -rw-r--r-- | scripts/lib/bsp/kernel.py | 50 | ||||
| -rwxr-xr-x | scripts/yocto-kernel | 26 |
3 files changed, 105 insertions, 0 deletions
diff --git a/scripts/lib/bsp/help.py b/scripts/lib/bsp/help.py index 9ba6a931ee..91de60017e 100644 --- a/scripts/lib/bsp/help.py +++ b/scripts/lib/bsp/help.py | |||
| @@ -387,6 +387,7 @@ yocto_kernel_usage = """ | |||
| 387 | feature add Have a BSP use a feature | 387 | feature add Have a BSP use a feature |
| 388 | feature rm Have a BSP stop using a feature | 388 | feature rm Have a BSP stop using a feature |
| 389 | features list List the features available to BSPs | 389 | features list List the features available to BSPs |
| 390 | feature describe Describe a particular feature | ||
| 390 | 391 | ||
| 391 | See 'yocto-kernel help COMMAND' for more information on a specific command. | 392 | See 'yocto-kernel help COMMAND' for more information on a specific command. |
| 392 | 393 | ||
| @@ -723,6 +724,34 @@ DESCRIPTION | |||
| 723 | """ | 724 | """ |
| 724 | 725 | ||
| 725 | 726 | ||
| 727 | yocto_kernel_feature_describe_usage = """ | ||
| 728 | |||
| 729 | Print the description and compatibility information for a given kernel feature | ||
| 730 | |||
| 731 | usage: yocto-kernel feature describe <bsp-name> [/xxxx/yyyy/feature.scc ...] | ||
| 732 | |||
| 733 | This command prints the description and compatibility of a specific | ||
| 734 | feature in the format 'description [compatibility]. | ||
| 735 | """ | ||
| 736 | |||
| 737 | |||
| 738 | yocto_kernel_feature_describe_help = """ | ||
| 739 | |||
| 740 | NAME | ||
| 741 | yocto-kernel feature describe - print the description and | ||
| 742 | compatibility information for a given kernel feature | ||
| 743 | |||
| 744 | SYNOPSIS | ||
| 745 | yocto-kernel feature describe <bsp-name> [/xxxx/yyyy/feature.scc ...] | ||
| 746 | |||
| 747 | DESCRIPTION | ||
| 748 | This command prints the description and compatibility of a | ||
| 749 | specific feature in the format 'description [compatibility]. If | ||
| 750 | the feature doesn't define a description or compatibility, a | ||
| 751 | string with generic unknown values will be printed. | ||
| 752 | """ | ||
| 753 | |||
| 754 | |||
| 726 | ## | 755 | ## |
| 727 | # yocto-layer help and usage strings | 756 | # yocto-layer help and usage strings |
| 728 | ## | 757 | ## |
diff --git a/scripts/lib/bsp/kernel.py b/scripts/lib/bsp/kernel.py index 0308600a42..ac0b074b5d 100644 --- a/scripts/lib/bsp/kernel.py +++ b/scripts/lib/bsp/kernel.py | |||
| @@ -758,6 +758,56 @@ def yocto_kernel_available_features_list(scripts_path, machine): | |||
| 758 | print_feature_descs(layer, "features") | 758 | print_feature_descs(layer, "features") |
| 759 | 759 | ||
| 760 | 760 | ||
| 761 | def find_feature_desc_url(git_url, feature): | ||
| 762 | """ | ||
| 763 | Find the url of the kernel feature in the kernel repo specified | ||
| 764 | from the BSP's kernel recipe SRC_URI. | ||
| 765 | """ | ||
| 766 | feature_desc_url = "" | ||
| 767 | if git_url.startswith("git://"): | ||
| 768 | git_url = git_url[len("git://"):].strip() | ||
| 769 | s = git_url.split("/") | ||
| 770 | if s[1].endswith(".git"): | ||
| 771 | s[1] = s[1][:len(s[1]) - len(".git")] | ||
| 772 | feature_desc_url = "http://" + s[0] + "/cgit/cgit.cgi/" + s[1] + \ | ||
| 773 | "/plain/meta/cfg/kernel-cache/" + feature + "?h=meta" | ||
| 774 | |||
| 775 | return feature_desc_url | ||
| 776 | |||
| 777 | |||
| 778 | def get_feature_desc(git_url, feature): | ||
| 779 | """ | ||
| 780 | Return a feature description of the form 'description [compatibility] | ||
| 781 | BSPs, as gathered from the set of feature sources. | ||
| 782 | """ | ||
| 783 | feature_desc_url = find_feature_desc_url(git_url, feature) | ||
| 784 | feature_desc_cmd = "wget -q -O - " + feature_desc_url | ||
| 785 | tmp = subprocess.Popen(feature_desc_cmd, shell=True, stdout=subprocess.PIPE).stdout.read() | ||
| 786 | |||
| 787 | return find_feature_desc(tmp.split("\n")) | ||
| 788 | |||
| 789 | |||
| 790 | def yocto_kernel_feature_describe(scripts_path, machine, feature): | ||
| 791 | """ | ||
| 792 | Display the description of a specific kernel feature available for | ||
| 793 | use in a BSP. | ||
| 794 | """ | ||
| 795 | layer = find_bsp_layer(scripts_path, machine) | ||
| 796 | |||
| 797 | kernel = find_current_kernel(layer, machine) | ||
| 798 | if not kernel: | ||
| 799 | print "Couldn't determine the kernel for this BSP, exiting." | ||
| 800 | sys.exit(1) | ||
| 801 | |||
| 802 | context = create_context(machine, "arch", scripts_path) | ||
| 803 | context["name"] = "name" | ||
| 804 | context["filename"] = kernel | ||
| 805 | giturl = find_giturl(context) | ||
| 806 | |||
| 807 | desc = get_feature_desc(giturl, feature) | ||
| 808 | |||
| 809 | print desc | ||
| 810 | |||
| 761 | 811 | ||
| 762 | def base_branches(context): | 812 | def base_branches(context): |
| 763 | """ | 813 | """ |
diff --git a/scripts/yocto-kernel b/scripts/yocto-kernel index a66a7272db..1f6ed67c04 100755 --- a/scripts/yocto-kernel +++ b/scripts/yocto-kernel | |||
| @@ -243,6 +243,29 @@ def yocto_kernel_available_features_list_subcommand(args, usage_str): | |||
| 243 | yocto_kernel_available_features_list(scripts_path, args[0]) | 243 | yocto_kernel_available_features_list(scripts_path, args[0]) |
| 244 | 244 | ||
| 245 | 245 | ||
| 246 | def yocto_kernel_feature_describe_subcommand(args, usage_str): | ||
| 247 | """ | ||
| 248 | Command-line handling for listing the description of a specific | ||
| 249 | kernel feature available for use in a BSP. This includes the | ||
| 250 | features present in the meta branch(es) of the pointed-to repo(s) | ||
| 251 | as well as the local features added in recipe-space to the current | ||
| 252 | BSP as well. The real work is done by | ||
| 253 | bsp.kernel.yocto_kernel_feature_describe(). | ||
| 254 | """ | ||
| 255 | logging.debug("yocto_kernel_feature_describe_subcommand") | ||
| 256 | |||
| 257 | parser = optparse.OptionParser(usage = usage_str) | ||
| 258 | |||
| 259 | (options, args) = parser.parse_args(args) | ||
| 260 | |||
| 261 | if len(args) != 2: | ||
| 262 | logging.error("Wrong number of arguments, exiting\n") | ||
| 263 | parser.print_help() | ||
| 264 | sys.exit(1) | ||
| 265 | |||
| 266 | yocto_kernel_feature_describe(scripts_path, args[0], args[1]) | ||
| 267 | |||
| 268 | |||
| 246 | subcommands = { | 269 | subcommands = { |
| 247 | "config-list": [yocto_kernel_config_list_subcommand, | 270 | "config-list": [yocto_kernel_config_list_subcommand, |
| 248 | yocto_kernel_config_list_usage, | 271 | yocto_kernel_config_list_usage, |
| @@ -274,6 +297,9 @@ subcommands = { | |||
| 274 | "features-list": [yocto_kernel_available_features_list_subcommand, | 297 | "features-list": [yocto_kernel_available_features_list_subcommand, |
| 275 | yocto_kernel_available_features_list_usage, | 298 | yocto_kernel_available_features_list_usage, |
| 276 | yocto_kernel_available_features_list_help], | 299 | yocto_kernel_available_features_list_help], |
| 300 | "feature-describe": [yocto_kernel_feature_describe_subcommand, | ||
| 301 | yocto_kernel_feature_describe_usage, | ||
| 302 | yocto_kernel_feature_describe_help], | ||
| 277 | } | 303 | } |
| 278 | 304 | ||
| 279 | 305 | ||
