devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/1] Add add-maintainer.py script
@ 2023-08-26  8:07 Guru Das Srinagesh
  2023-08-26  8:07 ` [PATCH v3 1/1] scripts: Add add-maintainer.py Guru Das Srinagesh
  0 siblings, 1 reply; 26+ messages in thread
From: Guru Das Srinagesh @ 2023-08-26  8:07 UTC (permalink / raw)
  To: Masahiro Yamada, Nick Desaulniers, Andrew Morton, Nicolas Schier,
	Konstantin Ryabitsev, Kees Cook, Bjorn Andersson, robh+dt,
	krzysztof.kozlowski+dt, Will Deacon, Greg Kroah-Hartman,
	quic_pkondeti
  Cc: linux-kernel, kernel, workflows, tools, devicetree, linux-arm-msm,
	linux-arm-kernel, linux-pm, Guru Das Srinagesh

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


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2023-09-27 22:48 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-26  8:07 [PATCH v3 0/1] Add add-maintainer.py script Guru Das Srinagesh
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

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 NNTP newsgroup(s).