Workflows Archive mirror
 help / color / mirror / Atom feed
From: Guru Das Srinagesh <quic_gurus@quicinc.com>
To: Masahiro Yamada <masahiroy@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Nicolas Schier" <nicolas@fjasle.eu>,
	Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	Kees Cook <keescook@chromium.org>,
	"Bjorn Andersson" <andersson@kernel.org>, <robh+dt@kernel.org>,
	<krzysztof.kozlowski+dt@linaro.org>,
	Will Deacon <will@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	<quic_pkondeti@quicinc.com>
Cc: <linux-kernel@vger.kernel.org>, <kernel@quicinc.com>,
	<workflows@vger.kernel.org>, <tools@linux.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-pm@vger.kernel.org>,
	"Guru Das Srinagesh" <quic_gurus@quicinc.com>
Subject: [PATCH v3 0/1] Add add-maintainer.py script
Date: Sat, 26 Aug 2023 01:07:41 -0700	[thread overview]
Message-ID: <cover.1693037031.git.quic_gurus@quicinc.com> (raw)

When pushing patches to upstream, the `get_maintainer.pl` script is used to
determine whom to send the patches to. Instead of having to manually process
the output of the script, add a wrapper script to do that for you.

The add-maintainer.py script adds maintainers (and mailing lists) to a patch,
editing it in-place. It also optionally undoes this operation if so desired.

Please try out this script with `--verbosity debug` for verifying that it's
doing "the right thing". I've tested this with a patch series from various
subsystems to ensure variety of maintainers and lists output and found it to be
behaving as expected. For an example output of this script, please see [1].

Thanks to Bjorn for being a sounding board to this idea and for his valuable
suggestions.

I referred to these links [2][3][4] during development of this script.

Apropos workflow:

Thanks to Krzysztof for sharing his workflow - I found his suggestion to use
git branch description as cover letter [5] particularly useful. Incorporating
that into the ideal workflow envisioned [6] for this script, we get:

    1. Do `git config format.coverFromDescription subject`
    2. Do `git branch --edit-description` and write cover letter
    3. Generate patches using `git format-patch --cover-letter -n --thread -v<N>`
    4. Run `add-maintainer.py` on the above patches
    5. `git send-email` the patches.

b4 is an amazing tool whose `b4 prep --auto-to-cc` does part of what this
script does, but with the above workflow, we have an in-tree solution to the
basic problem of preparing patches to be sent to LKML.  For multiple patchsets,
all one will need to do is to increment `-v` while git-formatting patches and
make corresponding changes to the cover letter via step #2 as necessary!

Changelog:

(v2 -> v3)
- Change patches nargs * -> + (Nicolas)
- Add entry in MAINTAINERS and add self as maintainer (Pavan)
- Bail out early if file does not exist (Pavan)
- Change From: line determination logic (Nicolas)
  - Look for From: line and stop at the first occurrence of it - don't search
    entire file
- Wrap the get_maintainer.pl call with a try-except block.
- Use a better (arguably so) email validation regex
- Don't disallow multiple "From:" in patch:
  - When the change is authored by someone other than the person generating the
    patch, there will be two "From: <email address>" lines in the patch. This
    is very valid, so don't error out.
- Reviewers also go in To: in addition to Maintainers.
- Add new "--undo" flag to undo effects of this script on a patch (tested)

(v1 -> v2)
- Added set-union logic based on Pavan's comments [7] and Bjorn's early suggestion
- Expanded audience and added more mailing lists to get more review comments and feedback

[1] https://lore.kernel.org/lkml/20230824214436.GA22659@quicinc.com/
[2] https://stackoverflow.com/questions/4427542/how-to-do-sed-like-text-replace-with-python
[3] https://stackoverflow.com/questions/4146009/python-get-list-indexes-using-regular-expression
[4] https://stackoverflow.com/questions/10507230/insert-line-at-middle-of-file-with-python
[5] https://lore.kernel.org/lkml/6f475c9b-dc0e-078e-9aa2-d876a1e02467@linaro.org/
[6] https://lore.kernel.org/lkml/20230816171538.GB26279@quicinc.com/
[7] https://lore.kernel.org/lkml/63764b84-3ebd-4081-836f-4863af196228@quicinc.com/

Guru Das Srinagesh (1):
  scripts: Add add-maintainer.py

 MAINTAINERS               |   5 ++
 scripts/add-maintainer.py | 164 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 169 insertions(+)
 create mode 100755 scripts/add-maintainer.py

-- 
2.41.0


             reply	other threads:[~2023-08-26  8:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-26  8:07 Guru Das Srinagesh [this message]
2023-08-26  8:07 ` [PATCH v3 1/1] scripts: Add add-maintainer.py Guru Das Srinagesh
2023-08-27 16:44   ` Randy Dunlap
2023-08-28 16:45     ` Guru Das Srinagesh
2023-08-28  8:14   ` Jani Nikula
2023-08-28 13:35     ` Bjorn Andersson
2023-08-28 13:48       ` Geert Uytterhoeven
2023-08-28 15:14         ` Vlastimil Babka
2023-08-28 15:23           ` Krzysztof Kozlowski
2023-08-28 16:50             ` Bjorn Andersson
2023-08-29  7:38               ` Jani Nikula
2023-08-28 16:50     ` Guru Das Srinagesh
2023-08-28  8:21   ` Krzysztof Kozlowski
2023-08-28 17:56     ` Guru Das Srinagesh
2023-08-28 17:59       ` Krzysztof Kozlowski
2023-08-28 19:41         ` Mark Brown
2023-08-28 19:45           ` Krzysztof Kozlowski
2023-08-29 23:16             ` Guru Das Srinagesh
2023-08-30  7:11               ` Krzysztof Kozlowski
2023-08-30 11:22               ` Mark Brown
2023-08-30 14:16                 ` Jeff Johnson
2023-09-27  4:51     ` Pavan Kondeti
2023-09-27 22:44       ` Guru Das Srinagesh
2023-09-26 12:02   ` Pavan Kondeti
2023-09-27  4:54     ` Pavan Kondeti
2023-09-27 22:47     ` Guru Das Srinagesh

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=cover.1693037031.git.quic_gurus@quicinc.com \
    --to=quic_gurus@quicinc.com \
    --cc=akpm@linux-foundation.org \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=kernel@quicinc.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=quic_pkondeti@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=tools@linux.kernel.org \
    --cc=will@kernel.org \
    --cc=workflows@vger.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).