Bug 3975

Summary: When B != S, set S as read-only
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: coreAssignee: Saul Wold <sgw>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: Low CC: mcrapet, meta.mr.watcher, meta.watcher, richard.purdie
Version: 1.4   
Target Milestone: Future   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Ross Burton 2013-03-04 12:07:03 UTC
If we're doing a build where $B != $S, then after patching set $S to read-only.  The fun will be restoring read/write on errors so the directories can be erased.
Comment 1 Matthieu Crapet 2014-01-21 10:40:12 UTC
This is quite tricky.
Adding:

<code>
check_separate_build() {
	if [ "${S}" != "${B}" ]; then
		bbnote 'Separate build: chmod a-w ${S}'
		chmod a-w ${S}
	fi
}

do_configure[prefuncs] = "check_separate_build"
</cpde>

to base.bbclass is easy, but how to revertit ? do_clean will fail because of Permissions. How to detect that do_configure failed?
Comment 2 Ross Burton 2014-01-21 10:45:01 UTC
To be honest I'm not sure if this is even possible, making the assumption that *nothing* in the build will touch $S is tough.  As the creater of this bug let's say I was over-enthusiastic and close it.