summaryrefslogtreecommitdiffstats
path: root/scripts/git
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-06 16:56:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-14 20:26:34 +0100
commita75678145b35b3722f0cbba51aa699d3fd8f0bef (patch)
tree962af9f10f0c143558f8e42056b114a0ede3a6ee /scripts/git
parent31970fb2a4e1d7b8c263bd8ef87454e30e9c9762 (diff)
downloadpoky-a75678145b35b3722f0cbba51aa699d3fd8f0bef.tar.gz
scripts: Make git intercept global
The previous minimially invasive git intercept simply isn't enough. For example, meson used in the igt-gpu-tools recipe hardcodes the path to git in the configure step so at install time, changing PATH has no effect. There are lots of interesting things we could do to try and avoid problems but making the git intercept and dropping fakeroot privs for git global is probably the least worst solution at this point. It will add slight overhead to git calls but we don't make many so the overall impact is likely minimal. (From OE-Core rev: ce6e606ba8b975a33df2f3dc6104abed9cfa7a36) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit af27c81eaf68ee681dcd9456a74cca6a9ab40bf6) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/git')
-rwxr-xr-xscripts/git19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/git b/scripts/git
new file mode 100755
index 0000000000..8adf5c9ecb
--- /dev/null
+++ b/scripts/git
@@ -0,0 +1,19 @@
1#!/usr/bin/env python3
2#
3# Wrapper around 'git' that doesn't think we are root
4
5import os
6import shutil
7import sys
8
9os.environ['PSEUDO_UNLOAD'] = '1'
10
11# calculate path to the real 'git'
12path = os.environ['PATH']
13path = path.replace(os.path.dirname(sys.argv[0]), '')
14real_git = shutil.which('git', path=path)
15
16if len(sys.argv) == 1:
17 os.execl(real_git, 'git')
18
19os.execv(real_git, sys.argv)