Linux maintainer tooling and workflows
 help / color / Atom feed
* backfilling threads with b4 (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches)
       [not found]       ` <YIG43TuqmxU24evq@unreal>
@ 2021-04-22 18:05         ` Konstantin Ryabitsev
  2021-04-22 18:51           ` Leon Romanovsky
  2021-04-25 10:58           ` Leon Romanovsky
  0 siblings, 2 replies; 11+ messages in thread
From: Konstantin Ryabitsev @ 2021-04-22 18:05 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: ksummit, tools

On Thu, Apr 22, 2021 at 08:56:45PM +0300, Leon Romanovsky wrote:
> >     macro index 4 "<pipe-message>~/work/git/korg/b4/b4.sh mbox -f -o ~/Mail<return>"
> > 
> > You'll need to adjust it to point at where your maildir lives, of course, but
> > that's the general idea. With it in place, you can hit "4" in the index view
> > to get the rest of the thread (without duplicating the messages you already
> > have).
> 
> Konstantin,
> 
> I tried the above and here the obstacles which I encounter.

This is probably better suited for tools@linux.kernel.org (cc'ing
accordingly).

> 1. My emails are stored in Maildir. The mb2md script half-worked but ok
> for the test.
> 2. b4 didn't work if I tried to use lore link from the middle of discussion,
> which is very common pattern to me.
> 3. b4 didn't grab the discussions, so I got the patches, but didn't get and
> won't get any interesting to me responses.

Are you sure you copied the command correctly? 

1. It should automatically recognize when it's pointed at a maildir, so no
   mb2md should be necessary. Are you sure you changed "-o ~/Mail" to be
   pointing at your maildir?
2. It's supposed to grab the message-id from the piped message, so you
   shouldn't need to pass any lore links.
3. Are you sure you're using "b4 mbox" not "b4 am"? The mbox command just
   returns the entire thread.

Please feel free to drop ksummit and others on your reply.

-K

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

* Re: backfilling threads with b4 (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches)
  2021-04-22 18:05         ` backfilling threads with b4 (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches) Konstantin Ryabitsev
@ 2021-04-22 18:51           ` Leon Romanovsky
  2021-04-25 10:58           ` Leon Romanovsky
  1 sibling, 0 replies; 11+ messages in thread
From: Leon Romanovsky @ 2021-04-22 18:51 UTC (permalink / raw)
  To: tools

On Thu, Apr 22, 2021 at 02:05:40PM -0400, Konstantin Ryabitsev wrote:
> On Thu, Apr 22, 2021 at 08:56:45PM +0300, Leon Romanovsky wrote:
> > >     macro index 4 "<pipe-message>~/work/git/korg/b4/b4.sh mbox -f -o ~/Mail<return>"
> > > 
> > > You'll need to adjust it to point at where your maildir lives, of course, but
> > > that's the general idea. With it in place, you can hit "4" in the index view
> > > to get the rest of the thread (without duplicating the messages you already
> > > have).
> > 
> > Konstantin,
> > 
> > I tried the above and here the obstacles which I encounter.
> 
> This is probably better suited for tools@linux.kernel.org (cc'ing
> accordingly).
> 
> > 1. My emails are stored in Maildir. The mb2md script half-worked but ok
> > for the test.
> > 2. b4 didn't work if I tried to use lore link from the middle of discussion,
> > which is very common pattern to me.
> > 3. b4 didn't grab the discussions, so I got the patches, but didn't get and
> > won't get any interesting to me responses.
> 
> Are you sure you copied the command correctly? 
> 
> 1. It should automatically recognize when it's pointed at a maildir, so no
>    mb2md should be necessary. Are you sure you changed "-o ~/Mail" to be
>    pointing at your maildir?

I didn't want experiment on my main maildir folder so pointed to /tmp,
and didn't know that b4 recognizes format.

> 2. It's supposed to grab the message-id from the piped message, so you
>    shouldn't need to pass any lore links.

I didn't pass any links, just used as a "feed" one of the replies to the
series which I don't have.

> 3. Are you sure you're using "b4 mbox" not "b4 am"? The mbox command just
>    returns the entire thread.

Yes, I used mbox, but will retest it tomorrow, maybe I did something wrong.

> 
> Please feel free to drop ksummit and others on your reply.
> 
> -K

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

* Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches
       [not found]         ` <CAL_JsqKS-=shqkLhzKeLHqNPhosGJw5X-fOi+dy1rT3Q_LfBZg@mail.gmail.com>
@ 2021-04-23  6:04           ` Mauro Carvalho Chehab
  2021-04-23  6:46             ` Joe Perches
  0 siblings, 1 reply; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-23  6:04 UTC (permalink / raw)
  To: Rob Herring
  Cc: Steven Rostedt, Leon Romanovsky, James Bottomley, ksummit, tools

Em Thu, 22 Apr 2021 09:20:19 -0500
Rob Herring <robherring2@gmail.com> escreveu:

> On Thu, Apr 22, 2021 at 8:30 AM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > On Thu, 22 Apr 2021 14:34:53 +0300
> > Leon Romanovsky <leon@kernel.org> wrote:
> >  
> > > > This is not a matter of bad practice. There are a couple of reasons
> > > > why each patch on a series will have a different group of Cc, like:
> > > >
> > > >     - driver maintainers for each patch may be different;
> > > >     - scripts/get_maintainers.pl will return a different Cc/To;
> > > >     - patch series touch different subsystems;  
> > >
> > > Like Christoph said, if it is unrelated send the patches as separated
> > > series.  
> >
> > Since I use quilt to send my patches, my only two choices are all patches,
> > or individual ones with Cc. Some of my patches will need to touch every
> > architecture. I'll Cc the maintainers of the architecture code, but not
> > include them in every architecture patch. And because this code depends on
> > other patches, I can not send them as individual series.
> >
> > I use to have issues with this, but now with lore, I can trivially find the
> > entire thread and read it the whole story. IMO, it is no longer bad
> > practice to Cc only a single patch is a larger series to a maintainer, for
> > the one patch that touches their code. It's a "FYI, I'm touching your
> > code". But because of lore, it's really easy for them to get the full
> > picture.
> >
> > I much rather have my INBOX today be only patches that touches my code,
> > then full series of patches that I really don't care about. Worse yet, I'll
> > get Cc'd on a full series of 20 patches, where only one patch touches my
> > code. The sad part is, I'm much more likely to ignore that series, because
> > I'm added to stuff by get-maintainers for the strangest reason, and
> > completely miss that there's a single patch in there that really requires
> > my review.
> >
> > Please, just Cc me on code that touches something I maintain or listed as
> > a reviewer (which is still a lot).  
> 
> Unless the process of who to Cc or not is completely automated,
> relying on submitters to do the right thing to give you the subset of
> emails you want to see is never going to work. I have frequent
> problems with folks not Cc'ing the DT list for DT patches, how hard is
> that? I think the answer is making where patches are sent less
> important and better/easier filtering from lore (which is coming).

