diff options
author | Paul Eggleton <paul.eggleton@microsoft.com> | 2022-07-12 18:41:23 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-07-25 15:11:46 +0100 |
commit | 9e7a56bef7638838d235382bf59e45635296e400 (patch) | |
tree | 6a22d0a932e52f03f9f5d385c613cd6384064304 /meta/lib/oe | |
parent | dd1fac1e1150b85dbf9f7c112eaff91f70ebf813 (diff) | |
download | poky-9e7a56bef7638838d235382bf59e45635296e400.tar.gz |
patch: handle if S points to a subdirectory of a git repo
If PATCHTOOL = "git", SRC_URI fetches from a git repo and S points to
a subdirectory of the checked out sources, then we were erroneously
initialising the subdirectory as its own git repo. Check if the returned
top-level repo directory is a subdirectory of WORKDIR and do not
run initialise the source directory if that is the case.
(This was a regression introduced with OE-Core revision
6184b56a7a0fc6f5d19fdfb81e7453667f7da940, however we didn't have a test
that verified the behaviour.)
(From OE-Core rev: 577a69137eac6a44869d384b9027fbfdfea5740e)
Signed-off-by: Paul Eggleton <paul.eggleton@microsoft.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 9cca53a2bcbf6809615ce5626c86c6ee481a7a76)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/patch.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index 95b915a6ab..4ec9caed45 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
@@ -299,10 +299,10 @@ class GitApplyTree(PatchTree): | |||
299 | PatchTree.__init__(self, dir, d) | 299 | PatchTree.__init__(self, dir, d) |
300 | self.commituser = d.getVar('PATCH_GIT_USER_NAME') | 300 | self.commituser = d.getVar('PATCH_GIT_USER_NAME') |
301 | self.commitemail = d.getVar('PATCH_GIT_USER_EMAIL') | 301 | self.commitemail = d.getVar('PATCH_GIT_USER_EMAIL') |
302 | if not self._isInitialized(): | 302 | if not self._isInitialized(d): |
303 | self._initRepo() | 303 | self._initRepo() |
304 | 304 | ||
305 | def _isInitialized(self): | 305 | def _isInitialized(self, d): |
306 | cmd = "git rev-parse --show-toplevel" | 306 | cmd = "git rev-parse --show-toplevel" |
307 | try: | 307 | try: |
308 | output = runcmd(cmd.split(), self.dir).strip() | 308 | output = runcmd(cmd.split(), self.dir).strip() |
@@ -310,8 +310,8 @@ class GitApplyTree(PatchTree): | |||
310 | ## runcmd returned non-zero which most likely means 128 | 310 | ## runcmd returned non-zero which most likely means 128 |
311 | ## Not a git directory | 311 | ## Not a git directory |
312 | return False | 312 | return False |
313 | ## Make sure repo is in builddir to not break top-level git repos | 313 | ## Make sure repo is in builddir to not break top-level git repos, or under workdir |
314 | return os.path.samefile(output, self.dir) | 314 | return os.path.samefile(output, self.dir) or oe.path.is_path_parent(d.getVar('WORKDIR'), output) |
315 | 315 | ||
316 | def _initRepo(self): | 316 | def _initRepo(self): |
317 | runcmd("git init".split(), self.dir) | 317 | runcmd("git init".split(), self.dir) |