[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-4.11 v3 1/1] Add new add_maintainers.pl script to optimise the workflow when using git format-patch with get_maintainer.pl


  • To: Lars Kurth <lars.kurth@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: George Dunlap <george.dunlap@xxxxxxxxxx>
  • Date: Thu, 10 May 2018 14:02:57 +0100
  • Autocrypt: addr=george.dunlap@xxxxxxxxxx; prefer-encrypt=mutual; keydata= xsFNBFPqG+MBEACwPYTQpHepyshcufo0dVmqxDo917iWPslB8lauFxVf4WZtGvQSsKStHJSj 92Qkxp4CH2DwudI8qpVbnWCXsZxodDWac9c3PordLwz5/XL41LevEoM3NWRm5TNgJ3ckPA+J K5OfSK04QtmwSHFP3G/SXDJpGs+oDJgASta2AOl9vPV+t3xG6xyfa2NMGn9wmEvvVMD44Z7R W3RhZPn/NEZ5gaJhIUMgTChGwwWDOX0YPY19vcy5fT4bTIxvoZsLOkLSGoZb/jHIzkAAznug Q7PPeZJ1kXpbW9EHHaUHiCD9C87dMyty0N3TmWfp0VvBCaw32yFtM9jUgB7UVneoZUMUKeHA fgIXhJ7I7JFmw3J0PjGLxCLHf2Q5JOD8jeEXpdxugqF7B/fWYYmyIgwKutiGZeoPhl9c/7RE Bf6f9Qv4AtQoJwtLw6+5pDXsTD5q/GwhPjt7ohF7aQZTMMHhZuS52/izKhDzIufl6uiqUBge 0lqG+/ViLKwCkxHDREuSUTtfjRc9/AoAt2V2HOfgKORSCjFC1eI0+8UMxlfdq2z1AAchinU0 eSkRpX2An3CPEjgGFmu2Je4a/R/Kd6nGU8AFaE8ta0oq5BSFDRYdcKchw4TSxetkG6iUtqOO ZFS7VAdF00eqFJNQpi6IUQryhnrOByw+zSobqlOPUO7XC5fjnwARAQABzSRHZW9yZ2UgVy4g RHVubGFwIDxkdW5sYXBnQHVtaWNoLmVkdT7CwYAEEwEKACoCGwMFCwkIBwMFFQoJCAsFF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dmrDcX6w2q5lqoFz+8npK2I ehKCA94U+J/RLywUiaLuHnXt40WvQ98kHm7uTsy36iWqqawPqzmn8m5ruynVHmmcXsLBZQQY AQoADwIbDAUCWmTXMwUJB+tP9gAKCRCmNjwxBZC0bb+2D/9hjn1k5WcRHlu19WGuH6q0Kgm1 LRT7PnnSz904igHNElMB5a7wRjw5kdNwU3sRm2nnmHeOJH8kYj2Hn1QgX5SqQsysWTHWOEse GeoXydx9zZZkt3oQJM+9NV1VjK0bOXwqhiQyEUWz5/9l467FS/k4FJ5CHNRumvhLa0l2HEEu 5pxq463HQZHDt4YE/9Y74eXOnYCB4nrYxQD/GSXEZvWryEWreDoaFqzq1TKtzHhFgQG7yFUE epxLRUUtYsEpT6Rks2l4LCqG3hVD0URFIiTyuxJx3VC2Ta4LH3hxQtiaIpuXqq2D4z63h6vC x2wxfZc/WRHGbr4NAlB81l35Q/UHyMocVuYLj0llF0rwU4AjiKZ5qWNSEdvEpL43fTvZYxQh DCjQTKbb38omu5P4kOf1HT7s+kmQKRtiLBlqHzK17D4K/180ADw7a3gnmr5RumcZP3NGSSZA 6jP5vNqQpNu4gqrPFWNQKQcW8HBiYFgq6SoLQQWbRxJDHvTRYJ2ms7oCe870gh4D1wFFqTLe yXiVqjddENGNaP8ZlCDw6EU82N8Bn5LXKjR1GWo2UK3CjrkHpTt3YYZvrhS2MO2EYEcWjyu6 LALF/lS6z6LKeQZ+t9AdQUcILlrx9IxqXv6GvAoBLJY1jjGBq+/kRPrWXpoaQn7FXWGfMqU+ NkY9enyrlw==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wei.liu2@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, Julien Grall <julien.grall@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Thu, 10 May 2018 13:03:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Openpgp: preference=signencrypt

