-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathto_cmd.sh
More file actions
executable file
·55 lines (47 loc) · 1.69 KB
/
to_cmd.sh
File metadata and controls
executable file
·55 lines (47 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#! /usr/bin/sh
######################################################################
# @author : Gabriele Monaco (32201227+glemco@users.noreply.github.com)
# @file : to_cmd
# @created : Wednesday Feb 05, 2025 15:38:12 CET
#
# @description : Get To from body and maintainers file
######################################################################
patch=$1
cover_letter=$(grep -z 0000 /proc/$PPID/cmdline | tr -d '\0')
if [ -f to_file ]; then
cat to_file
exit 0
fi
# some subsystems have further divisions get_maintainer doesn't understand
# try to ignore those in the automatic selection. E.g. :
# M: Foo Bar <foo@bar.com> (SUB_SUBSYSTEM)
# Add here other addresses that should not be used
get_blacklisted() {
if [ -f MAINTAINERS ]; then
grep 'M:\s[a-Z ]\+<[a-z@.]\+> ([^)]\+)' MAINTAINERS | \
sed 's/ (.*//' | sed 's/M:\s//'
fi
echo "Daniel Bristot de Oliveira <bristot@kernel.org>"
}
# parse from the patch
grep ^To: "$patch" | sed 's/To: //'
# the cover letter is not a patch
if echo "$patch" | grep -q 0000; then
exit 0
fi
# parse from the cover letter
if [ -n "$cover_letter" ]; then
grep ^To: "$cover_letter" | sed 's/To: //'
fi
# add only lists and maintainers by default
if [ -x scripts/get_maintainer.pl ]; then
temp_file=$(mktemp)
nom=$([ -n "$NOMAINT" ] && echo --nom || echo --m)
fixes=$([ -n "$NOFIX" ] && echo --nofixes || echo --fixes)
rolestats=$([ -n "$VERBOSE" ] && echo --rolestats || echo --norolestats)
keywords=$([ -n "$KEYWORDS" ] && echo --keywords || echo --nokeywords)
get_blacklisted > "$temp_file"
scripts/get_maintainer.pl --nor "$nom" --nogit --nogit-fallback "$fixes" "$rolestats" "$keywords" "$patch" | \
grep -v -f "$temp_file"
rm -f "$temp_file"
fi