I have a script to automate it, but I had to tweak it while handling
patches that cross a single subsystem boundaries, using git send-email
with the c/c list obtained from get_maintainers.pl.

By default, the script adds all maintainers, reviewers and all mailing
lists to the cover letter, but that sometimes generate a cover letter
with 80+ c/c, which will be automatically rejected by anti-spam
measures and by mail servers.

So, I played with two different alternatives:

1. At the beginning, I changed the script to c/c only the mailing lists,
   excluding maintainers/reviewers;
2. As the feedback was not great, I changed the script to c/c only
   the maintainers, excluding mailing lists/reviewers. It seems that
   this worked better.

I didn't try to play with bcc, as replying to it would not send
the replies to everyone.

If you think it is worth, I could submit it to scripts/, but I
suspect we may need to adjust it to work with all maintainers'
workflows.

Thanks,
Mauro

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

* Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches
  2021-04-23  6:04           ` [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches Mauro Carvalho Chehab
@ 2021-04-23  6:46             ` Joe Perches
  2021-04-23  7:13               ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2021-04-23  6:46 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Rob Herring
  Cc: Steven Rostedt, Leon Romanovsky, James Bottomley, ksummit, tools

On Fri, 2021-04-23 at 08:04 +0200, Mauro Carvalho Chehab wrote:
> I have a script to automate it, but I had to tweak it while handling
> patches that cross a single subsystem boundaries, using git send-email
> with the c/c list obtained from get_maintainers.pl.
> 
> By default, the script adds all maintainers, reviewers and all mailing
> lists to the cover letter, but that sometimes generate a cover letter
> with 80+ c/c, which will be automatically rejected by anti-spam
> measures and by mail servers.
> 
> So, I played with two different alternatives:
> 
> 1. At the beginning, I changed the script to c/c only the mailing lists,
>    excluding maintainers/reviewers;
> 2. As the feedback was not great, I changed the script to c/c only
>    the maintainers, excluding mailing lists/reviewers. It seems that
>    this worked better.
> 
> I didn't try to play with bcc, as replying to it would not send
> the replies to everyone.
> 
> If you think it is worth, I could submit it to scripts/, but I
> suspect we may need to adjust it to work with all maintainers'
> workflows.

I have a very similar script

A portion of a cc script I use tests whether cc'ing the cover letter
to all listed maintainers of a patch series creates a header of less
than 512 chars and if so cc's all relevant maintainers, otherwise it
just cc's the mailing lists.

(Ingo didn't/doesn't want to receive any emails from me)

$ cat ~/bin/remove_undesirable_emails.sh
grep -vPi "(?:\bIngo\s+Molnar\b)"

$ cat ~/bin/cc.sh
#!/bin/bash

opts="--nogit --nogit-fallback --norolestats"
maint_file=$(mktemp -t XXXXXXXX.cc)