On 05/10/2018 12:38 PM, George Dunlap wrote:
> On 05/04/2018 09:36 AM, Lars Kurth wrote:
>> The tool covers step 2 of the following workflow
>>
>>   Step 1: git format-patch ... -o <patchdir> ...
>>   Step 2: ./scripts/add_maintainers.pl -d <patchdir>
>>           This overwrites  *.patch files in <patchdir>
>>   Step 3: git send-email -to xen-devel@xxxxxxxxxxxxxxxxxxxx 
>> <patchdir>/*.patchxm
>>
>> I manually tested all options and the most common combinations
>> on Mac.
>>
>> Changes since v1:
>> - Added RAB (indicated by Juergen on IRC that this is OK)
>> - Remove trailing whitespaces
>> - Renamed --prefix to --reroll-count
>> - Cleaned up short options -v, ... to be in line with git
>> - Added --tags|-t option to add AB, RAB and RB emails to CC list
>> - Added --insert|-i mode to allow for people adding CCs to commit message
>>   instead of the e-mail header (the header is the default)
>> - Moved common code into functions
>> - Added logic, such that the tool only insert's To: and Cc: statements
>>   which were not there before, allowing for running the tool multiple times
>>   on the same <patchdir>
>>
>> Changes since v2:
>> - Deleted --version and related infrastructure
>> - Added subroutine prototypes
>> - Removed AT and @lists declaration and used \@ in literals
>> - Changed usage message and options based on feedback
>> - Improved error handling
>> - Removed occurances of index() and replaced with regex
>> - Removed non-perl idioms
>> - Moved uniq statements to normalize and added info on what normalize does
>> - Read L: tags from MAINTAINERS file instead of using heuristic
>> - Fixed issues related to metacharacters in getmaintainers()
>> - Allow multiple -a | --arg values (because of this renamed --args)
>> - Identify tags via regex
>> - CC's from tags are only inserted in the mail header, never the body
>> - That is unless the new option --tagscc is used
>> - Added policy processing which includes reworking insert()
>> - Replaced -i|--insert with -p|--inspatch and -c|--inscover now using 
>> policies
>> - Added new policies to cover for all user requests
>> - Rewrote help message to center around usage of policies
>> - Reordered some code (e.g. help string first to make code more easily 
>> readable)
>>
>> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>> Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
>> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
>> Cc: Jan Beulich <jbeulich@xxxxxxxx>
>> Cc: Julien Grall <julien.grall@xxxxxxx>
>> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
>> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
>> Cc: Tim Deegan <tim@xxxxxxx>
>> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
>> Signed-off-by: Lars Kurth <lars.kurth@xxxxxxxxxx>
>> Release-acked-by: Juergen Gross <jgross@xxxxxxxx>
>> ---
>>  scripts/add_maintainers.pl | 512 
>> +++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 512 insertions(+)
>>  create mode 100755 scripts/add_maintainers.pl
>>
>> diff --git a/scripts/add_maintainers.pl b/scripts/add_maintainers.pl
>> new file mode 100755
>> index 0000000000..11ae60d888
>> --- /dev/null
>> +++ b/scripts/add_maintainers.pl
>> @@ -0,0 +1,512 @@
>> +#!/usr/bin/perl -w
>> +# (c) 2018, Lars Kurth <lars.kurth@xxxxxxxxxx>
>> +#
>> +# Add maintainers to patches generated with git format-patch
>> +#
>> +# Usage: perl scripts/add_maintainers.pl [OPTIONS] -patchdir <patchdir>
>> +#
>> +# Prerequisites: Execute
>> +#                git format-patch ... -o <patchdir> ...
>> +#
>> +#                ./scripts/get_maintainer.pl is present in the tree
>> +#
>> +# Licensed under the terms of the GNU GPL License version 2
>> +
>> +use strict;
>> +
>> +use Getopt::Long qw(:config no_auto_abbrev);
>> +use File::Basename;
>> +use List::MoreUtils qw(uniq);
>> +
>> +sub getmaintainers ($$$);
>> +sub gettagsfrompatch ($$$;$);
>> +sub normalize ($$);
>> +sub insert ($$$$);
>> +sub hastag ($$);
>> +
>> +# Tool Variables
>> +my $tool = $0;
>> +my $usage = <<EOT;
>> +USAGE: $tool [options] (--patchdir | -d) <patchdir>
>> +
>> +OPTIONS:
>> +--------
>> +  --reroll-count <n> | -v <n>
>> +    Choose patch files for specific version. This results into the
>> +    following filters on <patchdir>
>> +    0: default - *.patch
>> +    >1: v<n>*.patch
>> +  --inspatch (top|ccbody|cc---|none) | -p (top|ccbody|cc---|none)
>> +    Insert email addresses into *.patch files according to the POLICY
>> +    See section POLICY:
>> +  --inscover (top|ccend|none) | -c (top|ccend|none)
>> +    Insert email addresses into cover letteraccording to the POLICY
>> +    See section PROCESSING POLICY:
>> +  --tags | -t
>> +    Read email addresses from tags and add to CC list.
>> +    Note that git send-email does not do this. It will add the senders
>> +    email adress to the CC list though
>> +  --tagscc
>> +    Same as tags, only that in this case CCs extracted from tags
>> +    are treated like CCs that have come from the *.patch file
> 
> Not clear on the difference between these.
> 
>> +  --arg <argument> | -a <argument> ...
>> +    Arguments passed on to get_maintainer.pl
>> +    This option can be used multiple times, e.g. -a <a1> -a <a2> ...
>> +  --verbose
>> +    Show more output
>> +  --help | -h
>> +    Show this help information
>> +
>> +PROCESSING POLICY:
> 
> Why is this called 'policy'?  This seems to be definitions.
> 
>> +------------------
>> +  *.patch files consist of several sections relevant to processing:
>> +  <top>:   This is the email header containing email related information
>> +           It ends with the Subject: line
>> +  <body>:  This is the body that ends up in the commit message
>> +           It ends with ---
>> +  <--->:   This section contains the actual patches. CCs added here are
>> +           processed by git send-email, but are not stored in the commit
>> +           message. Some people add CCs into this section
> 
> <---> is not a normal name (how do you say it? "dash-dash-dash"?), and
> worse yet might be confused with an option.  `--inspatch cc---` looks
> like there was some sort of mistake.  "Top" would normally mean, "Top of
> the body of the mail".
> 
> I think it would be better to call these sections <header>, <commit> and
> "commit message", and <comment> and "reviewer comment section",
> respectively.
> 
> 
>> +  <ccend>: It ends with '-- '
>> +
>> +  Note that cover letters do not have the <body> section.
>> +
>> +  The following options specifiy how CCs are insertied into *.patch files
>> +  top:    Insert CCs into the email header
>> +          Insert CCs from *-by: tags and TOs from mailing lists into the 
>> header
>> +          (this is the default)
>> +  ccbody: Insert CCs into body
>> +          Insert CCs from *-by: tags and TOs from mailing lists into the 
>> header
>> +          unless specified otherwise (via --tagscc).
>> +  cc---:  Insert CCs just after the --- line
>> +          Insert CCs from *-by: tags and TOs from mailing lists into the 
>> header
>> +          unless specified otherwise (via --tagscc).
>> +  ccend:  Insert CCs before the '-- ' line
>> +          Insert CCs from *-by: tags and TOs from mailing lists into the 
>> header
>> +          unless specified otherwise (via --tagscc).
>> +  none:   Neither insert TO, CCs from --tags nor other CCs
> 
> I don't really get this section.
> 
> What about having the functionality be something like this?  (Obvious
> this would need some code changes as well.  Also I guessed what the
> significance of the `-- ` is in the cover letter, so correct me if I'm
> wrong.)
> 
> ---
> USAGE: $tool [options] (--patchdir | -d) <patchdir>
> 
> OPTIONS:
> --------
> 
>   --reroll-count <n> | -v <n>
>     Choose patch files for specific version. This results into the
>     following filters on <patchdir>
>     0: default - *.patch
>     >1: v<n>*.patch
> 
>   --patchcc (top|commit|comment|none) | -p (top|commit|comment|none)
> 
>     Insert CC lines into *.patch files in the specified location.
>     See LOCATIONS for a definition of the various locations.
> 
>     The default is `top`.
> 
>   --covercc (top|end|none) | -c (top|end|none)
> 
>     Insert CC lines into cover letter in the specified location. See
>     LOCATIONS for a definition of the various locations.
> 
>     The default is `top`.
> 
>   --tags | -t
> 
>     In addition to the output of get_maintainer.pl, include email
>     addresses from commit tags (e.g., Reviewed-by, Tested-by, &c) in
>     the list of CC lines to insert.

OK, having talked to you IRL I now understand what these are about.  How
about this:

---
  --tags | -t

    In addition to the output of get_maintainer.pl, include email
    addresses from commit tags (e.g., Reviewed-by, Tested-by, &c) in
    the list of CC lines to insert.

    For patches, these extra lines will be inserted as specified by
    the --patchcc option, *unless* that option is set to `commit`.  In
    that case, rather than duplicate tags in the commit message with
    CC lines, the extra CC lines will be added to he header instead.

  --tagscc

    As above, but `commit` location is not special-cased: In the case
    of `commit`, all CCs will be added to the bottom of the commit
    message, even if they duplicate other tags in the commit message.
---

Or, perhaps even better:

---
  --tags[=(split|combined)] | -t

    In addition to the output of get_maintainer.pl, collect email
    addresses from commit tags (e.g., Reviewed-by, Tested-by, &c) in
    the list of CC lines to insert.

    If 'split' is specified, these tag CC lines will be added to the
    header, rather than in the location specified by --patchcc.  In
    the case that `commit` is specified, this will avoid duplicating
    tags and CC lines in the commit message.  This is the default when
    `--patchcc commit` is specified.

    If 'combined' is specified, these tag CC lines will be added along
    with the maintainer CC's, wherever specified by --patchcc.  This
    is the default when "header" or "comment" are specified.
---

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.