summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/patch.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/patch.py')
-rw-r--r--meta/lib/oe/patch.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 60a0cc8291..edd77196ee 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -462,21 +462,23 @@ class GitApplyTree(PatchTree):
462 return (tmpfile, cmd) 462 return (tmpfile, cmd)
463 463
464 @staticmethod 464 @staticmethod
465 def addNote(repo, ref, key, value=None): 465 def addNote(repo, ref, key, value=None, commituser=None, commitemail=None):
466 note = key + (": %s" % value if value else "") 466 note = key + (": %s" % value if value else "")
467 notes_ref = GitApplyTree.notes_ref 467 notes_ref = GitApplyTree.notes_ref
468 runcmd(["git", "config", "notes.rewriteMode", "ignore"], repo) 468 runcmd(["git", "config", "notes.rewriteMode", "ignore"], repo)
469 runcmd(["git", "config", "notes.displayRef", notes_ref, notes_ref], repo) 469 runcmd(["git", "config", "notes.displayRef", notes_ref, notes_ref], repo)
470 runcmd(["git", "config", "notes.rewriteRef", notes_ref, notes_ref], repo) 470 runcmd(["git", "config", "notes.rewriteRef", notes_ref, notes_ref], repo)
471 runcmd(["git", "notes", "--ref", notes_ref, "append", "-m", note, ref], repo) 471 cmd = ["git"]
472 GitApplyTree.gitCommandUserOptions(cmd, commituser, commitemail)
473 runcmd(cmd + ["notes", "--ref", notes_ref, "append", "-m", note, ref], repo)
472 474
473 @staticmethod 475 @staticmethod
474 def removeNote(repo, ref, key): 476 def removeNote(repo, ref, key, commituser=None, commitemail=None):
475 notes = GitApplyTree.getNotes(repo, ref) 477 notes = GitApplyTree.getNotes(repo, ref)
476 notes = {k: v for k, v in notes.items() if k != key and not k.startswith(key + ":")} 478 notes = {k: v for k, v in notes.items() if k != key and not k.startswith(key + ":")}
477 runcmd(["git", "notes", "--ref", GitApplyTree.notes_ref, "remove", "--ignore-missing", ref], repo) 479 runcmd(["git", "notes", "--ref", GitApplyTree.notes_ref, "remove", "--ignore-missing", ref], repo)
478 for note, value in notes.items(): 480 for note, value in notes.items():
479 GitApplyTree.addNote(repo, ref, note, value) 481 GitApplyTree.addNote(repo, ref, note, value, commituser, commitemail)
480 482
481 @staticmethod 483 @staticmethod
482 def getNotes(repo, ref): 484 def getNotes(repo, ref):
@@ -507,7 +509,7 @@ class GitApplyTree(PatchTree):
507 GitApplyTree.gitCommandUserOptions(cmd, d=d) 509 GitApplyTree.gitCommandUserOptions(cmd, d=d)
508 cmd += ["commit", "-m", subject, "--no-verify"] 510 cmd += ["commit", "-m", subject, "--no-verify"]
509 runcmd(cmd, dir) 511 runcmd(cmd, dir)
510 GitApplyTree.addNote(dir, "HEAD", GitApplyTree.ignore_commit) 512 GitApplyTree.addNote(dir, "HEAD", GitApplyTree.ignore_commit, d.getVar('PATCH_GIT_USER_NAME'), d.getVar('PATCH_GIT_USER_EMAIL'))
511 513
512 @staticmethod 514 @staticmethod
513 def extractPatches(tree, startcommits, outdir, paths=None): 515 def extractPatches(tree, startcommits, outdir, paths=None):
@@ -654,7 +656,7 @@ class GitApplyTree(PatchTree):
654 raise 656 raise
655 finally: 657 finally:
656 if patch_applied: 658 if patch_applied:
657 GitApplyTree.addNote(self.dir, "HEAD", GitApplyTree.original_patch, os.path.basename(patch['file'])) 659 GitApplyTree.addNote(self.dir, "HEAD", GitApplyTree.original_patch, os.path.basename(patch['file']), self.commituser, self.commitemail)
658 660
659 661
660class QuiltTree(PatchSet): 662class QuiltTree(PatchSet):
@@ -882,7 +884,7 @@ class UserResolver(Resolver):
882 os.chdir(olddir) 884 os.chdir(olddir)
883 885
884 886
885def patch_path(url, fetch, workdir, expand=True): 887def patch_path(url, fetch, unpackdir, expand=True):
886 """Return the local path of a patch, or return nothing if this isn't a patch""" 888 """Return the local path of a patch, or return nothing if this isn't a patch"""
887 889
888 local = fetch.localpath(url) 890 local = fetch.localpath(url)
@@ -891,7 +893,7 @@ def patch_path(url, fetch, workdir, expand=True):
891 base, ext = os.path.splitext(os.path.basename(local)) 893 base, ext = os.path.splitext(os.path.basename(local))
892 if ext in ('.gz', '.bz2', '.xz', '.Z'): 894 if ext in ('.gz', '.bz2', '.xz', '.Z'):
893 if expand: 895 if expand:
894 local = os.path.join(workdir, base) 896 local = os.path.join(unpackdir, base)
895 ext = os.path.splitext(base)[1] 897 ext = os.path.splitext(base)[1]
896 898
897 urldata = fetch.ud[url] 899 urldata = fetch.ud[url]
@@ -905,12 +907,12 @@ def patch_path(url, fetch, workdir, expand=True):
905 return local 907 return local
906 908
907def src_patches(d, all=False, expand=True): 909def src_patches(d, all=False, expand=True):
908 workdir = d.getVar('WORKDIR') 910 unpackdir = d.getVar('UNPACKDIR')
909 fetch = bb.fetch2.Fetch([], d) 911 fetch = bb.fetch2.Fetch([], d)
910 patches = [] 912 patches = []
911 sources = [] 913 sources = []
912 for url in fetch.urls: 914 for url in fetch.urls:
913 local = patch_path(url, fetch, workdir, expand) 915 local = patch_path(url, fetch, unpackdir, expand)
914 if not local: 916 if not local:
915 if all: 917 if all:
916 local = fetch.localpath(url) 918 local = fetch.localpath(url)