diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-25 16:08:26 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-26 09:27:30 +0100 |
commit | d85231ef140265868b29bbffb6a5e36fd757cf1b (patch) | |
tree | 402f95c9038f0a4091a9ef743a40c74427b22e5c /meta/lib/oe | |
parent | 615b351bf4b28fd25f3bf15f72ab038ce37b89f7 (diff) | |
download | poky-d85231ef140265868b29bbffb6a5e36fd757cf1b.tar.gz |
lib/oe/patch: Fix git patch application for source in subdirectory
Similarly to:
http://git.yoctoproject.org/cgit.cgi/poky/commit/meta/lib/oe/patch.py?id=f205ccaf48ac36f4b26efc4aeb2e9d2939b28646
we need to fix patch application for source which is in a subdirectory.
Passing "." as the git directory or work-dir appears to work (or is ignored)
in some versions of git but does not work in others, probably quite correctly.
Since we have reporoot from the above patch, pass this in directly.
This bug caused this sanity test failure on some machines:
FAIL: test_devtool_modify_git (oeqa.selftest.devtool.DevtoolTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/devtool.py", line 390, in test_devtool_modify_git
self.assertEqual(result.output.strip(), "", 'Created git repo is not clean')
AssertionError: '?? util/mkelfImage/patches/' != '' : Created git repo is not clean
since git apply would fail, it would then fall back to quilt
and the git tree would be left unclean.
[YOCTO #7911]
(From OE-Core rev: 91d76e632336d6af96f24bcf92be25f41a216856)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/patch.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index afb0013a4b..c4f042d54b 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py | |||
@@ -398,17 +398,17 @@ class GitApplyTree(PatchTree): | |||
398 | try: | 398 | try: |
399 | patchfilevar = 'PATCHFILE="%s"' % os.path.basename(patch['file']) | 399 | patchfilevar = 'PATCHFILE="%s"' % os.path.basename(patch['file']) |
400 | try: | 400 | try: |
401 | shellcmd = [patchfilevar, "git", "--work-tree=.", "am", "-3", "--keep-cr", "-p%s" % patch['strippath']] | 401 | shellcmd = [patchfilevar, "git", "--work-tree=%s" % reporoot, "am", "-3", "--keep-cr", "-p%s" % patch['strippath']] |
402 | return _applypatchhelper(shellcmd, patch, force, reverse, run) | 402 | return _applypatchhelper(shellcmd, patch, force, reverse, run) |
403 | except CmdError: | 403 | except CmdError: |
404 | # Need to abort the git am, or we'll still be within it at the end | 404 | # Need to abort the git am, or we'll still be within it at the end |
405 | try: | 405 | try: |
406 | shellcmd = ["git", "--work-tree=.", "am", "--abort"] | 406 | shellcmd = ["git", "--work-tree=%s" % reporoot, "am", "--abort"] |
407 | runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) | 407 | runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) |
408 | except CmdError: | 408 | except CmdError: |
409 | pass | 409 | pass |
410 | # Fall back to git apply | 410 | # Fall back to git apply |
411 | shellcmd = ["git", "--git-dir=.", "apply", "-p%s" % patch['strippath']] | 411 | shellcmd = ["git", "--git-dir=%s" % reporoot, "apply", "-p%s" % patch['strippath']] |
412 | try: | 412 | try: |
413 | output = _applypatchhelper(shellcmd, patch, force, reverse, run) | 413 | output = _applypatchhelper(shellcmd, patch, force, reverse, run) |
414 | except CmdError: | 414 | except CmdError: |