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 070341d1aa..78cc8279dd 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
| @@ -339,6 +339,7 @@ addtask install after do_compile | |||
| 339 | do_install[dirs] = "${B}" | 339 | do_install[dirs] = "${B}" |
| 340 | # Remove and re-create ${D} so that is it guaranteed to be empty | 340 | # Remove and re-create ${D} so that is it guaranteed to be empty |
| 341 | do_install[cleandirs] = "${D}" | 341 | do_install[cleandirs] = "${D}" |
| 342 | PATH:prepend:task-install = "${COREBASE}/scripts/git-intercept:" | ||
| 342 | 343 | ||
| 343 | base_do_install() { | 344 | base_do_install() { |
| 344 | : | 345 | : |
diff --git a/meta/classes/devshell.bbclass b/meta/classes/devshell.bbclass index 76dd0b42ee..b6212ebd89 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) | ||
