summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas Monjalon <thomas.monjalon@6wind.com>2015-01-23 13:31:59 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-01-28 17:12:27 +0100
commit27c2ce563216601166bd9f22f062127875eb6266 (patch)
tree538feae1311d51137251302f2cd19f407fb081ab /scripts
parent17f520d2cff8d69962824f28810f36e949a7184d (diff)
downloaddpdk-27c2ce563216601166bd9f22f062127875eb6266.zip
dpdk-27c2ce563216601166bd9f22f062127875eb6266.tar.gz
dpdk-27c2ce563216601166bd9f22f062127875eb6266.tar.xz
maintainers: start a Linux-style file
This MAINTAINERS file is inspired from the Linux one. Almost all files are split into areas in order to identify maintainers of each DPDK area. Note that a maintainer is not a git tree manager. Candidates are welcome to send a patch to sign up for one or several areas. There is a script to check coverage, especially when adding or moving files. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-maintainers.sh117
1 files changed, 117 insertions, 0 deletions
diff --git a/scripts/check-maintainers.sh b/scripts/check-maintainers.sh
new file mode 100755
index 0000000..2687cad
--- /dev/null
+++ b/scripts/check-maintainers.sh
@@ -0,0 +1,117 @@
+#! /bin/sh
+
+# BSD LICENSE
+#
+# Copyright 2015 6WIND S.A.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of 6WIND S.A. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Do some basic checks in MAINTAINERS file
+
+cd $(dirname $0)/..
+
+# Get files matching paths with wildcards and / meaning recursing
+files () # <path> [<path> ...]
+{
+ if [ -z "$1" ] ; then
+ return
+ fi
+ if [ -d .git ] ; then
+ git ls-files "$1"
+ else
+ find "$1" -type f |
+ sed 's,^\./,,'
+ fi |
+ # if not ended by /
+ if ! echo "$1" | grep -q '/[[:space:]]*$' ; then
+ # filter out deeper directories
+ sed "/\(\/[^/]*\)\{$(($(echo "$1" | grep -o / | wc -l) + 1))\}/d"
+ else
+ cat
+ fi
+ # next path
+ shift
+ files "$@"
+}
+
+# Get all files matching F: and X: fields
+parse_fx () # <index file>
+{
+ IFS='
+'
+ # parse each line excepted underlining
+ for line in $( (sed '/^-\+$/d' $1 ; echo) | sed 's,^$,§,') ; do
+ if echo "$line" | grep -q '^§$' ; then
+ # empty line delimit end of section
+ whitelist=$(files $flines)
+ blacklist=$(files $xlines)
+ match=$(aminusb "$whitelist" "$blacklist")
+ if [ -n "$match" ] ; then
+ echo "# $title"
+ echo "$match"
+ fi
+ # flush section
+ unset flines
+ unset xlines
+ elif echo "$line" | grep -q '^[A-Z]: ' ; then
+ # file matching pattern
+ flines=$(add_line_to_if "$line" "$flines" 'F: ')
+ # file exclusion pattern
+ xlines=$(add_line_to_if "$line" "$xlines" 'X: ')
+ else # assume it is a title
+ title="$line"
+ fi
+ done
+}
+
+# Add a line to a set of lines if it begins with right pattern
+add_line_to_if () # <new line> <lines> <head pattern>
+{
+ (
+ echo "$2"
+ echo "$1" | sed -rn "s,^$3(.*),\1,p"
+ ) |
+ sed '/^$/d'
+}
+
+# Subtract two sets of lines
+aminusb () # <lines a> <lines b>
+{
+ printf "$1\n$2\n$2" | sort | uniq -u | sed '/^$/d'
+}
+
+all=$(files ./)
+listed=$(parse_fx MAINTAINERS | sed '/^#/d' | sort -u)
+
+echo '##########'
+echo '# files not listed'
+echo '##########'
+aminusb "$all" "$listed"
+
+# TODO: check patterns that match nothing
+# TODO: check overlaps
+# TODO: check orphan areas