diff mbox series

[auh] upgrade-helper.py: add patches directly to AUH emails, in addition to attaching them as files

Message ID 20230612104358.669755-1-alex@linutronix.de
State New
Headers show
Series [auh] upgrade-helper.py: add patches directly to AUH emails, in addition to attaching them as files | expand

Commit Message

Alexander Kanavin June 12, 2023, 10:43 a.m. UTC
This utilizes the 'scissors' feature as described here

https://git-scm.com/docs/git-mailinfo#Documentation/git-mailinfo.txt---scissors

and allows easy handling of AUH emails with tools like b4, patchwork or
even 'git am' directly, eliminating the need to get the attachment first.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 upgrade-helper.py | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/upgrade-helper.py b/upgrade-helper.py
index 4393589..4f0b6b7 100755
--- a/upgrade-helper.py
+++ b/upgrade-helper.py
@@ -358,6 +358,10 @@  class Updater(object):
             attachment_fullpath = os.path.join(pkg_ctx['workdir'], attachment)
             if os.path.isfile(attachment_fullpath):
                 attachments.append(attachment_fullpath)
+                # Also add the patch inline using the 'scissors':
+                # https://git-scm.com/docs/git-mailinfo#Documentation/git-mailinfo.txt---scissors
+                if attachment_fullpath.endswith('.patch'):
+                    msg_body += "\n\n-- >8 --\n%s" % (open(attachment_fullpath).read())
 
         if self.opts['send_email']:
             self.email_handler.send_email(to_addr, subject, msg_body, attachments, cc_addr=cc_addr)