From: Palmer Dabbelt <palmer@rivosinc.com>
To: tools@linux.kernel.org
Cc: Palmer Dabbelt <palmer@rivosinc.com>
Subject: [PATCH] shazam: Add the --add-message-id argument
Date: Thu, 16 Feb 2023 08:48:41 -0800 [thread overview]
Message-ID: <20230216164841.3356-1-palmer@rivosinc.com> (raw)
Some projects (at least QEMU) want Message-ID headers instead of Link
headers. I couldn't find an easy way to do that, so this just adds an
argument to shazam that mirrors "--add-link" but adds a MessageID
instead.
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
Using a LoreTrailer for something that's not on Lore seems odd, but it
appears to work so I just went with it.
---
b4/__init__.py | 6 +++++-
b4/command.py | 2 ++
b4/mbox.py | 2 +-
man/b4.5.rst | 2 ++
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/b4/__init__.py b/b4/__init__.py
index 4d5a6c9..5e5a5a3 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -519,7 +519,7 @@ class LoreSeries:
self.add_extra_trailers(self.patches[0].followup_trailers) # noqa
def get_am_ready(self, noaddtrailers=False, covertrailers=False, addmysob=False, addlink=False,
- linkmask=None, cherrypick=None, copyccs=False, allowbadchars=False) -> List[email.message.Message]:
+ linkmask=None, cherrypick=None, copyccs=False, allowbadchars=False, addmessageid=False) -> List[email.message.Message]:
usercfg = get_user_config()
config = get_main_config()
@@ -585,6 +585,10 @@ class LoreSeries:
lltr = LoreTrailer(name='Link', value=linkval)
extras.append(lltr)
+ if addmessageid:
+ msgid = "<%s>" % (lmsg.msgid)
+ extras.append(LoreTrailer(name='Message-ID', value=msgid))
+
if attsame and not attcrit:
if attmark:
logger.info(' %s %s', attmark, lmsg.get_am_subject())
diff --git a/b4/command.py b/b4/command.py
index e384031..7d73aa5 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -51,6 +51,8 @@ def cmd_am_common_opts(sp):
help='Add your own signed-off-by to every patch')
sp.add_argument('-l', '--add-link', dest='addlink', action='store_true', default=False,
help='Add a Link: with message-id lookup URL to every patch')
+ sp.add_argument('-I', '--add-message-id', dest='addmessageid', action='store_true', default=False,
+ help='Add a Message-ID: with message-id to every patch')
sp.add_argument('-P', '--cherry-pick', dest='cherrypick', default=None,
help='Cherry-pick a subset of patches (e.g. "-P 1-2,4,6-", '
'"-P _" to use just the msgid specified, or '
diff --git a/b4/mbox.py b/b4/mbox.py
index 48b037a..0e988a8 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -101,7 +101,7 @@ def make_am(msgs: List[email.message.Message], cmdargs: argparse.Namespace, msgi
am_msgs = lser.get_am_ready(noaddtrailers=cmdargs.noaddtrailers,
covertrailers=covertrailers, addmysob=cmdargs.addmysob,
addlink=cmdargs.addlink, linkmask=config['linkmask'], cherrypick=cherrypick,
- copyccs=cmdargs.copyccs, allowbadchars=cmdargs.allowbadchars)
+ copyccs=cmdargs.copyccs, allowbadchars=cmdargs.allowbadchars, addmessageid=cmdargs.addmessageid)
except KeyError:
sys.exit(1)
diff --git a/man/b4.5.rst b/man/b4.5.rst
index 90db4d7..07d2692 100644
--- a/man/b4.5.rst
+++ b/man/b4.5.rst
@@ -155,6 +155,8 @@ options:
Add your own signed-off-by to every patch
-l, --add-link
Add a Link: with message-id lookup URL to every patch
+ -I, --add-message-id
+ Add a Message-ID: with message-id to every patch
-P CHERRYPICK, --cherry-pick CHERRYPICK
Cherry-pick a subset of patches (e.g. "-P 1-2,4,6-", "-P _" to use just the msgid specified, or "-P *globbing*" to match on commit subject)
--cc-trailers
--
2.39.1
next reply other threads:[~2023-02-16 16:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-16 16:48 Palmer Dabbelt [this message]
2023-02-27 18:48 ` [PATCH] shazam: Add the --add-message-id argument Konstantin Ryabitsev
2023-02-27 19:00 ` Palmer Dabbelt
2023-02-27 19:03 ` Konstantin Ryabitsev
2023-02-27 19:05 ` Palmer Dabbelt
2023-02-27 20:09 ` Konstantin Ryabitsev
2023-02-27 20:26 ` Palmer Dabbelt
2023-02-27 20:47 ` Konstantin Ryabitsev
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=20230216164841.3356-1-palmer@rivosinc.com \
--to=palmer@rivosinc.com \
--cc=tools@linux.kernel.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;
as well as URLs for NNTP newsgroup(s).