if [[ $(basename $1) =~ ^0000- ]] ; then
    ./scripts/get_maintainer.pl $opts $(dirname $1)/* |  \
	~/bin/remove_undesirable_emails.sh > $maint_file
    count=$(wc -c $maint_file | cut -f1 -d" ")
    if [[ $count -lt 512 ]] ; then
	cat $maint_file
    else
	./scripts/get_maintainer.pl -nom -nor $opts $(dirname $1)/* | \
	    ~/bin/remove_undesirable_emails.sh
    fi

...


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

* Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches
  2021-04-23  6:46             ` Joe Perches
@ 2021-04-23  7:13               ` Mauro Carvalho Chehab
  2021-04-23  7:20                 ` [PATCH RFC] scripts: add a script for sending patches Mauro Carvalho Chehab
  2021-04-23 14:52                 ` Better tools for sending patches (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches) Doug Anderson
  0 siblings, 2 replies; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-23  7:13 UTC (permalink / raw)
  To: Joe Perches
  Cc: Rob Herring, Steven Rostedt, Leon Romanovsky, James Bottomley,
	ksummit, tools

Em Thu, 22 Apr 2021 23:46:31 -0700
Joe Perches <joe@perches.com> escreveu:

> On Fri, 2021-04-23 at 08:04 +0200, Mauro Carvalho Chehab wrote:
> > I have a script to automate it, but I had to tweak it while handling
> > patches that cross a single subsystem boundaries, using git send-email
> > with the c/c list obtained from get_maintainers.pl.
> > 
> > By default, the script adds all maintainers, reviewers and all mailing
> > lists to the cover letter, but that sometimes generate a cover letter
> > with 80+ c/c, which will be automatically rejected by anti-spam
> > measures and by mail servers.
> > 
> > So, I played with two different alternatives:
> > 
> > 1. At the beginning, I changed the script to c/c only the mailing lists,
> >    excluding maintainers/reviewers;
> > 2. As the feedback was not great, I changed the script to c/c only
> >    the maintainers, excluding mailing lists/reviewers. It seems that
> >    this worked better.
> > 
> > I didn't try to play with bcc, as replying to it would not send
> > the replies to everyone.
> > 
> > If you think it is worth, I could submit it to scripts/, but I
> > suspect we may need to adjust it to work with all maintainers'
> > workflows.  
> 
> I have a very similar script
> 
> A portion of a cc script I use tests whether cc'ing the cover letter
> to all listed maintainers of a patch series creates a header of less
> than 512 chars and if so cc's all relevant maintainers, otherwise it
> just cc's the mailing lists.
> 
> (Ingo didn't/doesn't want to receive any emails from me)
> 
> $ cat ~/bin/remove_undesirable_emails.sh
> grep -vPi "(?:\bIngo\s+Molnar\b)"
> 
> $ cat ~/bin/cc.sh
> #!/bin/bash
> 
> opts="--nogit --nogit-fallback --norolestats"
> maint_file=$(mktemp -t XXXXXXXX.cc)
> 
> if [[ $(basename $1) =~ ^0000- ]] ; then
>     ./scripts/get_maintainer.pl $opts $(dirname $1)/* |  \
> 	~/bin/remove_undesirable_emails.sh > $maint_file
>     count=$(wc -c $maint_file | cut -f1 -d" ")
>     if [[ $count -lt 512 ]] ; then
> 	cat $maint_file
>     else
> 	./scripts/get_maintainer.pl -nom -nor $opts $(dirname $1)/* | \
> 	    ~/bin/remove_undesirable_emails.sh
>     fi
> 
> ...
> 

Heh, mine is a lot more complex than that ;-) 

It internally runs git format-patch, git send-email and get_maintainers.pl,
and, when --cover or --annotate is used, it opens a window to allow
editing the text. It has several options in order to tweak its behavior. 

That's the result of trying to send a patch series (in this example,
 16 patches for staging/media drivers):

<snip>
$ send-patches.pl upstream/master.. --cover
$ git format-patch -o patches/tmp --stat --summary --patience --signoff --thread=shallow --cover-letter --subject-prefix 'PATCH' upstream/master..
Checking patches/tmp/0000-cover-letter.patch
Checking patches/tmp/0001-media-staging-media-hantro-Align-line-break-to-the-o.patch
./scripts/get_maintainer.pl  patches/tmp/0001-media-staging-media-hantro-Align-line-break-to-the-o.patch
    Cc + cover Cc: Ezequiel Garcia <ezequiel@collabora.com> (maintainer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc + cover Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (maintainer)
    Cc + cover Cc: Philipp Zabel <p.zabel@pengutronix.de> (maintainer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
    Cc + cover Cc: linux-rockchip@lists.infradead.org (open list)
Checking patches/tmp/0002-media-staging-media-hantro-Align-line-break-to-the-o.patch
./scripts/get_maintainer.pl  patches/tmp/0002-media-staging-media-hantro-Align-line-break-to-the-o.patch
    Cc + cover Cc: Ezequiel Garcia <ezequiel@collabora.com> (maintainer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc + cover Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (maintainer)
    Cc + cover Cc: Philipp Zabel <p.zabel@pengutronix.de> (maintainer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
    Cc + cover Cc: linux-rockchip@lists.infradead.org (open list)
Checking patches/tmp/0003-media-staging-media-omap4iss-Align-line-break-to-the.patch
./scripts/get_maintainer.pl  patches/tmp/0003-media-staging-media-omap4iss-Align-line-break-to-the.patch
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc + cover Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> (maintainer)
    Cc + cover Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (maintainer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0004-media-staging-media-atomisp-Removed-a-superfluous-el.patch
./scripts/get_maintainer.pl  patches/tmp/0004-media-staging-media-atomisp-Removed-a-superfluous-el.patch
    Cc: Filip Kolev <fil.kolev@gmail.com> (commit_signer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> (commit_signer)
    Cc: Martiros Shakhzadyan <vrzh@vrzh.net> (commit_signer)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc + cover Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (reviewer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0005-media-staging-media-atomisp-i2c-align-line-break-to-.patch
./scripts/get_maintainer.pl  patches/tmp/0005-media-staging-media-atomisp-i2c-align-line-break-to-.patch
    Cc: Beatriz Martins de Carvalho <martinsdecarvalhobeatriz@gmail.com> (commit_signer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> (commit_signer)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (commit_signer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0006-media-staging-media-intel-ipu3-remove-unnecessary-bl.patch
./scripts/get_maintainer.pl  patches/tmp/0006-media-staging-media-intel-ipu3-remove-unnecessary-bl.patch
    Cc + cover Cc: Bingbu Cao <bingbu.cao@intel.com> (reviewer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> (commit_signer)
    Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> (commit_signer)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc: Mitali Borkar <mitaliborkar810@gmail.com> (commit_signer)
    Cc: Rahul Gottipati <rahul.blr97@gmail.com> (cc)
    Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (commit_signer)
    Cc + cover Cc: Tianshu Qiu <tian.shu.qiu@intel.com> (reviewer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0007-media-staging-media-intel-ipu3-reduce-length-of-line.patch
./scripts/get_maintainer.pl  patches/tmp/0007-media-staging-media-intel-ipu3-reduce-length-of-line.patch
    Cc + cover Cc: Bingbu Cao <bingbu.cao@intel.com> (reviewer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> (commit_signer)
    Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> (commit_signer)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc: Mitali Borkar <mitaliborkar810@gmail.com> (commit_signer)
    Cc: Rahul Gottipati <rahul.blr97@gmail.com> (cc)
    Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (commit_signer)
    Cc + cover Cc: Tianshu Qiu <tian.shu.qiu@intel.com> (reviewer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0008-media-staging-media-intel-ipu3-remove-space-before-t.patch
./scripts/get_maintainer.pl  patches/tmp/0008-media-staging-media-intel-ipu3-remove-space-before-t.patch
    Cc + cover Cc: Bingbu Cao <bingbu.cao@intel.com> (reviewer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> (commit_signer)
    Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> (commit_signer)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc: Mitali Borkar <mitaliborkar810@gmail.com> (commit_signer)
    Cc: Rahul Gottipati <rahul.blr97@gmail.com> (cc)
    Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (commit_signer)
    Cc + cover Cc: Tianshu Qiu <tian.shu.qiu@intel.com> (reviewer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0009-media-staging-media-intel-ipu3-line-should-not-end-w.patch
./scripts/get_maintainer.pl  patches/tmp/0009-media-staging-media-intel-ipu3-line-should-not-end-w.patch
    Cc + cover Cc: Bingbu Cao <bingbu.cao@intel.com> (reviewer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> (commit_signer)
    Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> (cc)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc: Mitali Borkar <mitaliborkar810@gmail.com> (commit_signer)
    Cc: Rahul Gottipati <rahul.blr97@gmail.com> (commit_signer)
    Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (commit_signer)
    Cc + cover Cc: Tianshu Qiu <tian.shu.qiu@intel.com> (reviewer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0010-media-staging-media-zoran-add-spaces-around-operator.patch
./scripts/get_maintainer.pl  patches/tmp/0010-media-staging-media-zoran-add-spaces-around-operator.patch
    Cc + cover Cc: Corentin Labbe <clabbe@baylibre.com> (maintainer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc + cover Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (maintainer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
    Cc + cover Cc: mjpeg-users@lists.sourceforge.net (open list)
Checking patches/tmp/0011-media-staging-media-atomisp-Minor-code-style-changes.patch
./scripts/get_maintainer.pl  patches/tmp/0011-media-staging-media-atomisp-Minor-code-style-changes.patch
    Cc: Filip Kolev <fil.kolev@gmail.com> (commit_signer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> (commit_signer)
    Cc: Martiros Shakhzadyan <vrzh@vrzh.net> (commit_signer)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc + cover Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (reviewer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0012-media-staging-media-omap4iss-Remove-unused-macro-fun.patch
./scripts/get_maintainer.pl  patches/tmp/0012-media-staging-media-omap4iss-Remove-unused-macro-fun.patch
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc + cover Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> (maintainer)
    Cc + cover Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (maintainer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0013-media-staging-media-atomisp-pci-Correct-identation-i.patch
./scripts/get_maintainer.pl  patches/tmp/0013-media-staging-media-atomisp-pci-Correct-identation-i.patch
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (commit_signer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc + cover Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (reviewer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0014-media-staging-media-atomisp-pci-Correct-identation-i.patch
./scripts/get_maintainer.pl  patches/tmp/0014-media-staging-media-atomisp-pci-Correct-identation-i.patch
    Cc: Aline Santana Cordeiro <alinesantanacordeiro@gmail.com> (commit_signer)
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (commit_signer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> (commit_signer)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (commit_signer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0015-media-staging-media-atomisp-pci-Format-comments-acco.patch
./scripts/get_maintainer.pl  patches/tmp/0015-media-staging-media-atomisp-pci-Format-comments-acco.patch
    Cc: Aline Santana Cordeiro <alinesantanacordeiro@gmail.com> (commit_signer)
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (commit_signer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> (commit_signer)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (commit_signer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
Checking patches/tmp/0016-media-staging-media-atomisp-pci-Format-comments-acco.patch
./scripts/get_maintainer.pl  patches/tmp/0016-media-staging-media-atomisp-pci-Format-comments-acco.patch
    Cc: Aline Santana Cordeiro <alinesantanacordeiro@gmail.com> (commit_signer)
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (commit_signer)
    Cc: Arnd Bergmann <arnd@arndb.de> (commit_signer)
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cc)
    Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> (commit_signer)
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (commit_signer)
    Cc + cover Cc: Sakari Ailus <sakari.ailus@linux.intel.com> (reviewer)
    Cc + cover Cc: devel@driverdev.osuosl.org (open list)
    Cc + cover Cc: linux-kernel@vger.kernel.org (open list)
    Cc + cover Cc: linux-media@vger.kernel.org (open list)
patches/tmp/0000-cover-letter.patch:
    Cc: Bingbu Cao <bingbu.cao@intel.com>
    Cc: Corentin Labbe <clabbe@baylibre.com>
    Cc: Ezequiel Garcia <ezequiel@collabora.com>
    Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
    Cc: Philipp Zabel <p.zabel@pengutronix.de>
    Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
    Cc: Tianshu Qiu <tian.shu.qiu@intel.com>
    Cc: devel@driverdev.osuosl.org
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-media@vger.kernel.org
    Cc: linux-rockchip@lists.infradead.org
    Cc: mjpeg-users@lists.sourceforge.net
Number of Cc at cover: 13
</snip>

I guess I'll post it as a RFC patch c/c this thread.

Thanks,
Mauro

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

* [PATCH RFC] scripts: add a script for sending patches
  2021-04-23  7:13               ` Mauro Carvalho Chehab
@ 2021-04-23  7:20                 ` Mauro Carvalho Chehab
  2021-04-23 14:52                 ` Better tools for sending patches (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches) Doug Anderson
  1 sibling, 0 replies; 11+ messages in thread
From: Mauro Carvalho Chehab @ 2021-04-23  7:20 UTC (permalink / raw)
  Cc: linuxarm, mauro.chehab, Mauro Carvalho Chehab, James Bottomley,
	Joe Perches, Leon Romanovsky, Rob Herring, Steven Rostedt,
	ksummit, linux-kernel, tools

This script send patches to an upstream maintainer's tree,
using git send-email and producing the relevant c/c list,
by using scripts/get_maintainers.pl.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---

As result of the current discussions about Rethinking the acceptance
policy for  "trivial" patches,  I'm submitting the script I wrote in order
to help me to send patches upstream using get_maintainers.pl.

I've been playing with this script since 2015, and had to improve and
add new options to it over time, based on some specific needs that
I detected while submitting patches both to a single subsystem and to
multiple ones.

 scripts/send-patches.pl | 658 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 658 insertions(+)
 create mode 100755 scripts/send-patches.pl

diff --git a/scripts/send-patches.pl b/scripts/send-patches.pl
new file mode 100755
index 000000000000..b4aa73979e4d
--- /dev/null
+++ b/scripts/send-patches.pl
@@ -0,0 +1,658 @@
+#!/usr/bin/perl
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2015- by Mauro Carvalho Chehab <mchehab@kernel.org>
+
+use strict;
+use warnings;
+use Email::Simple;
+use Email::Address;
+use Getopt::Long;
+use Pod::Usage;
+use File::Path 'make_path';
+require Tk;
+require Tk::Text;
+require Tk::Font;
+require Tk::Toplevel;
+
+# Where the patch series will be stored. If doesn't exits,
+# it will be automatically created
+my $tmp_dir = "patches/tmp";
+
+# Used together with --avoid-resend
+my $resend_cache_dir = "patches/last_patches";
+my $version_ctrl = ".version_control";
+
+#
+# File editor function. Currently relies on Tk to open
+# a separate edit window.
+#
+sub edit_text($) {
+	my $fname = shift;
+	my $string = qx(cat $fname);
+	my $edited_text;
+
+	my $toplvl = MainWindow->new();
+	my $font = $toplvl->Font(family  => 'fixed', size => 12);
+
+	my $frame_txt = $toplvl->Frame();
+	my $frame_btn = $toplvl->Frame();
+
+	$toplvl->configure(-title => "Editing $fname");
+
+	my $text = $frame_txt->Scrolled('Text')->pack;
+	$text->configure(-height      => 30,
+			-background  => 'black',
+			-foreground  => 'gray',
+			-insertbackground => 'white',
+			-width       => 80,
+			-wrap        => 'word',
+			-font        => $font);
+
+	my $Button1 = $frame_btn->Button();
+	$Button1->configure(-text    => 'OK',
+		       -bg      => 'lightblue',
+		       -width   => 5,
+		       -height  => 1,
+		       -command => sub{$edited_text = $text->get("1.0", "end"); $toplvl->destroy} );
+
+	$text->insert('1.0', $string);
+
+	# Pack the widgets in the frames
+	$text->pack();
+	$frame_txt->pack();
+	$frame_btn->pack();
+	$Button1->pack();
+
+	$text->waitWindow();
+
+	return $edited_text;
+}
+
+#
+# Argument handling
+#
+my $edit = 0;
+my $cover = 0;
+my $man = 0;
+my $help = 0;
+my $cmd_line = "git format-patch -o $tmp_dir --stat --summary --patience --signoff --thread=shallow";
+my $changeset = 0;
+my $dont_send = 0;
+my $avoid_resend = 0;
+my $reply_patches = 0;
+my $subject_prefix = "PATCH";
+my $dont_get_maintainer = 0;
+my $dont_get_reviewer = 0;
+my $reroll_count = "";
+my $git = 0;
+my $nogit = 0;
+my $add_everyone = 0;
+my $unify = "";
+my $to_maintainers = 0;
+
+GetOptions(
+	"cover|letter" => sub { $cmd_line .= " --cover-letter"; $cover = 1},
+	"no-merge|no-merges|no-renames" =>  sub { $cmd_line .= " --no-renames" },
+	"merge|M" =>  sub { $cmd_line .= " -M01" },
+	"delete|D" =>  sub { $cmd_line .= " -D" },
+	"unify|U=s" =>  \$unify,
+	"to=s" => sub { my ($opt, $arg) = @_; $cmd_line .= " --to '$arg'" },
+	"cc=s" => sub { my ($opt, $arg) = @_; $cmd_line .= " --cc '$arg'" },
+	"prefix|subject-prefix=s" => \$subject_prefix,
+	"edit|annotate" => \$edit,
+	"dry-run|dont-send" => \$dont_send,
+	"reply-patches" => sub { $reply_patches = 1; $avoid_resend = 1; $cmd_line .= " -N" },
+	"avoid-resend" => sub { $avoid_resend = 1; $cmd_line .= " -N" },
+	"dont-get-maintainer" => \$dont_get_maintainer,
+	"dont-get-reviewer" => \$dont_get_reviewer,
+	"everyone|add-everyone" => \$add_everyone,
+	"git" => \$git,
+	"no-git-fallback" => \$nogit,
+	"to-maintainers" => \$to_maintainers,
+	"v|reroll_count=s" => \$reroll_count,
+	"help" => \$help,
+	"man" => \$man,
+) or pod2usage(2);
+
+$help = 1 if (@ARGV < 1);
+
+if ($avoid_resend && $cover) {
+	printf ("Sorry, you can't avoid resend patches and add a cover yet.\n");
+}
+
+pod2usage(1) if $help;
+pod2usage(-verbose => 2) if $man;
+
+$cmd_line .= " --subject-prefix '$subject_prefix'";
+$cmd_line .= " -v $reroll_count" if ($reroll_count);
+$cmd_line .= " -U$unify" if ($unify);
+$cmd_line = join(' ', $cmd_line, @ARGV);
+
+$dont_get_reviewer = 1 if ($dont_get_maintainer);
+
+#
+# Prepare to avoid resending patches
+#
+
+my %cgid_to_msgid;
+my %msgid_to_file;
+my %msgid_to_subject;
+
+sub msgid_from_last_patch($)
+{
+	my $change_id = shift;
+
+	return 0 if (!$change_id);
+	return 0 if (!$cgid_to_msgid{$change_id});
+
+	return $cgid_to_msgid{$change_id};
+}
+
+if ($avoid_resend) {
+	open IN, $version_ctrl or print "Can't find $version_ctrl\n";
+	while (<IN>) {
+		if (m/([^\t]+)\t([^\t]+).*\n/) {
+			$cgid_to_msgid{$1} = $2;
+		}
+	}
+	close IN;
+
+	opendir(my $dh, $resend_cache_dir) || die "can't read patches at $resend_cache_dir";
+	while(readdir $dh) {
+		my $name = "$resend_cache_dir/$_";
+		next if (-d $name);
+
+		my $raw_email = qx(cat $name);
+		my $email = Email::Simple->new($raw_email);
+		my $msgid = $email->header("Message-Id");
+		my $subject = $email->header("Subject");
+
+		$msgid_to_file{$msgid} = $name if ($msgid);
+		$msgid_to_subject{$msgid} = $subject if ($subject && $msgid);
+	}
+	closedir $dh;
+}
+
+sub get_maintainer($$)
+{
+	my $cmd = $_[0];
+	my @file_cc = @{$_[1]};
+	my $role;
+	my $e_mail;
+	my %cc = (
+		"linux-kernel\@vger.kernel.org" => 1
+	);
+
+	foreach $e_mail (@file_cc) {
+		my @addresses = Email::Address->parse($e_mail);
+		for my $address (@addresses) {
+			$cc{$address} = "cc";
+		}
+	}
+
+	$cmd = "./scripts/get_maintainer.pl " . $cmd;
+
+	print "$cmd\n";
+	open IN, "$cmd |" or die "can't run $cmd";
+	while (<IN>) {
+		$e_mail = $_;
+		$e_mail =~ s/(.*\@\S+)\s*\(.*/$1/;
+		$e_mail =~ s/\s*$//;
+
+
+		if (m/\(.*(open list|moderated list|subscriber list|maintainer|reviewer|modified|chief|commit_signer).*\)/) {
+			$role = $1;
+		} else {
+			$role = "cc";
+		}
+		# Discard myself
+		next if ($e_mail =~ m/(mchehab|mauro.?chehab)\S+\@\S+/);
+		$cc{$e_mail} = $role;
+	}
+	close IN;
+
+	return %cc;
+}
+
+#
+# Generate patches with git format-patch
+#
+make_path($tmp_dir);
+unlink glob "$tmp_dir/*";
+
+print "\$ $cmd_line\n";
+system ("$cmd_line >>/dev/null") && die("Failed to run git format-patch");
+
+#
+# Add Cc: based on get_maintainer.pl script
+#
+my @patches;
+my @send_patches;
+
+opendir(my $dh, $tmp_dir) || die "can't read patches at $tmp_dir";
+while(readdir $dh) {
+	my $name = "$tmp_dir/$_";
+	push @patches,$name if (-f $name);
+}
+closedir $dh;
+
+my %changeids;
+
+my $has_cover;
+my %cover_cc;
+
+foreach my $f(sort @patches) {
+	print "Checking $f\n";
+	if ($f =~ m,0000-cover-letter.patch$,) {
+		push @send_patches, $f;
+		$has_cover = 1;
+		next;
+	}
+
+	my $raw_email = qx(cat $f);
+	die "Can't read $f" if (!$raw_email);
+
+	my $email = Email::Simple->new($raw_email);
+
+	my $msgid = 0;
+	my $oldsubject;
+	my $change_id;
+
+	if ($raw_email =~ m/\nChange-Id:\s+([^\n]+)\n/) {
+		$change_id = $1;
+	}
+
+	if ($avoid_resend) {
+		$msgid = msgid_from_last_patch($change_id);
+		if ($msgid) {
+			if ($msgid_to_subject{$msgid}) {
+				$oldsubject = $msgid_to_subject{$msgid};
+
+				my $file = $msgid_to_file{$msgid};
+
+				my $old_md5 = qx(filterdiff $file | md5sum);
+				my $new_md5 = qx(filterdiff $f | md5sum);
+
+				$old_md5 =~ s/(\S+).*$/$1/;
+				$new_md5 =~ s/(\S+).*$/$1/;
+
+				if ($old_md5 eq $new_md5) {
+					printf "   Skipping patch as it is identical to previous version\n";
+					unlink $f;
+					next;
+				}
+			}
+			my $new_msgid = $email->header("Message-Id");
+			$changeids{$change_id} = $new_msgid if ($new_msgid);
+		}
+	}
+
+	# Patch was not avoided. Push to the list of patches to send
+	push @send_patches, $f;
+
+	my $cmd = "";
+	$cmd .= "--git" if ($git);
+	$cmd .="--nogit-fallback --nogit-blame --nogit" if ($nogit);
+	$cmd .=" $f";
+
+	my @file_cc = $email->header("Cc");
+	if ($to_maintainers) {
+		push @file_cc, $email->header("To") if ($email->header("To"));
+	}
+	my %cc_email_map = get_maintainer $cmd, \@file_cc;
+	my %maintainers;
+
+	@file_cc = ();
+	my @file_to = ();
+	foreach my $cc (sort keys %cc_email_map) {
+		my $ml_added = 0;
+		my $role = $cc_email_map{$cc};
+
+		my $type = "Cc";
+		$type = "To" if ($to_maintainers && $role =~ "maintainer");
+
+		if ($role =~ "maintainer") {
+			if (!$dont_get_maintainer) {
+				$ml_added = 1;
+				$cover_cc{$cc} = 1;
+			}
+		} elsif ($role =~ "reviewer") {
+			if (!$dont_get_reviewer) {
+				$ml_added = 1;
+				$cover_cc{$cc} = 1;
+			}
+		} elsif ($role =~ "list") {
+			$ml_added = 1;
+			$cover_cc{$cc} = 1;
+		} elsif ($add_everyone) {
+			$ml_added = 1;
+			$cover_cc{$cc} = 1;
+		}
+
+		if ($type eq "To") {
+			push @file_to, $cc;
+		} else {
+			push @file_cc, $cc;
+		}
+		if ($ml_added && $cover) {
+			printf "    $type + cover Cc: $cc (%s)\n", $role;
+		} else {
+			printf "    $type: $cc (%s)\n", $role;
+		}
+	}
+
+	$email->header_set("To", @file_to) if (@file_to);
+	$email->header_set("Cc", @file_cc) if (@file_cc);
+
+	# Remove Change-Id meta-data from the e-mail to be submitted
+	my $body = $email->body;
+	$body =~ s/(\nChange-Id:\s+[^\n]+\n)/\n/;
+	$email->body_set($body);
+
+	if ($avoid_resend) {
+		if (!$reply_patches && $msgid) {
+			$email->body_set("New version of $oldsubject\n\n$body");
+		} else {
+			die "New patches in the series. Can't proceed." if (!$msgid);
+			die "Failed to find old subject. Can't proceed." if (!$oldsubject);
+
+			$email->header_set("Subject", "Re: $oldsubject");
+		}
+		$email->header_set("In-Reply-To", $msgid);
+		$email->header_set("References", $msgid);
+	}
+
+	open OUT, ">$f";
+	print OUT $email->as_string;
+	close OUT;
+}
+
+# Sanity check
+die "Something wrong when generating/detecting a cover" if ($cover && !$has_cover);
+
+#
+# Add everyone at the cover's to: field
+#
+if ($has_cover) {
+	my $count_cc = 0;
+	foreach my $f(sort @patches) {
+		next if (!($f =~ m,0000-cover-letter.patch$,));
+
+		print "$f:\n";
+		my $raw_email = qx(cat $f);
+		die "Can't read $f" if (!$raw_email);
+
+		my $email = Email::Simple->new($raw_email);
+
+		my @file_cc = $email->header("Cc");
+
+		foreach my $e_mail (@file_cc) {
+			my @addresses = Email::Address->parse($e_mail);
+			for my $address (@addresses) {
+				$cover_cc{$address} = 1;
+			}
+		}
+
+		foreach my $to(sort keys %cover_cc) {
+			print "    Cc: $to\n";
+			push @file_cc, $to;
+			$count_cc++;
+		}
+
+		$email->header_set("Cc", @file_cc);
+
+		open OUT, ">$f";
+		print OUT $email->as_string;
+		close OUT;
+
+		print "Number of Cc at cover: $count_cc\n";
+	}
+}
+
+#
+# Renumber the patches
+#
+if ($avoid_resend && !$reply_patches) {
+	my $tot_patch = @send_patches;
+
+	$tot_patch-- if ($cover);
+
+	my $digits = int(log($tot_patch)/log(10)+0.99999);
+	my $patch = 1;
+
+	foreach my $f(@send_patches) {
+		next if ($f =~ m,0000-cover-letter.patch$,);
+
+		my $raw_email = qx(cat $f);
+		die "Can't read $f" if (!$raw_email);
+
+		my $email = Email::Simple->new($raw_email);
+
+		my $subject = $email->header("Subject");
+
+		my $number = sprintf("%0${digits}d/%0${digits}d", $patch, $tot_patch);
+
+		$subject =~ s/^\[[^\]]+\]\s*//;
+		$subject = "[$subject_prefix $number] " . $subject;
+		printf("$subject\n");
+		$email->header_set("Subject", $subject);
+
+		$patch++;
+
+		open OUT, ">$f";
+		print OUT $email->as_string;
+		close OUT;
+	}
+}
+
+#
+# Open an editor if needed
+#
+if ($edit || $cover) {
+	foreach my $f(sort @send_patches) {
+		my $new_text;
+
+		do {
+			$new_text = edit_text($f);
+		} while (!$new_text);
+
+		open OUT, ">$f";
+		print OUT $new_text;
+		close OUT;
+
+		last if ($cover);
+	}
+}
+
+#
+# Send the emails
+#
+
+if (!$dont_send) {
+	printf("\$ git send-email $tmp_dir\n");
+	system("git send-email $tmp_dir");
+} else {
+	printf("Use git send-email $tmp_dir to send the patches\n");
+}
+
+#
+# Update the change IDs with the new patches
+#
+foreach my $chgid (keys %changeids) {
+	$cgid_to_msgid{$chgid} = $changeids{$chgid};
+}
+
+open OUT,">$version_ctrl.new";
+foreach my $chgid (sort keys %cgid_to_msgid) {
+	printf OUT "%s\t%s\n", $chgid, $cgid_to_msgid{$chgid};
+}
+close OUT;
+
+if ($dont_send) {
+	printf("New version control stored as: .version_control.new\n" .
+	       "Don't forget rename it to .version_control for the next patch series after sending it.\n");
+} else {
+	rename $version_ctrl, "$version_ctrl.old";
+	rename "$version_ctrl.new", $version_ctrl;
+}
+
+
+__END__
+
+=head1 NAME
+
+send-patches.pl - Send patches upstream
+
+=head1 SYNOPSIS
+
+send-patches.pl [options] [changeset] -- [options for git format-patch]
+
+Options:
+
+--cover/--cover-letter
+--no-renames/--no-merges/--no-renames
+--merge/-M
+--delete/-D
+--unify/-U [level]
+--to [e@mail]
+--cc [e@mail]
+--prefix/--subject-prefix
+--edit
+--dont-send/--dry-run
+--avoid-resend
+--reply-patches
+--dont-get-maintainer
+--not-everyone/--dont-add-everyone
+--no-git-fallback
+--to-maintainers
+--help
+--man
+--reroll-count/-v [version number]
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<--cover> or B<--cover-letter>
+
+Patch series will have a cover letter. Automatically enables edition
+
+=item B<--no-renames> or B<--no-merges> or B<--no-merge>
+
+Disables git merge detection with git show --no-renames
+
+=item B<--merge> or B<--M>
+
+Enables aggressive git merge detection with git show -M01
+
+=item B<--delete> or B<--D>
+
+Omit the previous content on deletes, printing only the header but
+not the diff between the removed files and /dev/null.
+
+=item B<--unify> or B<--U>
+
+Set the unify diff level (default=3).
+
+=item B<--to>
+
+Add one more recipient destination for the e-mail
+(at the To: part of the email)
+
+=item B<--cc>
+
+Add one more recipient carbon copy destination for the e-mail
+(at the Cc: part of the email)
+
+=item B<--prefix> or B<--subject-prefix>
+
+By default, the subject prefix will be "PATCH". This otpion allows changing
+it.
+
+=item B<--edit>
+
+Allows editing each patch in the series, and the cover letter.
+
+=item B<--dont-send> or B<--dry-run>
+
+Do everything but calling git send-email. Useful to test the tool or
+when you need to do more complex things.
+
+=item B<--reply-patches>
+
+Instead of sending a new series, reply to an existing one. This only
+works if no new patches were added at the series.
+
+=item B<--avoid-resend>
+
+Don't resend patches that are identical to the previosly send
+series of patches. The patches that will be send will be renumbered.
+
+Please notice that this option is currently incompatible with
+a --cover, as we need to teach this script how to remove the
+removed patches from the letter summary.
+
+=item B<--dont-get-maintainer>
+
+Ignore maintainers at the cover letter.
+
+=item B<--dont-get-reviewer>
+
+Ignore reviewers at the cover letter.
+
+=item B<--everyone>/<--add-everyone>
+
+The script/get_maintainers.pl returns maintainers, reviewers and mailing lists.
+It also returns a list of usual contributors.
+
+By default, the usual contributors are ignored at the cover letter, being
+added only at the patches themselves. When this flag is used, they'll also
+be c/c to the cover letter.
+
+=item B<--git>
+
+Include recent git *-by: signers.
+
+=item B<--no-git-fallback>
+
+Use git when no exact MAINTAINERS pattern. This disables detection of the
+usual contributors.
+
+=item B<--to-maintainers>
+
+Instead of placing patches on a series, send them individually
+to their own maintainers.
+
+=item B<-v>/<--reroll-count>
+
+Change the version number on a patch series, by passing --reroll-count
+to git format-patch.
+
+=item B<--help>
+
+Print a brief help message and exits.
+
+=item B<--man>
+
+Prints the manual page and exits.
+
+=back
+
+=head1 DESCRIPTION
+B<This program> will submit a patch series upstream.
+=cut
+
+=head1 BUGS
+
+Report bugs to Mauro Carvalho Chehab <mchehab@kernel.org>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2015- by Mauro Carvalho Chehab <mcheha@kernel.org>.
+
+License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>.
+
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+=cut
-- 
2.30.2



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

