From: <changqing.li@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [scarthgap][PATCH] patch.py: set commituser and commitemail for addNote
Date: Wed, 9 Apr 2025 10:39:48 +0800 [thread overview]
Message-ID: <20250409023948.1718604-1-changqing.li@windriver.com> (raw)
From: Changqing Li <changqing.li@windriver.com>
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"
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/lib/oe/patch.py | 14 ++++++++------
1 file 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):
return (tmpfile, cmd)
@staticmethod
- def addNote(repo, ref, key, value=None):
+ def addNote(repo, ref, key, value=None, commituser=None, commitemail=None):
note = key + (": %s" % value if value else "")
notes_ref = GitApplyTree.notes_ref
runcmd(["git", "config", "notes.rewriteMode", "ignore"], repo)
runcmd(["git", "config", "notes.displayRef", notes_ref, notes_ref], repo)
runcmd(["git", "config", "notes.rewriteRef", notes_ref, notes_ref], repo)
- runcmd(["git", "notes", "--ref", notes_ref, "append", "-m", note, ref], repo)
+ cmd = ["git"]
+ GitApplyTree.gitCommandUserOptions(cmd, commituser, commitemail)
+ runcmd(cmd + ["notes", "--ref", notes_ref, "append", "-m", note, ref], repo)
@staticmethod
- def removeNote(repo, ref, key):
+ def removeNote(repo, ref, key, commituser=None, commitemail=None):
notes = GitApplyTree.getNotes(repo, ref)
notes = {k: v for k, v in notes.items() if k != key and not k.startswith(key + ":")}
runcmd(["git", "notes", "--ref", GitApplyTree.notes_ref, "remove", "--ignore-missing", ref], repo)
for note, value in notes.items():
- GitApplyTree.addNote(repo, ref, note, value)
+ GitApplyTree.addNote(repo, ref, note, value, commituser, commitemail)
@staticmethod
def getNotes(repo, ref):
@@ -507,7 +509,7 @@ class GitApplyTree(PatchTree):
GitApplyTree.gitCommandUserOptions(cmd, d=d)
cmd += ["commit", "-m", subject, "--no-verify"]
runcmd(cmd, dir)
- GitApplyTree.addNote(dir, "HEAD", GitApplyTree.ignore_commit)
+ GitApplyTree.addNote(dir, "HEAD", GitApplyTree.ignore_commit, d.getVar('PATCH_GIT_USER_NAME'), d.getVar('PATCH_GIT_USER_EMAIL'))
@staticmethod
def extractPatches(tree, startcommits, outdir, paths=None):
@@ -654,7 +656,7 @@ class GitApplyTree(PatchTree):
raise
finally:
if patch_applied:
- GitApplyTree.addNote(self.dir, "HEAD", GitApplyTree.original_patch, os.path.basename(patch['file']))
+ GitApplyTree.addNote(self.dir, "HEAD", GitApplyTree.original_patch, os.path.basename(patch['file']), self.commituser, self.commitemail)
class QuiltTree(PatchSet):
--
2.34.1
reply other threads:[~2025-04-09 2:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250409023948.1718604-1-changqing.li@windriver.com \
--to=changqing.li@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox