2023-09-26 23:05:51

by Pavan Kondeti

[permalink] [raw]
Subject: Re: [PATCH v3 1/1] scripts: Add add-maintainer.py

On Sat, Aug 26, 2023 at 01:07:42AM -0700, Guru Das Srinagesh wrote:
> +def gather_maintainers_of_file(patch_file):
> + all_entities_of_patch = dict()
> +
> + # Run get_maintainer.pl on patch file
> + logging.info("GET: Patch: {}".format(os.path.basename(patch_file)))
> + cmd = ['scripts/get_maintainer.pl']
> + cmd.extend([patch_file])
> +
> + try:
> + p = subprocess.run(cmd, stdout=subprocess.PIPE, check=True)
> + except:
> + sys.exit(1)
> +
> + logging.debug("\n{}".format(p.stdout.decode()))
> +
> + entries = p.stdout.decode().splitlines()
> +
> + maintainers = []
> + lists = []
> + others = []
> +
> + for entry in entries:
> + entity = entry.split('(')[0].strip()
> + if any(role in entry for role in ["maintainer", "reviewer"]):
> + maintainers.append(entity)
> + elif "list" in entry:
> + lists.append(entity)
> + else:
> + others.append(entity)
> +
> + all_entities_of_patch["maintainers"] = set(maintainers)
> + all_entities_of_patch["lists"] = set(lists)
> + all_entities_of_patch["others"] = set(others)
> +
> + return all_entities_of_patch
> +

FYI, there are couple of issues found while playing around.

- Some entries in MAINTAINERS could be "supporter"
- When names contain ("company"), the script fails to extract name.

Thanks,
Pavan

diff --git a/scripts/add-maintainer.py b/scripts/add-maintainer.py
index 5a5cc9482b06..6aa5e7941172 100755
--- a/scripts/add-maintainer.py
+++ b/scripts/add-maintainer.py
@@ -29,8 +29,8 @@ def gather_maintainers_of_file(patch_file):
others = []

for entry in entries:
- entity = entry.split('(')[0].strip()
- if any(role in entry for role in ["maintainer", "reviewer"]):
+ entity = entry.rsplit('(', 1)[0].strip()
+ if any(role in entry for role in ["maintainer", "reviewer", "supporter"]):
maintainers.append(entity)
elif "list" in entry:
lists.append(entity)


Thanks,
Pavan


2023-09-27 11:07:48

by Pavan Kondeti

[permalink] [raw]
Subject: Re: [PATCH v3 1/1] scripts: Add add-maintainer.py

On Tue, Sep 26, 2023 at 05:32:10PM +0530, Pavan Kondeti wrote:
> On Sat, Aug 26, 2023 at 01:07:42AM -0700, Guru Das Srinagesh wrote:
> > +def gather_maintainers_of_file(patch_file):
> > + all_entities_of_patch = dict()
> > +
> > + # Run get_maintainer.pl on patch file
> > + logging.info("GET: Patch: {}".format(os.path.basename(patch_file)))
> > + cmd = ['scripts/get_maintainer.pl']
> > + cmd.extend([patch_file])
> > +
> > + try:
> > + p = subprocess.run(cmd, stdout=subprocess.PIPE, check=True)
> > + except:
> > + sys.exit(1)
> > +
> > + logging.debug("\n{}".format(p.stdout.decode()))
> > +
> > + entries = p.stdout.decode().splitlines()
> > +
> > + maintainers = []
> > + lists = []
> > + others = []
> > +
> > + for entry in entries:
> > + entity = entry.split('(')[0].strip()
> > + if any(role in entry for role in ["maintainer", "reviewer"]):
> > + maintainers.append(entity)
> > + elif "list" in entry:
> > + lists.append(entity)
> > + else:
> > + others.append(entity)
> > +
> > + all_entities_of_patch["maintainers"] = set(maintainers)
> > + all_entities_of_patch["lists"] = set(lists)
> > + all_entities_of_patch["others"] = set(others)
> > +
> > + return all_entities_of_patch
> > +
>
> FYI, there are couple of issues found while playing around.
>
> - Some entries in MAINTAINERS could be "supporter"
> - When names contain ("company"), the script fails to extract name.
>
> Thanks,
> Pavan
>
> diff --git a/scripts/add-maintainer.py b/scripts/add-maintainer.py
> index 5a5cc9482b06..6aa5e7941172 100755
> --- a/scripts/add-maintainer.py
> +++ b/scripts/add-maintainer.py
> @@ -29,8 +29,8 @@ def gather_maintainers_of_file(patch_file):
> others = []
>
> for entry in entries:
> - entity = entry.split('(')[0].strip()
> - if any(role in entry for role in ["maintainer", "reviewer"]):
> + entity = entry.rsplit('(', 1)[0].strip()
> + if any(role in entry for role in ["maintainer", "reviewer", "supporter"]):
> maintainers.append(entity)
> elif "list" in entry:
> lists.append(entity)
>
>

The %s/split/rsplit trades one bug for another :-( , pls ignore the
diff, when entries have multiple braces "()" , the script does not work
as epxected.

Thanks,
Pavan

2023-09-28 19:11:32

by Guru Das Srinagesh

[permalink] [raw]
Subject: Re: [PATCH v3 1/1] scripts: Add add-maintainer.py

On Sep 26 2023 17:32, Pavan Kondeti wrote:
> On Sat, Aug 26, 2023 at 01:07:42AM -0700, Guru Das Srinagesh wrote:
> > +def gather_maintainers_of_file(patch_file):
> > + all_entities_of_patch = dict()
> > +
> > + # Run get_maintainer.pl on patch file
> > + logging.info("GET: Patch: {}".format(os.path.basename(patch_file)))
> > + cmd = ['scripts/get_maintainer.pl']
> > + cmd.extend([patch_file])
> > +
> > + try:
> > + p = subprocess.run(cmd, stdout=subprocess.PIPE, check=True)
> > + except:
> > + sys.exit(1)
> > +
> > + logging.debug("\n{}".format(p.stdout.decode()))
> > +
> > + entries = p.stdout.decode().splitlines()
> > +
> > + maintainers = []
> > + lists = []
> > + others = []
> > +
> > + for entry in entries:
> > + entity = entry.split('(')[0].strip()
> > + if any(role in entry for role in ["maintainer", "reviewer"]):
> > + maintainers.append(entity)
> > + elif "list" in entry:
> > + lists.append(entity)
> > + else:
> > + others.append(entity)
> > +
> > + all_entities_of_patch["maintainers"] = set(maintainers)
> > + all_entities_of_patch["lists"] = set(lists)
> > + all_entities_of_patch["others"] = set(others)
> > +
> > + return all_entities_of_patch
> > +
>
> FYI, there are couple of issues found while playing around.

Thanks for testing this out :) I am no longer working on this due to pushback
from the maintainers in favour of b4.

>
> - Some entries in MAINTAINERS could be "supporter"

This was intentional - I didn't want to include "supporter"s.

> - When names contain ("company"), the script fails to extract name.

Interesting... I had not tested this out.

In any case, I am not devoting resources to work on this unless I see some
interest from maintainers, which, as it stands currently, is nil.

Thanks for the support, Pavan.

Guru Das.