* Better tools for sending patches (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches)
  2021-04-23  7:13               ` Mauro Carvalho Chehab
  2021-04-23  7:20                 ` [PATCH RFC] scripts: add a script for sending patches Mauro Carvalho Chehab
@ 2021-04-23 14:52                 ` Doug Anderson
  2021-04-23 16:03                   ` Mark Brown
  1 sibling, 1 reply; 11+ messages in thread
From: Doug Anderson @ 2021-04-23 14:52 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Joe Perches, Rob Herring, Steven Rostedt, Leon Romanovsky,
	James Bottomley, ksummit, tools, Simon Glass

Hi,

On Fri, Apr 23, 2021 at 12:13 AM Mauro Carvalho Chehab
<mchehab@kernel.org> wrote:
>
> Em Thu, 22 Apr 2021 23:46:31 -0700
> Joe Perches <joe@perches.com> escreveu:
>
> > On Fri, 2021-04-23 at 08:04 +0200, Mauro Carvalho Chehab wrote:
> > > I have a script to automate it, but I had to tweak it while handling
> > > patches that cross a single subsystem boundaries, using git send-email
> > > with the c/c list obtained from get_maintainers.pl.
> > >
> > > By default, the script adds all maintainers, reviewers and all mailing
> > > lists to the cover letter, but that sometimes generate a cover letter
> > > with 80+ c/c, which will be automatically rejected by anti-spam
> > > measures and by mail servers.
> > >
> > > So, I played with two different alternatives:
> > >
> > > 1. At the beginning, I changed the script to c/c only the mailing lists,
> > >    excluding maintainers/reviewers;
> > > 2. As the feedback was not great, I changed the script to c/c only
> > >    the maintainers, excluding mailing lists/reviewers. It seems that
> > >    this worked better.
> > >
> > > I didn't try to play with bcc, as replying to it would not send
> > > the replies to everyone.
> > >
> > > If you think it is worth, I could submit it to scripts/, but I
> > > suspect we may need to adjust it to work with all maintainers'
> > > workflows.
> >
> > I have a very similar script
> >
> > A portion of a cc script I use tests whether cc'ing the cover letter
> > to all listed maintainers of a patch series creates a header of less
> > than 512 chars and if so cc's all relevant maintainers, otherwise it
> > just cc's the mailing lists.
> >
> > (Ingo didn't/doesn't want to receive any emails from me)
> >
> > $ cat ~/bin/remove_undesirable_emails.sh
> > grep -vPi "(?:\bIngo\s+Molnar\b)"
> >
> > $ cat ~/bin/cc.sh
> > #!/bin/bash
> >
> > opts="--nogit --nogit-fallback --norolestats"
> > maint_file=$(mktemp -t XXXXXXXX.cc)
> >
> > if [[ $(basename $1) =~ ^0000- ]] ; then
> >     ./scripts/get_maintainer.pl $opts $(dirname $1)/* |  \
> >       ~/bin/remove_undesirable_emails.sh > $maint_file
> >     count=$(wc -c $maint_file | cut -f1 -d" ")
> >     if [[ $count -lt 512 ]] ; then
> >       cat $maint_file
> >     else
> >       ./scripts/get_maintainer.pl -nom -nor $opts $(dirname $1)/* | \
> >           ~/bin/remove_undesirable_emails.sh
> >     fi
> >
> > ...
> >
>
> Heh, mine is a lot more complex than that ;-)
>
> It internally runs git format-patch, git send-email and get_maintainers.pl,
> and, when --cover or --annotate is used, it opens a window to allow
> editing the text. It has several options in order to tweak its behavior.

FWIW, I suppose I'll take this opportunity to point out "patman",
which is the tool I use for this. It lives in U-Boot but I (and
several others) also use it for Linux development. See
<https://source.denx.de/u-boot/u-boot/-/blob/master/tools/patman/README>.
I seem to remember at one point Olof criticizing it as making it too
easy to send big patch series (apologies if I remembered this wrong
Olof), which I actually took as a big praise for the tool. ;-)

At the moment, patman does this for Linux:

1. By default calls "get_maintainer" to (separately) add CCs to each
patch in the series. There has been talk about this not being the
default for Linux and by default CCing everyone on all patches (or at
least making an option for it).

2. By default CCs everyone on the cover letter.

3. Neatly handles version history and includes version history both in
the cover letter and each patch.

4. ...and a whole load of other cool things.

I know it's nearly impossible to get people to change their workflows,
but if you're open to it I definitely suggest giving it a try. Simon
Glass (the original author) is also quite receptive to improvements.

-Doug

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

* Re: Better tools for sending patches (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches)
  2021-04-23 14:52                 ` Better tools for sending patches (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches) Doug Anderson
@ 2021-04-23 16:03                   ` Mark Brown
  2021-04-23 17:12                     ` Leon Romanovsky
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Brown @ 2021-04-23 16:03 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Mauro Carvalho Chehab, Joe Perches, Rob Herring, Steven Rostedt,
	Leon Romanovsky, James Bottomley, ksummit, tools, Simon Glass


[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

On Fri, Apr 23, 2021 at 07:52:30AM -0700, Doug Anderson wrote:

> I know it's nearly impossible to get people to change their workflows,
> but if you're open to it I definitely suggest giving it a try. Simon
> Glass (the original author) is also quite receptive to improvements.

I have something broadly similar (much more simplistic and overall less
capable) which I wrote myself - the things I have that this doesn't have
are:

 - Attesting the outgoing patches with b4.
 - Tagging the published series in git.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: Better tools for sending patches (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches)
  2021-04-23 16:03                   ` Mark Brown
@ 2021-04-23 17:12                     ` Leon Romanovsky
  2021-04-26 23:50                       ` Simon Glass
  0 siblings, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2021-04-23 17:12 UTC (permalink / raw)
  To: Mark Brown
  Cc: Doug Anderson, Mauro Carvalho Chehab, Joe Perches, Rob Herring,
	Steven Rostedt, James Bottomley, ksummit, tools, Simon Glass

On Fri, Apr 23, 2021 at 05:03:10PM +0100, Mark Brown wrote:
> On Fri, Apr 23, 2021 at 07:52:30AM -0700, Doug Anderson wrote:
> 
> > I know it's nearly impossible to get people to change their workflows,
> > but if you're open to it I definitely suggest giving it a try. Simon
> > Glass (the original author) is also quite receptive to improvements.
> 
> I have something broadly similar (much more simplistic and overall less
> capable) which I wrote myself - the things I have that this doesn't have
> are:
> 
>  - Attesting the outgoing patches with b4.
>  - Tagging the published series in git.

I have something similar too, which actually wrapper over git format-patch
that properly set target (net-next, rdma-next, iproute2, rdma-core, mlx5-next
e.t.c) and changes "To;" based on target.

Thanks

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

* Re: backfilling threads with b4 (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches)
  2021-04-22 18:05         ` backfilling threads with b4 (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches) Konstantin Ryabitsev
  2021-04-22 18:51           ` Leon Romanovsky
@ 2021-04-25 10:58           ` Leon Romanovsky
  1 sibling, 0 replies; 11+ messages in thread
From: Leon Romanovsky @ 2021-04-25 10:58 UTC (permalink / raw)
  To: tools

On Thu, Apr 22, 2021 at 02:05:40PM -0400, Konstantin Ryabitsev wrote:
> On Thu, Apr 22, 2021 at 08:56:45PM +0300, Leon Romanovsky wrote:
> > >     macro index 4 "<pipe-message>~/work/git/korg/b4/b4.sh mbox -f -o ~/Mail<return>"
> > > 
> > > You'll need to adjust it to point at where your maildir lives, of course, but
> > > that's the general idea. With it in place, you can hit "4" in the index view
> > > to get the rest of the thread (without duplicating the messages you already
> > > have).
> > 
> > Konstantin,
> > 
> > I tried the above and here the obstacles which I encounter.
> 
> This is probably better suited for tools@linux.kernel.org (cc'ing
> accordingly).
> 
> > 1. My emails are stored in Maildir. The mb2md script half-worked but ok
> > for the test.
> > 2. b4 didn't work if I tried to use lore link from the middle of discussion,
> > which is very common pattern to me.
> > 3. b4 didn't grab the discussions, so I got the patches, but didn't get and
> > won't get any interesting to me responses.
> 
> Are you sure you copied the command correctly? 
> 
> 1. It should automatically recognize when it's pointed at a maildir, so no
>    mb2md should be necessary. Are you sure you changed "-o ~/Mail" to be
>    pointing at your maildir?
> 2. It's supposed to grab the message-id from the piped message, so you
>    shouldn't need to pass any lore links.
> 3. Are you sure you're using "b4 mbox" not "b4 am"? The mbox command just
>    returns the entire thread.

Thanks Konstantin,

I tried the suggestion and it worked. The b4 downloaded whole thread
with all comments.

Thanks

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

* Re: Better tools for sending patches (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches)
  2021-04-23 17:12                     ` Leon Romanovsky
@ 2021-04-26 23:50                       ` Simon Glass
  0 siblings, 0 replies; 11+ messages in thread
From: Simon Glass @ 2021-04-26 23:50 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Mark Brown, Doug Anderson, Mauro Carvalho Chehab, Joe Perches,
	Rob Herring, Steven Rostedt, James Bottomley, ksummit, tools

Hi,

The docs are on github also :
https://github.com/siemens/u-boot/blob/master/tools/patman/README

I find it relatively easy to update each patch with a little change
log as I change it. Then I know that when I type 'patman send' it will
do the right thing.

If people have workflows that would benefit from patman's help, but
need it to do an extra thing, I certainly accept patches to the tool.

Regards,
Simon

On Sat, 24 Apr 2021 at 03:12, Leon Romanovsky <leon@kernel.org> wrote:
>
> On Fri, Apr 23, 2021 at 05:03:10PM +0100, Mark Brown wrote:
> > On Fri, Apr 23, 2021 at 07:52:30AM -0700, Doug Anderson wrote:
> >
> > > I know it's nearly impossible to get people to change their workflows,
> > > but if you're open to it I definitely suggest giving it a try. Simon
> > > Glass (the original author) is also quite receptive to improvements.
> >
> > I have something broadly similar (much more simplistic and overall less
> > capable) which I wrote myself - the things I have that this doesn't have
> > are:
> >
> >  - Attesting the outgoing patches with b4.
> >  - Tagging the published series in git.
>
> I have something similar too, which actually wrapper over git format-patch
> that properly set target (net-next, rdma-next, iproute2, rdma-core, mlx5-next
> e.t.c) and changes "To;" based on target.
>
> Thanks

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

end of thread, back to index

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <afc5664dc2b60f912dd97abfa818b3f7c4237b92.camel@HansenPartnership.com>
     [not found] ` <YID5xhy2vv45fnOv@unreal>
     [not found]   ` <20210422112001.22c64fe9@coco.lan>
     [not found]     ` <20210422125357.uuxprp6rqxewcdsr@nitro.local>
     [not found]       ` <YIG43TuqmxU24evq@unreal>
2021-04-22 18:05         ` backfilling threads with b4 (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches) Konstantin Ryabitsev
2021-04-22 18:51           ` Leon Romanovsky
2021-04-25 10:58           ` Leon Romanovsky
     [not found]     ` <YIFfXTVMDmHwVmSR@unreal>
     [not found]       ` <20210422092916.556e5e50@gandalf.local.home>
     [not found]         ` <CAL_JsqKS-=shqkLhzKeLHqNPhosGJw5X-fOi+dy1rT3Q_LfBZg@mail.gmail.com>
2021-04-23  6:04           ` [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches Mauro Carvalho Chehab
2021-04-23  6:46             ` Joe Perches
2021-04-23  7:13               ` Mauro Carvalho Chehab
2021-04-23  7:20                 ` [PATCH RFC] scripts: add a script for sending patches Mauro Carvalho Chehab
2021-04-23 14:52                 ` Better tools for sending patches (was: Re: [MAINTAINER SUMMIT] Rethinking the acceptance policy for "trivial" patches) Doug Anderson
2021-04-23 16:03                   ` Mark Brown
2021-04-23 17:12                     ` Leon Romanovsky
2021-04-26 23:50                       ` Simon Glass

Linux maintainer tooling and workflows

Archives are clonable:
	git clone --mirror https://lore.kernel.org/tools/0 tools/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 tools tools/ https://lore.kernel.org/tools \
		tools@linux.kernel.org
	public-inbox-index tools

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.linux.tools


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git