mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cesar Eduardo Barros <cesarb@cesarb.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Joe Perches <joe@perches.com>,
	Cesar Eduardo Barros <cesarb@cesarb.net>,
	David Howells <dhowells@redhat.com>
Subject: [PATCH 13/14] scripts: add checkmaintainers.py
Date: Sat,  2 Mar 2013 22:53:51 -0300	[thread overview]
Message-ID: <1362275632-20242-14-git-send-email-cesarb@cesarb.net> (raw)
In-Reply-To: <1362275632-20242-1-git-send-email-cesarb@cesarb.net>

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 <dhowells@redhat.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Cesar Eduardo Barros <cesarb@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 0000000..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 <cesarb@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


  parent reply	other threads:[~2013-03-03  1:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-03  1:53 [PATCH 00/14] MAINTAINERS: fix file patterns (part 2) Cesar Eduardo Barros
2013-03-03  1:53 ` [PATCH 01/14] MAINTAINERS: remove 3c505 Cesar Eduardo Barros
2013-03-03  6:44   ` David Miller
2013-03-03  1:53 ` [PATCH 02/14] MAINTAINERS: remove arch/arm/plat-nomadik/ Cesar Eduardo Barros
2013-03-07  2:35   ` Linus Walleij
2013-03-03  1:53 ` [PATCH 03/14] MAINTAINERS: remove arch/arm/plat-s3c24xx/ Cesar Eduardo Barros
2013-03-04 12:57   ` Kukjin Kim
2013-03-03  1:53 ` [PATCH 04/14] MAINTAINERS: fix drivers/media/i2c/cx2341x.c Cesar Eduardo Barros
2013-03-03  8:35   ` Hans Verkuil
2013-03-03  1:53 ` [PATCH 05/14] MAINTAINERS: remove drivers/net/wan/cycx* Cesar Eduardo Barros
2013-03-03  6:44   ` David Miller
2013-03-03  1:53 ` [PATCH 06/14] MAINTAINERS: fix drivers/edac/ghes-edac.c Cesar Eduardo Barros
2013-03-03  1:53 ` [PATCH 07/14] MAINTAINERS: remove eexpress Cesar Eduardo Barros
2013-03-03  6:44   ` David Miller
2013-03-03  1:53 ` [PATCH 08/14] MAINTAINERS: fix mach-omap2 clockdomain/powerdomain Cesar Eduardo Barros
2013-06-09  7:30   ` Paul Walmsley
2013-03-03  1:53 ` [PATCH 09/14] MAINTAINERS: fix Documentation/video4linux/saa7134/ Cesar Eduardo Barros
2013-03-03  1:53 ` [PATCH 10/14] MAINTAINERS: remove include/media/sh_veu.h Cesar Eduardo Barros
2013-03-03  1:53 ` [PATCH 11/14] MAINTAINERS: fix BAST Cesar Eduardo Barros
2013-03-03 10:14   ` Paul Bolle
2013-03-03  1:53 ` [PATCH 12/14] MAINTAINERS: adjust for UAPI (part 2) Cesar Eduardo Barros
2013-03-03  1:53 ` Cesar Eduardo Barros [this message]
2013-03-03 10:40   ` [PATCH 13/14] scripts: add checkmaintainers.py Paul Bolle
2013-03-03  1:53 ` [PATCH 14/14] MAINTAINERS: use same pattern for firewire in uapi Cesar Eduardo Barros
2013-03-03  5:51   ` Joe Perches
2013-03-03 21:26   ` Stefan Richter
2013-03-04 14:07 ` [PATCH 12/14] MAINTAINERS: adjust for UAPI (part 2) David Howells
2013-03-07  8:06 ` [PATCH 02/14] MAINTAINERS: remove arch/arm/plat-nomadik/ Alessandro Rubini

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=1362275632-20242-14-git-send-email-cesarb@cesarb.net \
    --to=cesarb@cesarb.net \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®