summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-06 16:56:03 +0100
committerSteve Sakoman <steve@sakoman.com>2022-05-09 04:01:07 -1000
commitb9dcaa76b3274ced1e4b9e2ca33f778e8cd50032 (patch)
treeb8297157ed3e84289f942a3f088bc1c76d593816
parent07f282fb94a5a7c0a3fad451c844e5b26074c744 (diff)
downloadopenembedded-core-b9dcaa76b3274ced1e4b9e2ca33f778e8cd50032.tar.gz
scripts/git: Ensure we don't have circular references
This is horrible but I'm running out of better ideas. We hit circular reference issues which we were trying to avoid in the core HOSTTOOLS code. When building the eSDK, there can be two copies of the script. Therefore assume git will never be in a directory called scripts. This fixes eSDK build failures. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 27de610ac30d4c81352efc794df7e9b1060f7a68) Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rwxr-xr-xscripts/git9
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/git b/scripts/git
index 8adf5c9ecb..644055e540 100755
--- a/scripts/git
+++ b/scripts/git
@@ -10,7 +10,14 @@ os.environ['PSEUDO_UNLOAD'] = '1'
# calculate path to the real 'git'
path = os.environ['PATH']
-path = path.replace(os.path.dirname(sys.argv[0]), '')
+# we need to remove our path but also any other copy of this script which
+# may be present, e.g. eSDK.
+replacements = [os.path.dirname(sys.argv[0])]
+for p in path.split(":"):
+ if p.endswith("/scripts"):
+ replacements.append(p)
+for r in replacements:
+ path = path.replace(r, '/ignoreme')
real_git = shutil.which('git', path=path)
if len(sys.argv) == 1: