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/bsp/kernel.py | |
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/bsp/kernel.py')
-rw-r--r-- | scripts/lib/bsp/kernel.py | 50 |
1 files changed, 50 insertions, 0 deletions
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 | """ |