summaryrefslogtreecommitdiff
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:44:44 +0000
commitecade4c986e5045879ea204e31457c9b53a15e33 (patch)
tree6ff25121b9cad9f5dad5fe5407ee2e0c29a7408e /meta/classes/kernel-yocto.bbclass
parent689c9e6e5487292e3e54faceb741fa59478d9386 (diff)
downloadopenembedded-core-ecade4c986e5045879ea204e31457c9b53a15e33.tar.gz
openembedded-core-ecade4c986e5045879ea204e31457c9b53a15e33.tar.bz2
openembedded-core-ecade4c986e5045879ea204e31457c9b53a15e33.tar.xz
openembedded-core-ecade4c986e5045879ea204e31457c9b53a15e33.zip
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. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
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 aabca789c..ce125b4cf 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -1,6 +1,8 @@
S = "${WORKDIR}/linux"
+# returns local (absolute) path names for all valid patches in the
+# src_uri
def find_patches(d):
patches=src_patches(d)
patch_list=[]
@@ -10,6 +12,7 @@ def find_patches(d):
return patch_list
+# returns all the elements from the src uri that are .scc files
def find_sccs(d):
sources=src_patches(d, True)
sources_list=[]
@@ -20,6 +23,22 @@ def find_sccs(d):
return sources_list
+# this is different from find_patches, in that it returns a colon separated
+# list of <patches>:<subdir> instead of just a list of patches
+def find_urls(d):
+ patches=src_patches(d)
+ fetch = bb.fetch2.Fetch([], d)
+ patch_list=[]
+ for p in patches:
+ _, _, local, _, _, _ = bb.decodeurl(p)
+ for url in fetch.urls:
+ urldata = fetch.ud[url]
+ if urldata.localpath == local:
+ patch_list.append(local+':'+urldata.path)
+
+ return patch_list
+
+
do_patch() {
cd ${S}
if [ -f ${WORKDIR}/defconfig ]; then
@@ -51,8 +70,8 @@ do_patch() {
exit 1
fi
- patches="${@" ".join(find_patches(d))}"
sccs="${@" ".join(find_sccs(d))}"
+ patches_and_dirs="${@" ".join(find_urls(d))}"
# This loops through all patches, and looks for directories that do
# not already have feature descriptions. If a directory doesn't have
@@ -66,14 +85,16 @@ do_patch() {
# to be repeated on the SRC_URI line .. which is more intutive
set +e
patch_dirs=
- for p in ${patches}; do
+ for pp in ${patches_and_dirs}; do
+ p=`echo $pp | cut -f1 -d:`
+ wp=`echo $pp | cut -f2 -d:`
pdir=`dirname ${p}`
pname=`basename ${p}`
scc=`find ${pdir} -maxdepth 1 -name '*.scc'`
if [ -z "${scc}" ]; then
# there is no scc file. We need to switch to someplace that we know
# we can create content (the workdir)
- workdir_subdir=`echo ${pdir} | sed "s%^.*/${PN}%%" | sed 's%^/%%'`
+ workdir_subdir=`dirname ${wp}`
suggested_dir="${WORKDIR}/${workdir_subdir}"
echo ${gen_feature_dirs} | grep -q ${suggested_dir}
if [ $? -ne 0 ]; then
@@ -82,7 +103,8 @@ do_patch() {
# we call the file *.scc_tmp, so the test above will continue to find
# that patches from a common subdirectory don't have a scc file and
# they'll be placed in order, into this file. We'll rename it later.
- echo "patch ${pname}" >> ${suggested_dir}/gen_${workdir_subdir}_desc.scc_tmp
+ gen_feature_name="gen_`echo ${workdir_subdir} | sed 's%/%%g'`_desc.scc_tmp"
+ echo "patch ${pname}" >> ${WORKDIR}/${workdir_subdir}/${gen_feature_name}
else
suggested_dir="${pdir}"
fi