[oe-commits] Paul Eggleton : lib/oe/patch: fix PATCHTOOL = "git" with source in a subdirectory

git at git.openembedded.org git at git.openembedded.org
Fri Feb 20 18:17:39 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 666d84ac82f68c6cb39ee172fcc8c01e41238d4e
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=666d84ac82f68c6cb39ee172fcc8c01e41238d4e

Author: Paul Eggleton <paul.eggleton at linux.intel.com>
Date:   Thu Feb 19 16:39:51 2015 +0000

lib/oe/patch: fix PATCHTOOL = "git" with source in a subdirectory

For recipes that have their actual source in a subdirectory of what is
fetched (e.g. mkelfimage), we need to find the root of the repository
within the GitApplyTree code that attempts to set up the required git
hooks and use that, rather than expecting the root to be the same as
${S}.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/lib/oe/patch.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index b838be8..f68d40f 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -313,9 +313,12 @@ class GitApplyTree(PatchTree):
             return runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
 
         # Add hooks which add a pointer to the original patch file name in the commit message
-        commithook = os.path.join(self.dir, '.git', 'hooks', 'commit-msg')
+        reporoot = (runcmd("git rev-parse --show-toplevel".split(), self.dir) or '').strip()
+        if not reporoot:
+            raise Exception("Cannot get repository root for directory %s" % self.dir)
+        commithook = os.path.join(reporoot, '.git', 'hooks', 'commit-msg')
         commithook_backup = commithook + '.devtool-orig'
-        applyhook = os.path.join(self.dir, '.git', 'hooks', 'applypatch-msg')
+        applyhook = os.path.join(reporoot, '.git', 'hooks', 'applypatch-msg')
         applyhook_backup = applyhook + '.devtool-orig'
         if os.path.exists(commithook):
             shutil.move(commithook, commithook_backup)



More information about the Openembedded-commits mailing list