tools: use SPDX tag for Intel copyright files
[dpdk.git] / devtools / get-maintainer.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright(c) 2017 Intel Corporation
4
5
6 # Load config options:
7 # - DPDK_GETMAINTAINER_PATH
8 . $(dirname $(readlink -e $0))/load-devel-config
9
10 options="--no-git-fallback"
11 options="$options --no-rolestats"
12
13 print_usage () {
14         cat <<- END_OF_HELP
15         usage: $(basename $0) <patch>
16
17         The DPDK_GETMAINTAINER_PATH variable should be set to the full path to
18         the get_maintainer.pl script located in Linux kernel sources. Example:
19         DPDK_GETMAINTAINER_PATH=~/linux/scripts/get_maintainer.pl
20
21         Also refer to devtools/load-devel-config to store your configuration.
22         END_OF_HELP
23 }
24
25 # Requires DPDK_GETMAINTAINER_PATH devel config option set
26 if [ ! -x "$DPDK_GETMAINTAINER_PATH" ] ; then
27         print_usage >&2
28         echo
29         echo 'Cannot execute DPDK_GETMAINTAINER_PATH' >&2
30         exit 1
31 fi
32
33 FILES="COPYING CREDITS Kbuild"
34 FOLDERS="Documentation arch include fs init ipc kernel scripts"
35
36 # Kernel script checks for some files and folders to run
37 workaround () {
38         for f in $FILES; do
39                 if [ ! -f $f ]; then touch $f; fi
40         done
41
42         for d in $FOLDERS; do
43                 if [ ! -d $d ]; then mkdir $d; fi
44         done
45 }
46
47 fix_workaround () {
48         for f in $FILES; do if [ -f $f ]; then rm -f $f; fi; done
49         for d in $FOLDERS; do if [ -d $d ]; then rmdir $d; fi; done
50 }
51
52 # clean workaround on exit
53 trap fix_workaround EXIT
54
55 workaround
56 $DPDK_GETMAINTAINER_PATH $options $@
57 # fix_workaround called on exit by trap