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 @@ 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 : 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