summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/patch.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index af3adec140..cad50157dd 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -281,6 +281,8 @@ class GitApplyTree(PatchTree):
281 281
282 def __init__(self, dir, d): 282 def __init__(self, dir, d):
283 PatchTree.__init__(self, dir, d) 283 PatchTree.__init__(self, dir, d)
284 self.commituser = d.getVar('PATCH_GIT_USER_NAME', True)
285 self.commitemail = d.getVar('PATCH_GIT_USER_EMAIL', True)
284 286
285 @staticmethod 287 @staticmethod
286 def extractPatchHeader(patchfile): 288 def extractPatchHeader(patchfile):
@@ -348,7 +350,17 @@ class GitApplyTree(PatchTree):
348 return outlines, author, date, subject 350 return outlines, author, date, subject
349 351
350 @staticmethod 352 @staticmethod
351 def prepareCommit(patchfile): 353 def gitCommandUserOptions(cmd, commituser=None, commitemail=None, d=None):
354 if d:
355 commituser = d.getVar('PATCH_GIT_USER_NAME', True)
356 commitemail = d.getVar('PATCH_GIT_USER_EMAIL', True)
357 if commituser:
358 cmd += ['-c', 'user.name="%s"' % commituser]
359 if commitemail:
360 cmd += ['-c', 'user.email="%s"' % commitemail]
361
362 @staticmethod
363 def prepareCommit(patchfile, commituser=None, commitemail=None):
352 """ 364 """
353 Prepare a git commit command line based on the header from a patch file 365 Prepare a git commit command line based on the header from a patch file
354 (typically this is useful for patches that cannot be applied with "git am" due to formatting) 366 (typically this is useful for patches that cannot be applied with "git am" due to formatting)
@@ -380,7 +392,9 @@ class GitApplyTree(PatchTree):
380 for line in outlines: 392 for line in outlines:
381 tf.write(line) 393 tf.write(line)
382 # Prepare git command 394 # Prepare git command
383 cmd = ["git", "commit", "-F", tmpfile] 395 cmd = ["git"]
396 GitApplyTree.gitCommandUserOptions(cmd, commituser, commitemail)
397 cmd += ["commit", "-F", tmpfile]
384 # git doesn't like plain email addresses as authors 398 # git doesn't like plain email addresses as authors
385 if author and '<' in author: 399 if author and '<' in author:
386 cmd.append('--author="%s"' % author) 400 cmd.append('--author="%s"' % author)
@@ -456,7 +470,9 @@ class GitApplyTree(PatchTree):
456 try: 470 try:
457 patchfilevar = 'PATCHFILE="%s"' % os.path.basename(patch['file']) 471 patchfilevar = 'PATCHFILE="%s"' % os.path.basename(patch['file'])
458 try: 472 try:
459 shellcmd = [patchfilevar, "git", "--work-tree=%s" % reporoot, "am", "-3", "--keep-cr", "-p%s" % patch['strippath']] 473 shellcmd = [patchfilevar, "git", "--work-tree=%s" % reporoot]
474 self.gitCommandUserOptions(shellcmd, self.commituser, self.commitemail)
475 shellcmd += ["am", "-3", "--keep-cr", "-p%s" % patch['strippath']]
460 return _applypatchhelper(shellcmd, patch, force, reverse, run) 476 return _applypatchhelper(shellcmd, patch, force, reverse, run)
461 except CmdError: 477 except CmdError:
462 # Need to abort the git am, or we'll still be within it at the end 478 # Need to abort the git am, or we'll still be within it at the end
@@ -486,7 +502,7 @@ class GitApplyTree(PatchTree):
486 shellcmd = ["git", "reset", "HEAD", self.patchdir] 502 shellcmd = ["git", "reset", "HEAD", self.patchdir]
487 output += runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) 503 output += runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
488 # Commit the result 504 # Commit the result
489 (tmpfile, shellcmd) = self.prepareCommit(patch['file']) 505 (tmpfile, shellcmd) = self.prepareCommit(patch['file'], self.commituser, self.commitemail)
490 try: 506 try:
491 shellcmd.insert(0, patchfilevar) 507 shellcmd.insert(0, patchfilevar)
492 output += runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) 508 output += runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)