summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel-yocto.bbclass
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2012-03-02 11:36:07 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-13 11:45:08 +0000
commit0f64905840f3cc3602dc22a50b10d03d67704abb (patch)
tree765b6316a1bf3985c5f6da3615d0e3b1fc31b7cf /meta/classes/kernel-yocto.bbclass
parenteed3746db9936fd418ca391fd5163e46833a00b9 (diff)
downloadpoky-0f64905840f3cc3602dc22a50b10d03d67704abb.tar.gz
linux-yocto: respect FILESPATH directories
During the work to enhance the ability to specify out of tree kernel features, an assumption was made about PN being part of a patch path. This assumption is incorrect, since patches can be anywhere in the valid FILESPATH. To make locating the patches in WORKDIR simple, we can just query patch.bbclass and return both the absolute directory of the patch and the subdirectory as it was specified on the src_uri. (From OE-Core rev: ecade4c986e5045879ea204e31457c9b53a15e33) Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/kernel-yocto.bbclass')
-rw-r--r--meta/classes/kernel-yocto.bbclass30
1 files changed, 26 insertions, 4 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index aabca789cf..ce125b4cfb 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -1,6 +1,8 @@
1S = "${WORKDIR}/linux" 1S = "${WORKDIR}/linux"
2 2
3 3
4# returns local (absolute) path names for all valid patches in the
5# src_uri
4def find_patches(d): 6def find_patches(d):
5 patches=src_patches(d) 7 patches=src_patches(d)
6 patch_list=[] 8 patch_list=[]
@@ -10,6 +12,7 @@ def find_patches(d):
10 12
11 return patch_list 13 return patch_list
12 14
15# returns all the elements from the src uri that are .scc files
13def find_sccs(d): 16def find_sccs(d):
14 sources=src_patches(d, True) 17 sources=src_patches(d, True)
15 sources_list=[] 18 sources_list=[]
@@ -20,6 +23,22 @@ def find_sccs(d):
20 23
21 return sources_list 24 return sources_list
22 25
26# this is different from find_patches, in that it returns a colon separated
27# list of <patches>:<subdir> instead of just a list of patches
28def find_urls(d):
29 patches=src_patches(d)
30 fetch = bb.fetch2.Fetch([], d)
31 patch_list=[]
32 for p in patches:
33 _, _, local, _, _, _ = bb.decodeurl(p)
34 for url in fetch.urls:
35 urldata = fetch.ud[url]
36 if urldata.localpath == local:
37 patch_list.append(local+':'+urldata.path)
38
39 return patch_list
40
41
23do_patch() { 42do_patch() {
24 cd ${S} 43 cd ${S}
25 if [ -f ${WORKDIR}/defconfig ]; then 44 if [ -f ${WORKDIR}/defconfig ]; then
@@ -51,8 +70,8 @@ do_patch() {
51 exit 1 70 exit 1
52 fi 71 fi
53 72
54 patches="${@" ".join(find_patches(d))}"
55 sccs="${@" ".join(find_sccs(d))}" 73 sccs="${@" ".join(find_sccs(d))}"
74 patches_and_dirs="${@" ".join(find_urls(d))}"
56 75
57 # This loops through all patches, and looks for directories that do 76 # This loops through all patches, and looks for directories that do
58 # not already have feature descriptions. If a directory doesn't have 77 # not already have feature descriptions. If a directory doesn't have
@@ -66,14 +85,16 @@ do_patch() {
66 # to be repeated on the SRC_URI line .. which is more intutive 85 # to be repeated on the SRC_URI line .. which is more intutive
67 set +e 86 set +e
68 patch_dirs= 87 patch_dirs=
69 for p in ${patches}; do 88 for pp in ${patches_and_dirs}; do
89 p=`echo $pp | cut -f1 -d:`
90 wp=`echo $pp | cut -f2 -d:`
70 pdir=`dirname ${p}` 91 pdir=`dirname ${p}`
71 pname=`basename ${p}` 92 pname=`basename ${p}`
72 scc=`find ${pdir} -maxdepth 1 -name '*.scc'` 93 scc=`find ${pdir} -maxdepth 1 -name '*.scc'`
73 if [ -z "${scc}" ]; then 94 if [ -z "${scc}" ]; then
74 # there is no scc file. We need to switch to someplace that we know 95 # there is no scc file. We need to switch to someplace that we know
75 # we can create content (the workdir) 96 # we can create content (the workdir)
76 workdir_subdir=`echo ${pdir} | sed "s%^.*/${PN}%%" | sed 's%^/%%'` 97 workdir_subdir=`dirname ${wp}`
77 suggested_dir="${WORKDIR}/${workdir_subdir}" 98 suggested_dir="${WORKDIR}/${workdir_subdir}"
78 echo ${gen_feature_dirs} | grep -q ${suggested_dir} 99 echo ${gen_feature_dirs} | grep -q ${suggested_dir}
79 if [ $? -ne 0 ]; then 100 if [ $? -ne 0 ]; then
@@ -82,7 +103,8 @@ do_patch() {
82 # we call the file *.scc_tmp, so the test above will continue to find 103 # we call the file *.scc_tmp, so the test above will continue to find
83 # that patches from a common subdirectory don't have a scc file and 104 # that patches from a common subdirectory don't have a scc file and
84 # they'll be placed in order, into this file. We'll rename it later. 105 # they'll be placed in order, into this file. We'll rename it later.
85 echo "patch ${pname}" >> ${suggested_dir}/gen_${workdir_subdir}_desc.scc_tmp 106 gen_feature_name="gen_`echo ${workdir_subdir} | sed 's%/%%g'`_desc.scc_tmp"
107 echo "patch ${pname}" >> ${WORKDIR}/${workdir_subdir}/${gen_feature_name}
86 else 108 else
87 suggested_dir="${pdir}" 109 suggested_dir="${pdir}"
88 fi 110 fi