aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2022-09-12 11:05:35 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2022-09-12 11:05:35 -0400
commit09bd354d0ae2d3d796b2a56e9e8555900a4be259 (patch)
treeccd93bf061783392f14d9e987f1fdd53ae1c57e8
parent9585564db03ac5a25cc4eeadea6240c0a27e749a (diff)
downloadb4-09bd354d0ae2d3d796b2a56e9e8555900a4be259.tar.gz
ez: split --no-auto-to-cc into two commands
Initial work on making the automatic addressee selection a bit more robust. I am not sure this is going quite the right way, but I wanted to make a point where we can go back to in case things go down the wrong path. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/command.py8
-rw-r--r--b4/ez.py18
2 files changed, 14 insertions, 12 deletions
diff --git a/b4/command.py b/b4/command.py
index 8a85232..7774f39 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -294,8 +294,10 @@ def cmd():
help='Do not send, write raw messages to this directory (forces --dry-run)')
sp_send.add_argument('--prefixes', nargs='+',
help='Prefixes to add to PATCH (e.g. RFC, WIP)')
- sp_send.add_argument('--no-auto-to-cc', action='store_true', default=False,
- help='Do not automatically collect To: and Cc: addresses')
+ sp_send.add_argument('--no-auto-cc', action='store_true', default=False,
+ help='Do not add addresses from trailers into the Cc: field')
+ sp_send.add_argument('--no-tocc-cmd', action='store_true', default=False,
+ help='Do not execute any commands to populate the To: and Cc: fields')
sp_send.add_argument('--to', nargs='+', help='Addresses to add to the To: list')
sp_send.add_argument('--cc', nargs='+', help='Addresses to add to the Cc: list')
sp_send.add_argument('--not-me-too', action='store_true', default=False,
@@ -303,7 +305,7 @@ def cmd():
sp_send.add_argument('--resend', default=None,
help='Resend a previously sent version of the series')
sp_send.add_argument('--no-sign', action='store_true', default=False,
- help='Do not cryptographically sign your patches with patatt')
+ help='Do not add the cryptographic attestation signature header')
ag_sendh = sp_send.add_argument_group('Web submission', 'Authenticate with the web submission endpoint')
ag_sendh.add_argument('--web-auth-new', dest='auth_new', action='store_true', default=False,
help='Initiate a new web authentication request')
diff --git a/b4/ez.py b/b4/ez.py
index ef54c20..1ed154a 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -109,7 +109,7 @@ def auth_new() -> None:
elif algo == 'ed25519':
from nacl.signing import SigningKey
from nacl.encoding import Base64Encoder
- sk = SigningKey(keydata, encoder=Base64Encoder)
+ sk = SigningKey(keydata.encode(), encoder=Base64Encoder)
pubkey = base64.b64encode(sk.verify_key.encode()).decode()
else:
logger.critical('CRITICAL: algorithm %s not currently supported for web endpoint submission', algo)
@@ -1132,36 +1132,36 @@ def cmd_send(cmdargs: argparse.Namespace) -> None:
ccdests = [('', x) for x in cmdargs.cc]
seen.update(set(cmdargs.cc))
- if not cmdargs.no_auto_to_cc:
- logger.info('Populating the To: and Cc: fields with automatically collected addresses')
-
+ tocmdstr = tocmd = None
+ cccmdstr = cccmd = None
+ if not cmdargs.no_tocc_cmd:
topdir = b4.git_get_toplevel()
# Use sane tocmd and cccmd defaults if we find a get_maintainer.pl
- tocmdstr = tocmd = None
- cccmdstr = cccmd = None
getm = os.path.join(topdir, 'scripts', 'get_maintainer.pl')
if config.get('send-auto-to-cmd'):
tocmdstr = config.get('send-auto-to-cmd')
elif os.access(getm, os.X_OK):
- logger.info('Invoking get_maintainer.pl for To: addresses')
tocmdstr = f'{getm} --nogit --nogit-fallback --nogit-chief-penguins --norolestats --nol'
if config.get('send-auto-cc-cmd'):
cccmdstr = config.get('send-auto-cc-cmd')
elif os.access(getm, os.X_OK):
- logger.info('Invoking get_maintainer.pl for Cc: addresses')
cccmdstr = f'{getm} --nogit --nogit-fallback --nogit-chief-penguins --norolestats --nom'
if tocmdstr:
sp = shlex.shlex(tocmdstr, posix=True)
sp.whitespace_split = True
tocmd = list(sp)
+ logger.info('Will collect To: addresses using %s', os.path.basename(tocmd[0]))
if cccmdstr:
sp = shlex.shlex(cccmdstr, posix=True)
sp.whitespace_split = True
cccmd = list(sp)
+ logger.info('Will collect Cc: addresses using %s', os.path.basename(cccmd[0]))
+ if not (cmdargs.no_tocc_cmd and cmdargs.no_auto_cc):
+ logger.info('Collecting To/Cc addresses')
seen = set()
- # Go through them again to make to/cc headers
+ # Go through the messages to make to/cc headers
for commit, msg in patches:
if not msg:
continue