Skip to content
Snippets Groups Projects
Commit eb020ce2 authored by Nicolas Noble's avatar Nicolas Noble
Browse files

Few fixes for mkowners.py.

-) Paths should all be absolute to /
-) Computing the intersection of two globs should happen with the
full path in there, not just the directory's glob.
parent 8bcc7d59
No related branches found
No related tags found
No related merge requests found
# Auto-generated by the tools/mkowners/mkowners.py tool # Auto-generated by the tools/mkowners/mkowners.py tool
# Uses OWNERS files in different modules throughout the # Uses OWNERS files in different modules throughout the
# repository as the source of truth for module ownership. # repository as the source of truth for module ownership.
** @a11r @nicolasnoble @ctiller /** @a11r @nicolasnoble @ctiller
bazel/** @nicolasnoble @dgquintas @ctiller /bazel/** @nicolasnoble @dgquintas @ctiller
cmake/** @jtattermusch @a11r @nicolasnoble @ctiller /cmake/** @jtattermusch @a11r @nicolasnoble @ctiller
doc/PROTOCOL-HTTP2.md @ejona86 @a11r @nicolasnoble @ctiller /doc/PROTOCOL-HTTP2.md @ejona86 @a11r @nicolasnoble @ctiller
doc/interop-test-descriptions.md @ejona86 @a11r @nicolasnoble @ctiller /doc/interop-test-descriptions.md @ejona86 @a11r @nicolasnoble @ctiller
etc/** @jboeuf @nicolasnoble @a11r @ctiller /etc/** @jboeuf @nicolasnoble @a11r @ctiller
include/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble /include/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble
src/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble /src/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble
src/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble /src/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble
src/csharp/** @jtattermusch @apolcyn @a11r @nicolasnoble @ctiller /src/csharp/** @jtattermusch @apolcyn @a11r @nicolasnoble @ctiller
src/node/** @murgatroid99 @a11r @nicolasnoble @ctiller /src/node/** @murgatroid99 @a11r @nicolasnoble @ctiller
src/objective-c/** @muxi @makdharma @a11r @nicolasnoble @ctiller /src/objective-c/** @muxi @makdharma @a11r @nicolasnoble @ctiller
src/php/** @stanley-cheung @murgatroid99 @a11r @nicolasnoble @ctiller /src/php/** @stanley-cheung @murgatroid99 @a11r @nicolasnoble @ctiller
src/python/** @nathanielmanistaatgoogle @kpayson64 @a11r @nicolasnoble @ctiller /src/python/** @nathanielmanistaatgoogle @kpayson64 @a11r @nicolasnoble @ctiller
src/ruby/** @apolcyn @murgatroid99 @a11r @nicolasnoble @ctiller /src/ruby/** @apolcyn @murgatroid99 @a11r @nicolasnoble @ctiller
test/build/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble /test/build/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble
test/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble /test/core/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble
test/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble /test/cpp/** @ctiller @markdroth @dgquintas @a11r @nicolasnoble
tools/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller /tools/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller
tools/codegen/core/** @ctiller @dgquintas @markdroth /tools/codegen/core/** @ctiller @dgquintas @markdroth
tools/dockerfile/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller /tools/dockerfile/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller
tools/run_tests/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller /tools/run_tests/** @matt-kwong @jtattermusch @nicolasnoble @a11r @ctiller
...@@ -123,6 +123,9 @@ owners_data = new_owners_data ...@@ -123,6 +123,9 @@ owners_data = new_owners_data
# a CODEOWNERS file for GitHub # a CODEOWNERS file for GitHub
# #
def full_dir(rules_dir, sub_path):
return os.path.join(rules_dir, sub_path) if rules_dir != '.' else sub_path
def glob_intersect(g1, g2): def glob_intersect(g1, g2):
if not g2: if not g2:
return all(c == '*' for c in g1) return all(c == '*' for c in g1)
...@@ -136,17 +139,18 @@ def glob_intersect(g1, g2): ...@@ -136,17 +139,18 @@ def glob_intersect(g1, g2):
return glob_intersect(t1, g2) or glob_intersect(g1, t2) return glob_intersect(t1, g2) or glob_intersect(g1, t2)
return c1 == c2 and glob_intersect(t1, t2) return c1 == c2 and glob_intersect(t1, t2)
def add_parent_to_globs(parent, globs): def add_parent_to_globs(parent, globs, globs_dir):
if not parent: return if not parent: return
for owners in owners_data: for owners in owners_data:
if owners.dir == parent: if owners.dir == parent:
for directive in owners.directives: for directive in owners.directives:
for dglob in directive.globs or ['**']: for dglob in directive.globs or ['**']:
for gglob, glob in globs.items(): for gglob, glob in globs.items():
if glob_intersect(dglob, gglob): if glob_intersect(full_dir(globs_dir, gglob),
full_dir(owners.dir, dglob)):
if directive.who not in glob: if directive.who not in glob:
glob.append(directive.who) glob.append(directive.who)
add_parent_to_globs(owners.parent, globs) add_parent_to_globs(owners.parent, globs, globs_dir)
return return
assert(False) assert(False)
...@@ -167,9 +171,8 @@ with open(args.out, 'w') as out: ...@@ -167,9 +171,8 @@ with open(args.out, 'w') as out:
if glob not in globs: if glob not in globs:
globs[glob] = [] globs[glob] = []
globs[glob].append(directive.who) globs[glob].append(directive.who)
add_parent_to_globs(head.parent, globs) add_parent_to_globs(head.parent, globs, head.dir)
for glob, owners in globs.items(): for glob, owners in globs.items():
out.write('%s %s\n' % ( out.write('/%s %s\n' % (
os.path.join(head.dir, glob) if head.dir != '.' else glob, full_dir(head.dir, glob), ' '.join(owners)))
' '.join(owners)))
done.add(head.dir) done.add(head.dir)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment