Bug 4425 - Prevent including the same file twice
Summary: Prevent including the same file twice
Status: RESOLVED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium enhancement
Target Milestone: 1.6
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-04-27 12:09 UTC by Martin Jansa
Modified: 2013-12-01 02:46 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Jansa 2013-04-27 12:09:11 UTC
We discussed this with Phil on #oe"

When some .inc file is included twice (for some reason) then it has bad side effects especially when the .inc is appending to some variables.

Sometimes it's not so easy to notice 2nd+ inclusion, I've seen some distro configs which were including stuff like tcmode after it was included by default-setup.inc and that was duplicating all *FLAGS in environment..

Or with some cortexa9 machines I would like to include also tune-cortexa8.inc, this way distro can use some common DEFAULTTUNE like cortexa8t-neon when building couple of cortexa[89] MACHINEs. But I cannot include whole tune-cortexa9.inc, because it would include arch-armv7a.inc twice with bad side-effects. So I have to use constructs like this:
https://github.com/shr-distribution/meta-smartphone/blob/shr/meta-samsung/conf/machine/tuna.conf

I'm wondering how many times something is included/required for 2nd+ time and replaces some assignment, but if we really need such use-case then we can introduce include_once/require_once.

Maybe we can start with warning to see how many times something is included more then once and if we don't find case where such behavior is needed, then change behavior to ignore 2nd+ inclusion.
Comment 1 Richard Purdie 2013-11-29 18:16:00 UTC
There is a patch on bitbake-devel which adds the warning. We'd likely make it an error after a while. There was one case in OE-Core of this which I'd sent a patch to fix.
Comment 2 Richard Purdie 2013-11-30 22:33:37 UTC
Warnings added in master: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=f5f3ef7b09ab3790da92f8bef83835033bbeb0ac

Martin: Please remind me to change this to an error at some appropriate point in the future.
Comment 3 Martin Jansa 2013-12-01 02:46:45 UTC
(In reply to comment #2)
> Martin: Please remind me to change this to an error at some appropriate
> point in the future.

OK, thanks.

FYI: in my broader world builds I've seen only the warning from eglibc-package, but on the other hand it doesn't many distro-layers which are more likely to have this problem.