Bug 6372

Summary: Feature request: recipe hook for source tree preparation
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Christopher Larson <kergoth>
Component: coreAssignee: Unassigned <unassigned>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: Medium CC: bluelightning, meta.mr.watcher, meta.watcher, randy.macleod, richard.purdie, sgw
Version: unspecified   
Target Milestone: Future   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description Christopher Larson 2014-05-23 17:14:56 UTC
It's a common pattern among recipes to need to tweak the source tree after fetch/unpack/patch but before configuration. It's done to move files from workdir, sed files in the source tree, move things around, kill local m4 macros, move aclocal.m4 to acinclude.m4, etc. Often recipes will do one of these today:
- prepend do_configure, which isn't ideal, as do_configure runs in ${B} now, so they need to cd to ${S}, modify, and go back, and of course these changes wouldn't be included in any source archival
- add a postfunc to unpack/patch
- add their own task between patch and configure

I think there's value in providing an explicit hook for all recipes to be able to use to do this sort of logic. Using conditional noexec, we can avoid the overhead of even running the task when it isn't defined. We should state that classes shouldn't define it, either they should add their own task or _append/_prepend, that way the user is free to define it directly and not have to append/prepend to it themselves.

See https://gist.github.com/kergoth/9d7d31999db83ab045db for a functioning prototype.
Comment 1 Paul Eggleton 2014-05-29 14:43:37 UTC
Chris, I'll assign this one back to you since you already have a proposed implementation ;)
Comment 2 Richard Purdie 2019-11-14 15:58:27 UTC
Not sure we have a large number of recipes needing this but there are some tangential problems such as the hoops devtool has to jump through to get prepared sources. This proposal has some interesting ideas but not be the full solution we need...
Comment 3 Christopher Larson 2019-11-14 22:32:04 UTC
(In reply to comment #2)
> Not sure we have a large number of recipes needing this but there are some
> tangential problems such as the hoops devtool has to jump through to get
> prepared sources. This proposal has some interesting ideas but not be the
> full solution we need...

Yeah, that's why I never got around to implementing it, adding an explicit point for devtool and the rest to use as well. I still think the concept is sound, providing an explicit hook rather than the recipes determining the right mechanism to use, but it's low priority, and never got around to doing anything about it.
Comment 4 Randy MacLeod 2023-11-23 16:09:12 UTC
For devtool, we are thinking of using the source unpack tracing to help so that can help here too.