diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-05-06 16:56:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-05-07 22:31:21 +0100 |
commit | bf8a1ee202ef7edd2d18f94d92027921ebffb8d1 (patch) | |
tree | 11be8387f361c905c41a69d1490153b0d32aa06e | |
parent | 4d7383aefb391a5a998454c70feb96127951ca0a (diff) | |
download | poky-bf8a1ee202ef7edd2d18f94d92027921ebffb8d1.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.
(From OE-Core rev: 27de610ac30d4c81352efc794df7e9b1060f7a68)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/git | 9 |
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' | |||
10 | 10 | ||
11 | # calculate path to the real 'git' | 11 | # calculate path to the real 'git' |
12 | path = os.environ['PATH'] | 12 | path = os.environ['PATH'] |
13 | path = path.replace(os.path.dirname(sys.argv[0]), '') | 13 | # we need to remove our path but also any other copy of this script which |
14 | # may be present, e.g. eSDK. | ||
15 | replacements = [os.path.dirname(sys.argv[0])] | ||
16 | for p in path.split(":"): | ||
17 | if p.endswith("/scripts"): | ||
18 | replacements.append(p) | ||
19 | for r in replacements: | ||
20 | path = path.replace(r, '/ignoreme') | ||
14 | real_git = shutil.which('git', path=path) | 21 | real_git = shutil.which('git', path=path) |
15 | 22 | ||
16 | if len(sys.argv) == 1: | 23 | if len(sys.argv) == 1: |