mirror of
https://git.yoctoproject.org/poky
synced 2026-03-19 13:49:41 +01:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
dd1fac1e11
commit
9e7a56bef7
@@ -299,10 +299,10 @@ class GitApplyTree(PatchTree):
|
||||
PatchTree.__init__(self, dir, d)
|
||||
self.commituser = d.getVar('PATCH_GIT_USER_NAME')
|
||||
self.commitemail = d.getVar('PATCH_GIT_USER_EMAIL')
|
||||
if not self._isInitialized():
|
||||
if not self._isInitialized(d):
|
||||
self._initRepo()
|
||||
|
||||
def _isInitialized(self):
|
||||
def _isInitialized(self, d):
|
||||
cmd = "git rev-parse --show-toplevel"
|
||||
try:
|
||||
output = runcmd(cmd.split(), self.dir).strip()
|
||||
@@ -310,8 +310,8 @@ class GitApplyTree(PatchTree):
|
||||
## runcmd returned non-zero which most likely means 128
|
||||
## Not a git directory
|
||||
return False
|
||||
## Make sure repo is in builddir to not break top-level git repos
|
||||
return os.path.samefile(output, self.dir)
|
||||
## Make sure repo is in builddir to not break top-level git repos, or under workdir
|
||||
return os.path.samefile(output, self.dir) or oe.path.is_path_parent(d.getVar('WORKDIR'), output)
|
||||
|
||||
def _initRepo(self):
|
||||
runcmd("git init".split(), self.dir)
|
||||
|
||||
Reference in New Issue
Block a user