diff options
| author | Tom Zanussi <tom.zanussi@intel.com> | 2013-03-11 21:46:37 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-03-17 23:10:28 +0000 |
| commit | 2518215438119804290aa8149936ebde0fcc89d3 (patch) | |
| tree | a3e986b4c29fbf6129516c62e5ec5a4982fa049d /scripts/lib | |
| parent | 934f2ed2539e046f91a234d30fc4da71ffbe28a0 (diff) | |
| download | poky-2518215438119804290aa8149936ebde0fcc89d3.tar.gz | |
yocto-kernel: add support for printing kernel feature descriptions
Add a yocto-kernel command allowing users to print the description and
compatibility of a given kernel feature.
(From meta-yocto rev: 73b4f1a8d156af6810cdde3af672d6286a7071e7)
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/bsp/help.py | 29 | ||||
| -rw-r--r-- | scripts/lib/bsp/kernel.py | 50 |
2 files changed, 79 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 | """ |
