All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] patman: add support for omitting bouncing addresses
Date: Mon, 28 Aug 2017 20:37:19 +0200 (CEST)	[thread overview]
Message-ID: <alpine.OSX.2.21.1708282025520.2764@vpn-10-11-0-14.lan> (raw)
In-Reply-To: <20170828093026.20610-1-judge.packham@gmail.com>



On Mon, 28 Aug 2017, Chris Packham wrote:

> Add a --bounce-file option which can be used to omit addresses that are
> known to bounce. The option specifies a file which lists addresses (one
> per line) that are stripped from the Cc list.

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Absolutely love this (in fact, I had something like this on my to-do list 
as the number of bounces seemed to grow over time).

A few comments below.

>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
> Here's a quick proof of concept. Right now the .bounces file has to
> match exactly the addresses that are extracted by patman. This makes it
> easy to do set(a) - set(b) to remove all the bounces in one hit.
>
> tools/patman/patman.py | 6 +++++-
> tools/patman/series.py | 5 ++++-
> tools/patman/tools.py  | 8 ++++++++
> 3 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/tools/patman/patman.py b/tools/patman/patman.py
> index 4b3bc787453e..567226a4d3ce 100755
> --- a/tools/patman/patman.py
> +++ b/tools/patman/patman.py
> @@ -56,6 +56,9 @@ parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
>        default=False, help='Verbose output of errors and warnings')
> parser.add_option('--cc-cmd', dest='cc_cmd', type='string', action='store',
>        default=None, help='Output cc list for patch file (used by git)')
> +parser.add_option('--bounce-file', dest='bounce_fname', type='string',
> +                  default='.bounces',

The '.bounces' default doesn't really fit with how such settings are 
handled throughout patman.

My gut feeling is that
  (a) we want to have a project-wide bounces config (doc/git-bounces ???)
      that complements doc/git-mailrc
  (b) that any overrides/user-local additional settings should be picked up
      via ~/.patman (either by referencing a local overrides file or by
      having some additional overrides directly there)
  (c) this entire mechanism needs to be tied into Setup(...) in settings.py

> +                  help='File containing addresses to skip [default: %default]')
> parser.add_option('--no-check', action='store_false', dest='check_patch',
>                   default=True,
>                   help="Don't check for patch compliance")
> @@ -158,7 +161,8 @@ else:
>
>     cc_file = series.MakeCcFile(options.process_tags, cover_fname,
>                                 not options.ignore_bad_tags,
> -                                options.add_maintainers)
> +                                options.add_maintainers,
> +                                options.bounce_fname)
>
>     # Email the patches out (giving the user time to check / cancel)
>     cmd = ''
> diff --git a/tools/patman/series.py b/tools/patman/series.py
> index d3947a7c2ac5..b6533ab5ee58 100644
> --- a/tools/patman/series.py
> +++ b/tools/patman/series.py
> @@ -11,6 +11,7 @@ import os
> import get_maintainer
> import gitutil
> import terminal
> +from tools import FindBounces
>
> # Series-xxx tags that we understand
> valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
> @@ -202,7 +203,7 @@ class Series(dict):
>             print(col.Color(col.RED, str))
>
>     def MakeCcFile(self, process_tags, cover_fname, raise_on_error,
> -                   add_maintainers):
> +                   add_maintainers, bounce_fname):
>         """Make a cc file for us to use for per-commit Cc automation
>
>         Also stores in self._generated_cc to make ShowActions() faster.
> @@ -222,6 +223,7 @@ class Series(dict):
>         fname = '/tmp/patman.%d' % os.getpid()
>         fd = open(fname, 'w')
>         all_ccs = []
> +        bounces = FindBounces(bounce_fname)
>         for commit in self.commits:
>             cc = []
>             if process_tags:
> @@ -234,6 +236,7 @@ class Series(dict):
>             elif add_maintainers:
>                 cc += get_maintainer.GetMaintainer(commit.patch)
>             cc = [m.encode('utf-8') if type(m) != str else m for m in cc]
> +            cc = set(cc) - set(bounces)
>             all_ccs += cc
>             print(commit.patch, ', '.join(set(cc)), file=fd)
>             self._generated_cc[commit.patch] = cc
> diff --git a/tools/patman/tools.py b/tools/patman/tools.py
> index ba2485303037..9d206a390b02 100644
> --- a/tools/patman/tools.py
> +++ b/tools/patman/tools.py
> @@ -118,3 +118,11 @@ def Align(pos, align):
>
> def NotPowerOfTwo(num):
>     return num and (num & (num - 1))
> +
> +def FindBounces(bounce_fname):
> +    """generate a list of bouncing addresses from a file"""
> +    try:
> +        with open(bounce_fname) as fd:
> +            return [line.strip() for line in fd]
> +    except IOError:
> +        return []
>

Shouldn't this be merged into gitutil.BuildEmailList or into 
gitutil.LookupEmail? It would also be nice if the bounces would be 
handled in analogy to aliases and referenced via settings.alias

Regards,
Philipp.

  reply	other threads:[~2017-08-28 18:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAFOYHZCo83Eos+JK28q0dLoOBfMBSP8N_=iSOoEcXa3dSVmjrw@mail.gmail.com>
     [not found] ` <CAFOYHZDT5yae+EiZjpmLUkP-7C6VCxcEdxHAY9bBFps_3MJqDg@mail.gmail.com>
     [not found]   ` <CAFOYHZCFozH2ZQ5kv=b4t+YMbyDXdYT0wK5-JVzpruLUNtwGzQ@mail.gmail.com>
     [not found]     ` <CAFOYHZCpg_z67mZ0DELRm3X4EdU6q+wFo8V1e+wP5Ojb5jw6Yw@mail.gmail.com>
     [not found]       ` <CAFOYHZBOY0pBsUZA=bptzn2NenqmRP9z4tOA361MjUbMdqtgBA@mail.gmail.com>
     [not found]         ` <CAFOYHZCmF1oTEdF+5wv32hLHkpjJXSktLG7ucwVDxoN1EdRNOA@mail.gmail.com>
     [not found]           ` <CAFOYHZBjgrHvOT4A6+LnOnBY9o8j81G0agmqWsWmx9AxyUG=_Q@mail.gmail.com>
     [not found]             ` <CAFOYHZA0VJfC8rh4ducAitEw9pV86CvzMLm8_Y0zMUuAHv1E+Q@mail.gmail.com>
     [not found]               ` <CAFOYHZASXyOd=R4OJLWoq8szgPQm8iqobDnk96yswc7ZUWPHtQ@mail.gmail.com>
     [not found]                 ` <CAFOYHZCdTMkkWvLASBtMMBqVV-Y21RYqR8OPgAze1dfLyuqFpw@mail.gmail.com>
     [not found]                   ` <CAFOYHZCi5Z=kAORUr8+wRJZZ-=KiT_Ci1RBP6T2m95xUSXG3Rg@mail.gmail.com>
     [not found]                     ` <CAFOYHZA8FcR3qQz=+mB6uVzVSgjxoZKc4sg2SBPjnAupsEdBLQ@mail.gmail.com>
     [not found]                       ` <CAFOYHZCVJ8b3yH9p0a6bahLGCjaxVAiRab+J+qSqfT3Mvv7ETQ@mail.gmail.com>
     [not found]                         ` <CAFOYHZD2PU8xsFZJtPYj2w6bTB3svuYAkFdkVXe0vmbjgkfjVQ@mail.gmail.com>
     [not found]                           ` <CAFOYHZDYx_XYe3E69xx1rB8U0u3g9QeeMqQo9JRooD12gx+wHQ@mail.gmail.com>
     [not found]                             ` <CAFOYHZAY830Qgb9Laz7Z3RK+Qp3ssyd5qmMBDqhdV08wWraDqA@mail.gmail.com>
     [not found]                               ` <CAFOYHZCNy2gVJVc-omK+N0wz7uRCbOWKXOpKK9gdHNwZ1AHT5Q@mail.gmail.com>
     [not found]                                 ` <CAFOYHZB5C8PpaO_F+h-WXQ9o2T21m2ESeLoz6bfSrm1z+R=_JA@mail.gmail.com>
     [not found]                                   ` <CAFOYHZBPHnJtFqUXBFYUS1pj=pHfMhwYn-H5c79yq05oQecEtw@mail.gmail.com>
     [not found]                                     ` <CAFOYHZCXvPjSV2gii+f=cFAJcnorTjdCt5sgrLWt2gHxfUy3tA@mail.gmail.com>
     [not found]                                       ` <CAFOYHZBzF4vq2Jeu=+UcOx34VX6O=GQXPGhFS3i-XERTffmF=Q@mail.gmail.com>
     [not found]                                         ` <CAFOYHZDrccrsU4ru2BYz3UXf5nPWoGwRgMWwoCn=xjxjSBzqqA@mail.gmail.com>
     [not found]                                           ` <CAFOYHZCJS7hSiBVcsOYsq2=c3sy8uNmfUay2bJA0CqZWBO+87A@mail.gmail.com>
     [not found]                                             ` <CAFOYHZChx0LKPr-B-r-txW=YR8WbS4vbiiekPTQk8obL4i6gqQ@mail.gmail.com>
     [not found]                                               ` <CAFOYHZDP1mWuc8U=w3pdLC6-hvupRQEE1s4P2HWgjk7DwxjG4Q@mail.gmail.com>
     [not found]                                                 ` <CAFOYHZCs5zGw2mgRDH+b+W5dE-y2KR03zBMCvBs8hYBrmLOyGg@mail.gmail.com>
     [not found]                                                   ` <CAFOYHZCnK7EHasRjJ0hkAPW9rSjuGmzY19P63BTVF+=fENwrjg@mail.gmail.com>
     [not found]                                                     ` <CAFOYHZCLbAMxAp4UMSa_n80hHqjmrcq5RciWr+jp-tvnQx2n1g@mail.gmail.com>
     [not found]                                                       ` <CAFOYHZAOBBBKW=fXHi3L7U31E9G7zaSdEgyV5=roCUARXfJMDg@mail.gmail.com>
     [not found]                                                         ` <CAFOYHZANgi7HLBNTforaw4JBRu0xOdH-YNH9Tm7SQMRpf2J6fg@mail.gmail.com>
     [not found]                                                           ` <CAFOYHZDu-xQfMpQLjSHAYGgqGKyxcGQFVzw7Uw9EPPBUx8=SKQ@mail.gmail.com>
     [not found]                                                             ` <CAFOYHZAb64CgCGULOmFsuHp=kUX4SJL-fTRt7u4sSKWC3z0x=g@mail.gmail.com>
     [not found]                                                               ` <CAFOYHZD-Ahry06KBCeOgLKSqc3dWTvevscnEwU-Dr+yE+fvaJg@mail.gmail.com>
     [not found]                                                                 ` <CAFOYHZDeF404-=OAn9xWsFiDt_HFQb2WE=3tVfVdR-0csZ-f9g@mail.gmail.com>
     [not found]                                                                   ` <CAFOYHZC2f3rkQYzTEobn5fgvP=U6_x-8u2iW54ZW8rZwXVnGWw@mail.gmail.com>
     [not found]                                                                     ` <CAFOYHZBtyZho_fGMehz8cixBFjrZZpZfmbY9a-AB9x5MgOa+3Q@mail.gmail.com>
     [not found]                                                                       ` <CAFOYHZBQWz7D2BXTzB_aLsLCMn2VGUBs-Yn4_kQDjYUeDHpZvQ@mail.gmail.com>
     [not found]                                                                         ` <CAFOYHZA6tWkJi5b2-+2285SJbPDd-KyXJyxqmVEV4HoNtxrm=Q@mail.gmail.com>
     [not found]                                                                           ` <CAFOYHZDrERFyWp2_-gW9tEgxdqQFW14Yi1G35fDgGTb=OK6uDA@mail.gmail.com>
     [not found]                                                                             ` <CAFOYHZCWH+wsEV6j70dx_eO4vQmrCW+v=8NyFDwQcCyCnFB__A@mail.gmail.com>
     [not found]                                                                               ` <CAFOYHZCrV=UdWCXOZ8=QCTMOf+KfJuU+qkeR_Rn2rN2pB=_aYg@mail.gmail.com>
     [not found]                                                                                 ` <CAFOYHZAE6=SJwXE5zCP-hN4eLrrEttXReK2QOx+4ps2iYTOKkg@mail.gmail.com>
     [not found]                                                                                   ` <CAFOYHZB36ztvHUhaJrD9Dbd2p0Drw44ad04FYtoqrYZoTm3omQ@mail.gmail.com>
     [not found]                                                                                     ` <CAFOYHZDg+e3TLwurDTQJEYbHrdEs2v97wc9gBgpVog3wpy7BLQ@mail.gmail.com>
     [not found]                                                                                       ` <CAFOYHZCf8ybCcNvZtJsnC2Ut57k8mS037kS4h_UMfNGhxAgHnA@mail.gmail.com>
     [not found]                                                                                         ` <CAFOYHZDXFTGSFM9_GMn8GWwUcbhoHn0FHgDDjmAwgDQnf63ObA@mail.gmail.com>
2017-08-26 23:59                                                                                           ` [U-Boot] Patman avoiding bounces Chris Packham
2017-08-27  0:17                                                                                             ` Bin Meng
2017-08-27 20:10                                                                                               ` Simon Glass
2017-08-28  9:30                                                                                                 ` [U-Boot] [PATCH] patman: add support for omitting bouncing addresses Chris Packham
2017-08-28 18:37                                                                                                   ` Philipp Tomsich [this message]
2017-08-29  7:51                                                                                                     ` [U-Boot] " Chris Packham

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=alpine.OSX.2.21.1708282025520.2764@vpn-10-11-0-14.lan \
    --to=philipp.tomsich@theobroma-systems.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.