Bug 7723

Summary: Needed a way to identify layer name in bbclass to be able to filter out packages in specific layer.
Product: [Build System, Metadata & Runtime] BitBake Reporter: Alexander Kanevskiy <alexander.kanevskiy>
Component: bitbakeAssignee: Paul Eggleton <bluelightning>
Status: VERIFIED FIXED QA Contact: Costin <costin.c.constantin>
Severity: enhancement    
Priority: Medium+ CC: alexandru.c.georgescu, bluelightning, poky.bs.watcher, poky.watcher
Version: 1.9   
Target Milestone: 1.9 M1   
Hardware: Other   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Alexander Kanevskiy 2015-05-06 15:22:10 UTC
At the moment there is blacklist.bbclass implementation that is able to filter out recipe on global level. It would be good to have ability to filter recipe name or pattern of recipes if they are coming from specific layer. Or another example to implement layer specific "whitelist" of recipes to be used. 
For both of those, there is need to expose variable(s) that would be pointing beside $FILE or $PN from which layer name/path it's actually coming from.
Comment 1 Paul Eggleton 2015-05-06 16:11:12 UTC
I've pushed a branch with a patch that adds a function to bb.utils which does this:

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=paule/stuff
Comment 2 Paul Eggleton 2015-05-18 15:51:11 UTC
Patch sent for review:
http://patchwork.openembedded.org/patch/93813/
Comment 3 Alexander Kanevskiy 2015-05-18 16:07:05 UTC
BTW, once it's get implemented, it would be good to also include in 1.8.x maintenance releases.
Comment 4 Paul Eggleton 2015-05-22 15:43:35 UTC
Sure, I've just sent a backport to bitbake 1.26, which will feed into the fido branch in poky when merged.
Comment 5 Paul Eggleton 2015-05-27 09:12:48 UTC
Now in the fido branch as well:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?h=fido&id=ca6ef30c7a33b3860d9b0d0da51d9b8786073170

Marking as resolved.
Comment 6 Costin 2015-06-16 02:53:02 UTC
Hello,

Checked this feature and it works.
Steps performed to test it:

1)vi meta/recipes-tests/teste/teste_1.0.0.bb

SUMARY = "test recipe"

LICENSE = "CLOSED"

python do_mytask(){
  bb.note("running mytest")
  result = bb.utils.get_file_layer("/media/cosscat/Touro/5poky/meta/recipes-devtools/m4/m4_1.4.17.bb",d)
  bb.note(result)
}

addtask do_mytask before do_build

2) bitbake teste
3) cat log.do_mytask
DEBUG: Executing python function do_mytask
NOTE: running mytest
NOTE: core
DEBUG: Python function do_mytask finished 

Marking as verified.

Costin