From 2863b1237128906bccf7d2e9ecb739afb395fe4e Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 6 May 2022 16:56:02 +0100 Subject: 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. Signed-off-by: Richard Purdie (cherry picked from commit af27c81eaf68ee681dcd9456a74cca6a9ab40bf6) Signed-off-by: Anuj Mittal --- scripts/git | 19 +++++++++++++++++++ scripts/git-intercept/git | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) create mode 100755 scripts/git delete mode 100755 scripts/git-intercept/git diff --git a/scripts/git b/scripts/git new file mode 100755 index 0000000000..8adf5c9ecb --- /dev/null +++ b/scripts/git @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +# +# Wrapper around 'git' that doesn't think we are root + +import os +import shutil +import sys + +os.environ['PSEUDO_UNLOAD'] = '1' + +# calculate path to the real 'git' +path = os.environ['PATH'] +path = path.replace(os.path.dirname(sys.argv[0]), '') +real_git = shutil.which('git', path=path) + +if len(sys.argv) == 1: + os.execl(real_git, 'git') + +os.execv(real_git, sys.argv) diff --git a/scripts/git-intercept/git b/scripts/git-intercept/git deleted file mode 100755 index 8adf5c9ecb..0000000000 --- a/scripts/git-intercept/git +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python3 -# -# Wrapper around 'git' that doesn't think we are root - -import os -import shutil -import sys - -os.environ['PSEUDO_UNLOAD'] = '1' - -# calculate path to the real 'git' -path = os.environ['PATH'] -path = path.replace(os.path.dirname(sys.argv[0]), '') -real_git = shutil.which('git', path=path) - -if len(sys.argv) == 1: - os.execl(real_git, 'git') - -os.execv(real_git, sys.argv) -- cgit 1.2.3-korg