Lines Matching +full:sub +full:- +full:spaces

2 # SPDX-License-Identifier: GPL-2.0
11 # perl scripts/get_maintainer.pl [OPTIONS] -f <file>
42 my $email_git_since = "1-year-ago";
43 my $email_hg_since = "-365";
85 push(@signature_tags, "Signed-off-by:");
86 push(@signature_tags, "Reviewed-by:");
87 push(@signature_tags, "Acked-by:");
91 # rfc822 email address - preloaded methods go here.
93 my $rfc822_char = '[\\000-\\377]';
95 # VCS command support: class-like functions and strings
101 "available" => '(which("git") ne "") && (-e ".git")',
103 "git log --no-color --follow --since=\$email_git_since " .
104 '--numstat --no-merges ' .
105 '--format="GitCommit: %H%n' .
110 " -- \$file",
112 "git log --no-color " .
113 '--numstat ' .
114 '--format="GitCommit: %H%n' .
119 " -1 \$commit",
121 "git log --no-color " .
122 '--numstat ' .
123 '--format="GitCommit: %H%n' .
127 " -1 \$commit",
128 "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file",
129 "blame_file_cmd" => "git blame -l \$file",
130 "commit_pattern" => "^GitCommit: ([0-9a-f]{40,40})",
131 "blame_commit_pattern" => "^([0-9a-f]+) ",
135 "file_exists_cmd" => "git ls-files \$file",
136 "list_files_cmd" => "git ls-files \$file",
141 "available" => '(which("hg") ne "") && (-d ".hg")',
143 "hg log --date=\$email_hg_since " .
144 "--template='HgCommit: {node}\\n" .
147 " -- \$file",
150 "--template='HgSubject: {desc}\\n'" .
151 " -r \$commit",
154 "--template='HgCommit: {node}\\n" .
157 " -r \$commit",
159 "blame_file_cmd" => "hg blame -n \$file",
160 "commit_pattern" => "^HgCommit: ([0-9a-f]{40,40})",
161 "blame_commit_pattern" => "^([ 0-9a-f]+):",
166 "list_files_cmd" => "hg manifest -R \$file",
170 if (-f $conf) {
197 if (-f $ignore_file) {
218 if ($_ =~ /^-{1,2}self-test(?:=|$)/) {
219 die "$P: using --self-test does not allow any other option or argument\n";
227 'git-all-signature-types!' => \$email_git_all_signature_types,
228 'git-blame!' => \$email_git_blame,
229 'git-blame-signatures!' => \$email_git_blame_signatures,
230 'git-fallback!' => \$email_git_fallback,
231 'git-min-signatures=i' => \$email_git_min_signatures,
232 'git-max-maintainers=i' => \$email_git_max_maintainers,
233 'git-min-percent=i' => \$email_git_min_percent,
234 'git-since=s' => \$email_git_since,
235 'hg-since=s' => \$email_hg_since,
237 'remove-duplicates!' => \$email_remove_duplicates,
256 'pattern-depth=i' => \$pattern_depth,
259 'fe|file-emails!' => \$email_file_emails,
261 'find-maintainer-files' => \$find_maintainer_files,
262 'mpath|maintainer-path=s' => \$maintainer_path,
263 'self-test:s' => \$self_test,
267 die "$P: invalid argument - use --help if necessary\n";
286 if (-t STDIN && !@ARGV) {
288 die "$P: missing patchfile or -f file - use --help if necessary\n";
326 sub read_maintainer_file {
336 if ($line =~ m/^([A-Z]):\s*(.*)/) {
346 if ((-d $value)) {
364 sub find_is_maintainer_file {
368 return if (! -f $file);
372 sub find_ignore_git {
378 sub read_all_maintainer_files {
386 if (-d $path) {
401 } elsif (-f "$path") {
412 sub maintainers_in_file {
417 if (-f $file && ($email_file_emails || $file =~ /\.yaml$/)) {
423 …my @poss_addr = $text =~ m$[A-Za--ÿ\"\' \,\.\+-]*\s*[\,]*\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-
436 sub read_mailmap {
442 return if (!$email_use_mailmap || !(-f "${lk_path}.mailmap"));
457 # (see man git-shortlog)
465 $mailmap->{names}->{$address} = $real_name;
471 $mailmap->{addresses}->{$wrong_address} = $real_address;
481 $mailmap->{names}->{$wrong_address} = $real_name;
482 $mailmap->{addresses}->{$wrong_address} = $real_address;
499 $mailmap->{names}->{$wrong_email} = $real_name;
500 $mailmap->{addresses}->{$wrong_email} = $real_address;
516 if ((-d $file)) {
518 } elsif (!(-f $file)) {
529 if ($file ne "MAINTAINERS" && -f $file && $keywords) {
552 # of a git format-patch generated file (subject tags, etc...)
558 if (m/^ mode change [0-7]+ => [0-7]+ (\S+)\s*$/) {
564 } elsif (m/^diff --git a\/(\S+) b\/(\S+)\s*$/) {
569 } elsif (m/^Fixes:\s+([0-9a-fA-F]{6,40})/) {
571 } elsif (m/^\+\+\+\s+(\S+)/ or m/^---\s+(\S+)/) {
577 $patch_prefix = "^[+-].*"; #Now parsing the actual patch
578 } elsif (m/^\@\@ -(\d+),(\d+)/) {
594 . "Add -f to options?\n";
643 sub self_test {
657 $x->{line} =~ /^\S[^:]/ &&
659 $self_test_info[$index]->{line} =~ /^([A-Z]):\s*\S/) {
664 if (grep(m@^\Q$x->{line}\E@, @section_headers)) {
665 print("$x->{file}:$x->{linenr}: warning: duplicate section header\t$x->{line}\n");
667 push(@section_headers, $x->{line});
671 $self_test_info[$nextline]->{line} =~ /^([A-Z]):\s*(\S.*)/) {
685 print("$x->{file}:$x->{linenr}: warning: section without email address\t$x->{line}\n");
688 print("$x->{file}:$x->{linenr}: warning: section without status \t$x->{line}\n");
691 print("$x->{file}:$x->{linenr}: warning: section without file pattern\t$x->{line}\n");
695 next if ($x->{line} !~ /^([A-Z]):\s*(.*)/);
707 if ((-d $value)) {
711 print("$x->{file}:$x->{linenr}: warning: no file matches\t$x->{line}\n");
723 my $output = `wget --spider -q --no-check-certificate --timeout 10 --tries 1 $value`;
732 print("$x->{file}:$x->{linenr}: warning: possible bad link\t$x->{line}\n");
743 print("$x->{file}:$x->{linenr}: warning: malformed entry\t$x->{line}\n");
748 my $output = `git ls-remote --exit-code -h "$url" $branch > /dev/null 2>&1`;
757 my $output = `wget --spider -q --no-check-certificate --timeout 10 --tries 1 $url`;
766 print("$x->{file}:$x->{linenr}: warning: possible bad link\t$x->{line}\n");
772 sub ignore_email_address {
782 sub range_is_maintained {
787 if ($line =~ m/^([A-Z]):\s*(.*)/) {
800 sub range_has_maintainer {
805 if ($line =~ m/^([A-Z]):\s*(.*)/) {
816 sub get_maintainers {
854 if ($line =~ m/^([A-Z]):\s*(.*)/) {
869 if ($line =~ m/^([A-Z]):\s*(.*)/) {
876 $value_pd++ if (substr($value,-1,1) ne "/");
877 $value_pd = -1 if ($value =~ /^\.\*/);
884 (($file_pd - $value_pd) < $pattern_depth)) {
913 my $count = $line =~ s/^([A-Z]):/$1:\t/g;
933 $email->[0] = deduplicate_email($email->[0]);
980 sub file_match_pattern {
982 if (substr($pattern, -1) eq "/") {
998 sub usage {
1001 $P [options] -f file|directory
1005 --email => print email address(es) if any
1006 --git => include recent git \*-by: signers
1007 --git-all-signature-types => include signers regardless of signature type
1009 --git-fallback => use git when no exact MAINTAINERS pattern (default: $email_git_fallback)
1010 --git-min-signatures => number of signatures required (default: $email_git_min_signatures)
1011 --git-max-maintainers => maximum maintainers to add (default: $email_git_max_maintainers)
1012 --git-min-percent => minimum percentage of commits required (default: $email_git_min_percent)
1013 --git-blame => use git blame to find modified commits for patch or file
1014 --git-blame-signatures => when used with --git-blame, also include all commit signers
1015 --git-since => git history to use (default: $email_git_since)
1016 --hg-since => hg history to use (default: $email_hg_since)
1017 --interactive => display a menu (mostly useful if used with the --git option)
1018 --m => include maintainer(s) if any
1019 --r => include reviewer(s) if any
1020 --n => include name 'Full Name <addr\@domain.tld>'
1021 --l => include list(s) if any
1022 --moderated => include moderated lists(s) if any (default: true)
1023 --s => include subscriber only list(s) if any (default: false)
1024 --remove-duplicates => minimize duplicate email names/addresses
1025 --roles => show roles (status:subsystem, git-signer, list, etc...)
1026 --rolestats => show roles and statistics (commits/total_commits, %)
1027 --file-emails => add email addresses found in -f file (default: 0 (off))
1028 --fixes => for patches, add signatures of commits with 'Fixes: <commit>' (default: 1 (on))
1029 --scm => print SCM tree(s) if any
1030 --status => print status if any
1031 --subsystem => print subsystem name if any
1032 --web => print website(s) if any
1035 --separator [, ] => separator for multiple entries on 1 line
1036 using --separator also sets --nomultiline if --separator is not [, ]
1037 --multiline => print 1 entry per line
1040 --pattern-depth => Number of pattern directory traversals (default: 0 (all))
1041 --keywords => scan patch for keywords (default: $keywords)
1042 --sections => print all of the subsystem sections with pattern matches
1043 --letters => print all matching 'letter' types from all matching sections
1044 --mailmap => use .mailmap file (default: $email_use_mailmap)
1045 --no-tree => run without a kvm-user-space tree
1046 --self-test => show potential issues with MAINTAINERS file content
1047 --version => show version
1048 --help => show this help information
1051 [--email --tree --nogit --git-fallback --m --r --n --l --multiline
1052 --pattern-depth=0 --remove-duplicates --rolestats]
1055 Using "-f directory" may give unexpected results:
1056 Used with "--git", git signators for _all_ files in and below
1059 Used with "--nogit", directory is used as a pattern match,
1062 Used with "--git-blame", does not iterate all files in directory
1063 Using "--git-blame" is slow and may add old committers and authors
1065 Using "--roles" or "--rolestats" with git send-email --cc-cmd or any
1068 Using "--rolestats" and "--git-blame" shows the #/total=% commits,
1074 --git,
1075 --git-min-signatures, --git-max-maintainers, --git-min-percent, and
1076 --git-blame
1077 Use --hg-since not --git-since to control date selection
1078 File ".get_maintainer.conf", if it exists in the kvm-unit-tests source root
1084 The negative forms for --<foo> are --no<foo> and --no-<foo>.
1089 sub parse_email {
1108 if ($name =~ /[^\w \-]/i) { ##has "must quote" chars
1116 sub format_email {
1125 if ($name =~ /[^\w \-]/i) { ##has "must quote" chars
1143 sub find_first_section {
1148 if (($tv =~ m/^([A-Z]):\s*(.*)/)) {
1157 sub find_starting_index {
1162 if (!($tv =~ m/^([A-Z]):\s*(.*)/)) {
1165 $index--;
1171 sub find_ending_index {
1176 if (!($tv =~ m/^([A-Z]):\s*(.*)/)) {
1185 sub get_subsystem_name {
1192 $subsystem = substr($subsystem, 0, $output_section_maxlen - 3);
1199 sub get_maintainer_role {
1211 if ($tv =~ m/^([A-Z]):\s*(.*)/) {
1238 sub get_list_role {
1250 sub add_categories {
1261 if ($tv =~ m/^([A-Z]):\s*(.*)/) {
1276 if ($list_additional =~ m/subscribers-only/) {
1322 sub email_inuse {
1332 sub push_email_address {
1352 sub push_email_addresses {
1371 sub add_role {
1379 my ($entry_name, $entry_address) = parse_email($entry->[0]);
1381 && ($role eq "" || !($entry->[1] =~ m/$role/))
1383 if ($entry->[1] eq "") {
1384 $entry->[1] = "$role";
1386 $entry->[1] = "$entry->[1],$role";
1390 if ($email eq $entry->[0]
1391 && ($role eq "" || !($entry->[1] =~ m/$role/))
1393 if ($entry->[1] eq "") {
1394 $entry->[1] = "$role";
1396 $entry->[1] = "$entry->[1],$role";
1403 sub which {
1407 if (-e "$path/$bin") {
1415 sub which_conf {
1419 if (-e "$path/$conf") {
1427 sub mailmap_email {
1435 if (exists $mailmap->{names}->{$email} ||
1436 exists $mailmap->{addresses}->{$email}) {
1437 if (exists $mailmap->{names}->{$email}) {
1438 $real_name = $mailmap->{names}->{$email};
1440 if (exists $mailmap->{addresses}->{$email}) {
1441 $real_address = $mailmap->{addresses}->{$email};
1444 if (exists $mailmap->{names}->{$address}) {
1445 $real_name = $mailmap->{names}->{$address};
1447 if (exists $mailmap->{addresses}->{$address}) {
1448 $real_address = $mailmap->{addresses}->{$address};
1454 sub mailmap {
1465 sub merge_by_realname {
1480 sub git_execute_cmd {
1491 sub hg_execute_cmd {
1501 sub extract_formatted_signatures {
1508 # cut -f2- -d":"
1520 sub vcs_find_signers {
1555 sub vcs_find_author {
1579 sub vcs_save_commits {
1595 sub vcs_blame {
1600 return @commits if (!(-f $file));
1644 sub vcs_exists {
1651 warn("$P: No supported VCS found. Add --nogit to options?\n");
1653 warn("Try kvm-unit-tests's latest git repository using:\n");
1654 warn("git clone https://gitlab.com/kvm-unit-tests/kvm-unit-tests\n");
1660 sub vcs_is_git {
1665 sub vcs_is_hg {
1669 sub vcs_add_commit_signers {
1695 sub interactive_get_maintainers {
1707 $maintained = 1 if ($entry->[1] =~ /^(maintainer|supporter)/i);
1721 printf STDERR "\n%1s %2s %-65s",
1730 my $email = $entry->[0];
1731 my $role = $entry->[1];
1740 printf STDERR "%1s %2d %-65s", $sel, $count + 1, $email;
1769 gf use git-fallback [$email_git_fallback]
1817 $selected{$nr - 1} = !$selected{$nr - 1};
1832 if ($list[$i]->[1] =~ /^(maintainer|supporter)/i);
1837 if ($list[$i]->[1] =~ /^(author|commit|signer)/i);
1842 if ($list[$i]->[1] =~ /^(open list)/i);
1847 if ($list[$i]->[1] =~ /^(subscriber list)/i);
1852 $authored{$val - 1} = !$authored{$val - 1};
1862 $signed{$val - 1} = !$signed{$val - 1};
1948 by either commas or spaces.
1957 print STDERR "git-blame can be very slow, please have patience..."
1975 sub bool_invert {
1985 sub deduplicate_email {
1998 $name = $deduplicate_name_hash{lc($name)}->[0];
1999 $address = $deduplicate_name_hash{lc($name)}->[1];
2002 $name = $deduplicate_address_hash{lc($address)}->[0];
2003 $address = $deduplicate_address_hash{lc($address)}->[1];
2015 sub save_commits_by_author {
2048 sub save_commits_by_signer {
2085 sub vcs_assign {
2104 # uniq -c
2107 # sort -rn
2128 sub vcs_file_signoffs {
2200 sub vcs_file_blame {
2225 my $commit = join(" -r ", @commits);
2266 my $commit = join(" -r ", @commits);
2324 sub vcs_file_exists {
2342 sub vcs_list_files {
2359 sub uniq {
2367 sub sort_and_uniq {
2376 sub clean_file_emails {
2381 $email =~ s/[\(\<\{]{0,1}([A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+)[\)\>\}]{0,1}/\<$1\>/g;
2387 my @nw = split(/[^A-Za--ÿ\'\,\.\+-]/, $name);
2389 my $first = $nw[@nw - 3];
2390 my $middle = $nw[@nw - 2];
2391 my $last = $nw[@nw - 1];
2393 if (((length($first) == 1 && $first =~ m/[A-Za-z]/) ||
2394 (length($first) == 2 && substr($first, -1) eq ".")) ||
2396 (length($middle) == 2 && substr($middle, -1) eq "."))) {
2403 if (substr($name, -1) =~ /[,\.]/) {
2404 $name = substr($name, 0, length($name) - 1);
2405 } elsif (substr($name, -2) =~ /[,\.]"/) {
2406 $name = substr($name, 0, length($name) - 2) . '"';
2410 $name = substr($name, 1, length($name) - 1);
2412 $name = '"' . substr($name, 2, length($name) - 2);
2421 sub merge_email {
2440 sub output {
2455 sub make_rfc822re {
2462 my $controls = '\\000-\\037\\177';
2469 # Use zero-width assertion to spot the limit of an atom. A simple
2491 sub rfc822_strip_comments {
2494 # regexps in the Email Addressing FAQ are imperfect - they will miss escaped
2505 sub rfc822_valid {
2525 sub rfc822_validlist {