summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@microsoft.com>2022-07-12 18:41:23 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-14 23:22:09 +0100
commit3a2a5847371fe59efd2e430c69f03f3fe4dc873d (patch)
tree88fdb1b6451af3b5243e0a57e7b4a6b6abcc9ce2 /meta/lib
parent9aa23c701a1720ef2268a4dd912018e4fb540247 (diff)
downloadpoky-3a2a5847371fe59efd2e430c69f03f3fe4dc873d.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: 9cca53a2bcbf6809615ce5626c86c6ee481a7a76) Signed-off-by: Paul Eggleton <paul.eggleton@microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/patch.py8
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)