| Summary: | bbclass file name convention is not consistent wrt dash and underscore ( - _ ) | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Randy MacLeod <randy.macleod> | ||||||
| Component: | oe-core other | Assignee: | Saul Wold <sgw> | ||||||
| Status: | RESOLVED WORKSFORME | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | Medium | CC: | open.source, richard.purdie, sgw | ||||||
| Version: | 3.3 | ||||||||
| Target Milestone: | 5.0 | ||||||||
| Hardware: | All | ||||||||
| OS: | Multiple | ||||||||
| Whiteboard: | NEWCOMER | ||||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||||
| Verified: | Documentation change: | Yes (doc changes required) | |||||||
| Attachments: |
|
||||||||
|
Description
Randy MacLeod
2021-02-15 20:23:23 UTC
$ ls meta/classes/*-* | wc -l 68 $ ls meta/classes/*_* | wc -l 38 dashes win! We should improve usability by: 1. Check export functions for dashes 2. Check for shell function names with dashes 3. Create a list of known classes and error if not in that list and contains a dash 4. We could do pattern matching on names that are not found. Some of these things can be done by a NEWCOMER, Please comment on this bug if you are going to work on it. I would happily work on this one. Is there a decision on how to handle the issue? Oleksandr, Richard wanted to do this incrementally and certainly not do a mass renaming. Perhaps the best way to get started is to implement: 3. Create a list of known classes and error if not in that list and contains a dash 4. We could do pattern matching on names that are not found. I think that 4. starts as a warning and becomes an error in a future release. Build move to 5.0 -- ../Randy Proof of concept scripts attached it uses tinfoil to scan the BBCLASS path and find bbclasses then searches for unknwon bbclasses that contains "_" in filename. It also checks existing bbclasses for '-' in either addtask or EXPORT_FUNCTIONS directives. /poky$ scripts/check-bbclasses Loading cache: 100% |#################################################| Time: 0:00:00 Loaded 1927 entries from dependency cache. Warning: BBClass file name contains '_': poky/meta/classes/bad_bbclass.bbclass Warning: addtask contains '-': /poky/meta/classes/bad_bbclass.bbclass: addtask do-bad-task Warning: EXPORT_FUNCTIONS contains '-': /poky/meta/classes/bad_bbclass.bbclass: EXPORT_FUNCTIONS do-bad-function Created attachment 5003 [details]
Prototype script
Created attachment 5004 [details]
test bbclass
Due to the combination of '-' and shell function, we can not use '-' in bbclass file names, so instead it should be _, which just means more change over time. ERROR: The classname dash-bbclass contains a dash character and is calling an sh function dash-bbclass_do_dash_shell_function using EXPORT_FUNCTIONS. Since a dash is illegal in sh function names, this cannot work, please rename the class or don't use EXPORT_FUNCTIONS. ERROR: Unable to parse /home/swold/src/yocto/poky/bitbake/lib/bb/__init__.py Saul, Thanks for looking into this bug which aims at making the class file names follow a pattern. I'm fine with picking "_" rather than "-" due to shell restrictions. As you've found, dashes give problems with shell and function names so underscores are preferred when used in class names. Users to tend to prefer dashes though. I added the error to export functions a while back as a compromise around this issue, to ensure people know in the cases things really break. I'm torn on all this to be honest, not sure what the best thing to do is. Since we have limits to how consistent things can be we are closing this bug and if people are working on one of the files that can be renamed, they can do so. -- YP bug review (Randy) moving back to 5.0 since we aren't going to be doing a mass change. |