|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] get_maintainer.pl: Teach brace expansion
commit f60e7c65575cb2cc0a50e2a99c316d6197d29fd6
Author: Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Mon Jan 9 15:22:32 2017 +0000
Commit: Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Jan 10 10:21:59 2017 +0000
get_maintainer.pl: Teach brace expansion
Simpler non-nested brace expansion.
Some entries in the MAINTAINER are not understood by the script, the
ones that contain {,}. This patch fixes it.
This will convert brace expansion style use in MAINTAINER into a regex
that get_maintainer.pl can use to match a path again a maintainer
section.
It is done by using two different regex, the first one will take care of
converting ',' inside '{}' to a '|', one by one, as long as there is at
least two commas. The second regex will do the final convertion of '{,}'
to '(|)'.
With the patch, the right maintainers are displayed, instead of "THE
REST" maintainers, when using the following command for e.g.
$ ./scripts/get_maintainer.pl -f docs/misc/kconfig.txt
The patch also get rid of the warnings, with recent perl:
Unescaped left brace in regex is deprecated, passed through in regex;
marked by <-- HERE in m/^docs/misc/kconfig{ <-- HERE ,-language}\.txt/ at
./scripts/get_maintainer.pl line 731.
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Tested-by: Doug Goldstein <cardoe@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
scripts/get_maintainer.pl | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 9fda278..2804a5b 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -283,6 +283,13 @@ while (<$maint>) {
##Filename pattern matching
if ($type eq "F" || $type eq "X") {
+ # Bash brace expansion, not nested
+ # match {,*,*} and transform ',' to '|' one by one.
+ # While there is more than one ',', convert one to '|'.
+ while ($value =~
s/([^\\])\{(|[^},]*[^,\\]),((|[^},]*[^,\\]),(|[^}]*[^\\]))\}/$1\{$2|$3\}/g) {
+ }
+ $value =~ s/([^\\])\{(|[^},]*[^,\\]),(|[^}]*[^\\])\}/$1($2|$3)/g;
+
$value =~ s@\.@\\\.@g; ##Convert . to \.
$value =~ s/\*/\.\*/g; ##Convert * to .*
$value =~ s/\?/\./g; ##Convert ? to .
@@ -637,6 +644,12 @@ sub get_maintainers {
$line =~ s/([^\\])\.$/$1\?/g; ##Convert . back to ?
$line =~ s/\\\./\./g; ##Convert \. to .
$line =~ s/\.\*/\*/g; ##Convert .* to *
+ ## Convert (|) back to {,}
+ # match (|*|*) and transform '|' to ',' one by one
+ # While there is more than one '|', convert one to ','.
+ while ($line =~
s/([^\\])\((|[^)|]*[^|\\])\|((|[^)|]*[^|\\])\|(|[^)]*[^\\]))\)/$1($2,$3)/g) {
+ }
+ $line =~
s/([^\\])\((|[^)|]*[^|\\])\|(|[^)]*[^\\])\)/$1\{$2,$3\}/g;
}
$line =~ s/^([A-Z]):/$1:\t/g;
print("$line\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |