diff options
| author | Changqing Li <changqing.li@windriver.com> | 2025-04-09 10:39:48 +0800 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-04-16 06:41:24 -0700 |
| commit | dcf9e34e51814b9fd772b205725623306eb88894 (patch) | |
| tree | 449bf95fc3dd58cee07311625aa50de592f6174e | |
| parent | 0b1e8f405cfbc8afd4f4517ed78e28af517896df (diff) | |
| download | poky-dcf9e34e51814b9fd772b205725623306eb88894.tar.gz | |
patch.py: set commituser and commitemail for addNote
When PATCHTOOL is set to 'git', and user don't setup
user.name and user.email for git, do_patch fail with
the following error, fix by passing -c options.
CmdError("git notes --ref refs/notes/devtool append -m 'original patch: 0001-PATCH-increase-to-cpp17-version.patch' HEAD", 0, 'stdout:
stderr: Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
(From OE-Core rev: 9de38ac99c2b19f549c00ea5277faf621c6f4e65)
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/lib/oe/patch.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index 60a0cc8291..417333e431 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 | ||
| 660 | class QuiltTree(PatchSet): | 662 | class QuiltTree(PatchSet): |
