Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: Joel Granados via B4 Relay <devnull+j.granados.samsung.com@kernel.org>
To: "Kernel.org Tools" <tools@linux.kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	 Joel Granados <j.granados@samsung.com>
Subject: [PATCH b4 v2] ez: Add --use-web-endpoint arg to force web endpoint
Date: Wed, 02 Aug 2023 09:39:41 +0200	[thread overview]
Message-ID: <20230802-jag-add_web_switch-v2-1-2e789cf3e0a0@samsung.com> (raw)

From: Joel Granados <j.granados@samsung.com>

Make it easier to prefer going through the web endpoint by adding an
argument that will force this path. This is for users that want to use
B4 for preparing and sharing patchsets over mail and need an argument to
activate the web endpoint whenever needed, but want to default to smtp
server for the rest.

Signed-off-by: Joel Granados <j.granados@samsung.com>
---
Changes in v2:
* Changed arg name from --web to --use-web-endpoint.
* Moved the argument to the main arguments group.
* Updated the doc so it still makes sense.
---
 b4/command.py             |  2 ++
 b4/ez.py                  |  4 +---
 docs/contributor/send.rst | 10 ++++++----
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/b4/command.py b/b4/command.py
index 1ae73d2..71c1abd 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -130,6 +130,8 @@ def setup_parser() -> argparse.ArgumentParser:
                         help='Do not perform any network queries')
     parser.add_argument('--no-stdin', action='store_true', default=False,
                         help='Disable TTY detection for stdin')
+    parser.add_argument('--use-web-endpoint', dest='send_web', action='store_true', default=False,
+                        help="Force going through the web endpoint")
 
     subparsers = parser.add_subparsers(help='sub-command help', dest='subcmd')
 
diff --git a/b4/ez.py b/b4/ez.py
index 3799e07..e38827f 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1459,10 +1459,8 @@ def cmd_send(cmdargs: argparse.Namespace) -> None:
         pathlib.Path(cmdargs.output_dir).mkdir(parents=True, exist_ok=True)
 
     sconfig = b4.get_sendemail_config()
-    # If we have an smtp server defined, always use that instead of the endpoint
-    # we may make this configurable in the future, but this almost always makes sense
     endpoint = None
-    if not sconfig.get('smtpserver'):
+    if not sconfig.get('smtpserver') or cmdargs.send_web:
         endpoint = config.get('send-endpoint-web', '')
         if not re.search(r'^https?://', endpoint):
             logger.debug('Endpoint does not start with https, ignoring: %s', endpoint)
diff --git a/docs/contributor/send.rst b/docs/contributor/send.rst
index 9be8d1c..8454f37 100644
--- a/docs/contributor/send.rst
+++ b/docs/contributor/send.rst
@@ -124,9 +124,10 @@ You should now be able to send patches via this web submission endpoint.
 
 Using your own SMTP server
 --------------------------
-B4 will use the ``sendemail`` section from your git configuration, but
-it only supports the most common subset of options. The vast majority of
-servers will only need the following settings::
+If there is a ``sendmail`` section in your git configuration, B4 will try use
+that by default instead of the web endpoint. Only the most common subset of
+options are supported. The vast majority of servers will only need the
+following settings::
 
     [sendemail]
        smtpServer = smtp.example.org
@@ -136,7 +137,8 @@ servers will only need the following settings::
        smtpPass = [omitted]
 
 You can also set up msmtp or a similar tool and specify the path to the
-``sendmail``-compliant binary as the value for ``smtpServer``.
+``sendmail``-compliant binary as the value for ``smtpServer``. You can force B4
+to use the web endpoint by using the ``--use-web-endpoint`` argument.
 
 Sending your patches
 --------------------

---
base-commit: 099c9b47b39b6076752b8c757872080fad8fae56
change-id: 20230801-jag-add_web_switch-42a4287768ed

Best regards,
-- 
Joel Granados <j.granados@samsung.com>


             reply	other threads:[~2023-08-02  7:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  7:39 Joel Granados via B4 Relay [this message]
2023-08-02 16:07 ` [PATCH b4 v2] ez: Add --use-web-endpoint arg to force web endpoint 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=20230802-jag-add_web_switch-v2-1-2e789cf3e0a0@samsung.com \
    --to=devnull+j.granados.samsung.com@kernel.org \
    --cc=j.granados@samsung.com \
    --cc=konstantin@linuxfoundation.org \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).