Re: [PATCH 13/14] scripts: add checkmaintainers.py
On Sat, 2013-03-02 at 22:53 -0300, Cesar Eduardo Barros wrote: > For every file pattern, it checks if the pattern matches any file or > directory in the kernel tree, printing the patterns which do not have a > match. In a script I cobbled together for local consumption, I invoked "git ls-files" to generate the list of files to check against. Using the files and directories currently in one's kernel tree is liable to generating false positives or false negatives. Paul Bolle -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 13/14] scripts: add checkmaintainers.py
On Sat, 2013-03-02 at 22:53 -0300, Cesar Eduardo Barros wrote: For every file pattern, it checks if the pattern matches any file or directory in the kernel tree, printing the patterns which do not have a match. In a script I cobbled together for local consumption, I invoked git ls-files to generate the list of files to check against. Using the files and directories currently in one's kernel tree is liable to generating false positives or false negatives. Paul Bolle -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 13/14] scripts: add checkmaintainers.py
This small script checks the file patterns in the MAINTAINERS file. For every file pattern, it checks if the pattern matches any file or directory in the kernel tree, printing the patterns which do not have a match. It also checks for any file pattern pointing to any of the include directories which does not have a corresponding UAPI file pattern, but only if the UAPI file pattern would have a match. It also does the same in the opposite direction. The script is written in Python; I found its glob function more well-behaved than Perl's. It should work on both Python 2 and Python 3 without any changes (not even 2to3 is needed); tested on 2.7, 3.2, and 3.3. I do not think such a short script should have a copyright. But to avoid any problems, I arbitrarily used the "GNU All-Permissive License" (found in FSF's GPL-compatible list). If needed, feel free to relicense it as GPLv2+, 3-clause BSD, or even WTFPLv2 or CC0. Cc: David Howells Cc: Joe Perches Signed-off-by: Cesar Eduardo Barros --- scripts/checkmaintainers.py | 35 +++ 1 file changed, 35 insertions(+) create mode 100755 scripts/checkmaintainers.py diff --git a/scripts/checkmaintainers.py b/scripts/checkmaintainers.py new file mode 100755 index 000..99740e3 --- /dev/null +++ b/scripts/checkmaintainers.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +# Quick check for missing file patterns in the MAINTAINERS file. +# +# Copyright (C) 2012 Cesar Eduardo Barros +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +from __future__ import print_function, unicode_literals, with_statement +from glob import glob + +seen = set() + +with open('MAINTAINERS', 'rb') as f: +for line in f: +line = line.decode('utf-8') +if line.startswith('F:'): +pattern = line.partition(':')[2].strip() +seen.add(pattern) + +if not glob(pattern): +print('No match for F: {0}'.format(pattern)) + +# Check for missing uapi/ pattern +for pattern in seen: +if 'include/' in pattern: +if 'include/uapi/' in pattern: +other = pattern.replace('include/uapi/', 'include/') +else: +other = pattern.replace('include/', 'include/uapi/') + +if other not in seen and glob(other): +print('Missing {0} for {1}'.format(other, pattern)) -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 13/14] scripts: add checkmaintainers.py
This small script checks the file patterns in the MAINTAINERS file. For every file pattern, it checks if the pattern matches any file or directory in the kernel tree, printing the patterns which do not have a match. It also checks for any file pattern pointing to any of the include directories which does not have a corresponding UAPI file pattern, but only if the UAPI file pattern would have a match. It also does the same in the opposite direction. The script is written in Python; I found its glob function more well-behaved than Perl's. It should work on both Python 2 and Python 3 without any changes (not even 2to3 is needed); tested on 2.7, 3.2, and 3.3. I do not think such a short script should have a copyright. But to avoid any problems, I arbitrarily used the GNU All-Permissive License (found in FSF's GPL-compatible list). If needed, feel free to relicense it as GPLv2+, 3-clause BSD, or even WTFPLv2 or CC0. Cc: David Howells dhowe...@redhat.com Cc: Joe Perches j...@perches.com Signed-off-by: Cesar Eduardo Barros ces...@cesarb.net --- scripts/checkmaintainers.py | 35 +++ 1 file changed, 35 insertions(+) create mode 100755 scripts/checkmaintainers.py diff --git a/scripts/checkmaintainers.py b/scripts/checkmaintainers.py new file mode 100755 index 000..99740e3 --- /dev/null +++ b/scripts/checkmaintainers.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +# Quick check for missing file patterns in the MAINTAINERS file. +# +# Copyright (C) 2012 Cesar Eduardo Barros ces...@cesarb.net +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +from __future__ import print_function, unicode_literals, with_statement +from glob import glob + +seen = set() + +with open('MAINTAINERS', 'rb') as f: +for line in f: +line = line.decode('utf-8') +if line.startswith('F:'): +pattern = line.partition(':')[2].strip() +seen.add(pattern) + +if not glob(pattern): +print('No match for F: {0}'.format(pattern)) + +# Check for missing uapi/ pattern +for pattern in seen: +if 'include/' in pattern: +if 'include/uapi/' in pattern: +other = pattern.replace('include/uapi/', 'include/') +else: +other = pattern.replace('include/', 'include/uapi/') + +if other not in seen and glob(other): +print('Missing {0} for {1}'.format(other, pattern)) -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/