aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/documentation-file-ref-check
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-06-14 08:36:35 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-06-15 17:10:01 -0400
commitbe600e5ac79fb5f6c8839d6a48d89fc2b917f0c7 (patch)
treeb6c1e5086b33a26252527efe810295bfbd3f5197 /scripts/documentation-file-ref-check
parent50440240021ca3cefe376fa11a7ae085734f165a (diff)
scripts/documentation-file-ref-check: add a fix logic for DT
There are several links broken due to DT file movements. Add a hint logic to seek for those changes. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/documentation-file-ref-check')
-rwxr-xr-xscripts/documentation-file-ref-check20
1 files changed, 17 insertions, 3 deletions
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check
index 9d5e21b10346..c8bc1c1c1d6e 100755
--- a/scripts/documentation-file-ref-check
+++ b/scripts/documentation-file-ref-check
@@ -64,7 +64,7 @@ while (<IN>) {
64 next if (grep -e, glob("$ref $fulref")); 64 next if (grep -e, glob("$ref $fulref"));
65 65
66 if ($fix) { 66 if ($fix) {
67 if (!($ref =~ m/(devicetree|scripts|Kconfig|Kbuild)/)) { 67 if (!($ref =~ m/(scripts|Kconfig|Kbuild)/)) {
68 $broken_ref{$ref}++; 68 $broken_ref{$ref}++;
69 } 69 }
70 } else { 70 } else {
@@ -84,10 +84,19 @@ foreach my $ref (keys %broken_ref) {
84 # get just the basename 84 # get just the basename
85 $new =~ s,.*/,,; 85 $new =~ s,.*/,,;
86 86
87 # Seek for the same name on another place, as it may have been moved
88 my $f=""; 87 my $f="";
89 88
90 $f = qx(find . -iname $new) if ($new); 89 # usual reason for breakage: DT file moved around
90 if ($ref =~ /devicetree/) {
91 my $search = $new;
92 $search =~ s,^.*/,,;
93 $f = qx(find Documentation/devicetree/ -iname "*$search*") if ($search);
94 if (!$f) {
95 # Manufacturer name may have changed
96 $search =~ s/^.*,//;
97 $f = qx(find Documentation/devicetree/ -iname "*$search*") if ($search);
98 }
99 }
91 100
92 # usual reason for breakage: file renamed to .rst 101 # usual reason for breakage: file renamed to .rst
93 if (!$f) { 102 if (!$f) {
@@ -95,6 +104,11 @@ foreach my $ref (keys %broken_ref) {
95 $f=qx(find . -iname $new) if ($new); 104 $f=qx(find . -iname $new) if ($new);
96 } 105 }
97 106
107 # Wild guess: seek for the same name on another place
108 if (!$f) {
109 $f = qx(find . -iname $new) if ($new);
110 }
111
98 my @find = split /\s+/, $f; 112 my @find = split /\s+/, $f;
99 113
100 if (!$f) { 114 if (!$f) {