summaryrefslogtreecommitdiffstats
path: root/meta/classes/base.bbclass
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2022-04-20 11:11:41 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-04 13:07:34 +0100
commitf6eb7208905af4c33135b2dd6f652b986ea33db3 (patch)
treee2b418b7f2c9f3882b2f489c56d67a384cb473f1 /meta/classes/base.bbclass
parent5c91954b7d1d426eaaf2b426a06fc9549d0f7134 (diff)
downloadpoky-f6eb7208905af4c33135b2dd6f652b986ea33db3.tar.gz
install/devshell: Introduce git intercept script due to fakeroot issues
In a devshell, recent versions of git will complain if the repo is owned by someone other than the current UID - consider this example: ------ bitbake -c devshell linux-yocto [...] kernel-source#git branch fatal: unsafe repository ('/home/paul/poky/build-qemuarm64/tmp/work-shared/qemuarm64/kernel-source' is owned by someone else) To add an exception for this directory, call: git config --global --add safe.directory /home/paul/poky/build-qemuarm64/tmp/work-shared/qemuarm64/kernel-source kernel-source# ------ Of course the devshell has UID zero and the "real" UID is for "paul" in this case. And so recent git versions complain. As the whole purpose of the devshell is to invoke a shell where development can take place, having a non-functional git is clearly unacceptable. Richard suggested we could use PSEUDO_UNLOAD=1 to evade this issue, and I suggested we probably will see other similar instances like this and should make use of PATH to intercept via devshell wrappers - conveniently we already have examples of this. Here, we copy the existing "ar" example and tune it to the needs of git to combine Richard's suggestion and mine. As such we now also can store commit logs and use send-email with our user specific settings, instead of "root", so in additon to fixing basic commands like "git branch" it should also increase general usefulness. RP: Tweaked the patch so the PATH change only applies to the devshell task and is a generic git intercept rather than devshell specific. RP: Also apply the PATH change to do_install tasks since that also runs under fakeroot and several software projects inject "git describe" output into their binaries (systemd, iputils, llvm, ipt-gpu-tools at least) causing reproducibility issues from systems with different git versions. (From OE-Core rev: 3a320c1555bf39b2d3c218ffc36827d9dda60fe1) Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 3266c327dfa186791e0f1e2ad63c6f5d39714814) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/base.bbclass')
-rw-r--r--meta/classes/base.bbclass1
1 files changed, 1 insertions, 0 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 3515720bf9..b54b56d624 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -367,6 +367,7 @@ addtask install after do_compile
367do_install[dirs] = "${B}" 367do_install[dirs] = "${B}"
368# Remove and re-create ${D} so that is it guaranteed to be empty 368# Remove and re-create ${D} so that is it guaranteed to be empty
369do_install[cleandirs] = "${D}" 369do_install[cleandirs] = "${D}"
370PATH:prepend:task-install = "${COREBASE}/scripts/git-intercept:"
370 371
371base_do_install() { 372base_do_install() {
372 : 373 :