diff options
-rw-r--r-- | meta/classes/base.bbclass | 1 | ||||
-rw-r--r-- | meta/classes/devshell.bbclass | 2 | ||||
-rwxr-xr-x | scripts/git-intercept/git | 19 |
3 files changed, 22 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 | |||
367 | do_install[dirs] = "${B}" | 367 | do_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 |
369 | do_install[cleandirs] = "${D}" | 369 | do_install[cleandirs] = "${D}" |
370 | PATH:prepend:task-install = "${COREBASE}/scripts/git-intercept:" | ||
370 | 371 | ||
371 | base_do_install() { | 372 | base_do_install() { |
372 | : | 373 | : |
diff --git a/meta/classes/devshell.bbclass b/meta/classes/devshell.bbclass index 62dc958d9a..75604d0c07 100644 --- a/meta/classes/devshell.bbclass +++ b/meta/classes/devshell.bbclass | |||
@@ -2,6 +2,8 @@ inherit terminal | |||
2 | 2 | ||
3 | DEVSHELL = "${SHELL}" | 3 | DEVSHELL = "${SHELL}" |
4 | 4 | ||
5 | PATH:prepend:task-devshell = "${COREBASE}/scripts/git-intercept:" | ||
6 | |||
5 | python do_devshell () { | 7 | python do_devshell () { |
6 | if d.getVarFlag("do_devshell", "manualfakeroot"): | 8 | if d.getVarFlag("do_devshell", "manualfakeroot"): |
7 | d.prependVar("DEVSHELL", "pseudo ") | 9 | d.prependVar("DEVSHELL", "pseudo ") |
diff --git a/scripts/git-intercept/git b/scripts/git-intercept/git new file mode 100755 index 0000000000..8adf5c9ecb --- /dev/null +++ b/scripts/git-intercept/git | |||
@@ -0,0 +1,19 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | # | ||
3 | # Wrapper around 'git' that doesn't think we are root | ||
4 | |||
5 | import os | ||
6 | import shutil | ||
7 | import sys | ||
8 | |||
9 | os.environ['PSEUDO_UNLOAD'] = '1' | ||
10 | |||
11 | # calculate path to the real 'git' | ||
12 | path = os.environ['PATH'] | ||
13 | path = path.replace(os.path.dirname(sys.argv[0]), '') | ||
14 | real_git = shutil.which('git', path=path) | ||
15 | |||
16 | if len(sys.argv) == 1: | ||
17 | os.execl(real_git, 'git') | ||
18 | |||
19 | os.execv(real_git, sys.argv) | ||