aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-08-27 12:54:41 +0200
committerThomas Gleixner <tglx@linutronix.de>2019-08-27 12:54:41 +0200
commit80489f25c2a338fe1d241c4bdf927b53e7918425 (patch)
tree23b0b8294d60026dddfdd3a78d573988907df65b
parentd5b6cb26712a4590c3cb652543df5183d38651c1 (diff)
downloadquilttools-80489f25c2a338fe1d241c4bdf927b53e7918425.tar.gz
mb2q: Add config option to keep certain Cc addresses and fix SOB placement
Add a configuration option which allows to add mail addresses which are never dropped from the Cc list, e.g. stable@vger.kernel.org. Move the committer SOB (if not placed at the end) right after the last SOB in the chain. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--Documentation/examples/.mb2q.yaml7
-rw-r--r--Documentation/man1/mb2q.rst10
-rwxr-xr-xmb2q19
3 files changed, 29 insertions, 7 deletions
diff --git a/Documentation/examples/.mb2q.yaml b/Documentation/examples/.mb2q.yaml
index abac225..dae71a4 100644
--- a/Documentation/examples/.mb2q.yaml
+++ b/Documentation/examples/.mb2q.yaml
@@ -9,6 +9,10 @@ nocc_addrs:
- tglx@linutronix.de
- tglx@tglx.de
+# List of Cc addresses which must be kept
+keepcc_addrs:
+ - stable@vger.kernel.org
+
# List of mailing list addresses for which the
# Link: tag is generated
list_addrs:
@@ -29,5 +33,6 @@ link_base: https://lkml.kernel.org/r/
# to keep them.
dropcc: True
-# Emit committer SOB before Cc and Link tags.
+# Emit committer SOB next to the last SOB in the mail so
+# that the SOB chain is together
sob_before_cc: True
diff --git a/Documentation/man1/mb2q.rst b/Documentation/man1/mb2q.rst
index 32eac87..c6923b8 100644
--- a/Documentation/man1/mb2q.rst
+++ b/Documentation/man1/mb2q.rst
@@ -88,6 +88,9 @@ Configuration options
- nocc@email.addr
- another.nocc@email.addr
+ keepcc_addrs:
+ - stable@vger.kernel.org
+
list_addrs:
- linux-kernel@vger.kernel.org
- another-list@listserver.org
@@ -115,6 +118,13 @@ nocc_addrs:
independent of the dropcc config option and the '-C' command line
parameter
+keepcc_addrs:
+^^^^^^^^^^^^^
+
+ Mail addresses which are never dropped from the Cc list of a mail
+ independent of the dropcc config option and the '-C' command line
+ parameter
+
list_addrs:
^^^^^^^^^^^
diff --git a/mb2q b/mb2q
index 44bc1ef..e8db5c9 100755
--- a/mb2q
+++ b/mb2q
@@ -320,12 +320,15 @@ class patchmsg(object):
# Drop all ccs if requested
if key == 'Cc' and self.args.dropccs:
- return
+ # Check whether is must be kept, e.g. stable@vger...
+ if get_raw_mailaddr(addr) not in self.args.keepcc_addrs:
+ return
if key not in tag_nomail:
ts = self.tags.get(key, mailaddrs())
else:
ts = self.tags.get(key, tagstore())
+
ts.add(addr)
self.tags[key] = ts
self.has_tags = True
@@ -517,17 +520,19 @@ class quilter(object):
# Drop extra newlines before tags
res += pmsg.text.rstrip() + '\n\n'
+ last_tag = ''
for tag in tag_order:
# If SOB is empty warn
if tag == 'Signed-off-by' and not tag in pmsg.tags:
sys.stderr.write('Patch %s has no SOB\n' %pmsg.subject)
- # Write out the committer SOB before Cc, but not if the
- # committer is the author and no other SOBs are behind his
- # SOB
- if self.args.sob_before_cc and tag == 'Cc' and self.needs_sob(pmsg):
- res += 'Signed-off-by: %s\n' %self.args.committer
+ # Write out the committer SOB after the last SOB except when
+ # committer is the author and no other SOBs are behind his SOB
+ if self.args.sob_before_cc:
+ if last_tag == 'Signed-off-by' and self.needs_sob(pmsg):
+ res += 'Signed-off-by: %s\n' %self.args.committer
+ last_tag = tag
if not tag in pmsg.tags:
continue
@@ -624,6 +629,8 @@ if __name__ == '__main__':
args.committer = cfg.get('committer', committer_from_git())
# Cc's which should be dropped
args.nocc_addrs = cfg.get('nocc_addrs', [])
+ # Cc's which must not be dropped
+ args.keepcc_addrs = cfg.get('keepcc_addrs', [stable@vger.kernel.org])
# Mailing list addresses
args.list_addrs = cfg.get('list_addrs', ['linux-kernel.@vger.kernel.org'])
# Drop mails which originate from a mail clients management mail