]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oe/patch: fix PATCHTOOL = "git" with source in a subdirectory
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Thu, 19 Feb 2015 16:39:51 +0000 (16:39 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 23 Feb 2015 08:08:19 +0000 (08:08 +0000)
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@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/patch.py

index b838be80bedcf1842848eb9c8505703abe91109a..f68d40f8c8f790fc36fc77806a12de36ef204373 100644 (file)
@@ -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)