aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/documentation-file-ref-check
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-05-29 19:09:27 -0400
committerJonathan Corbet <corbet@lwn.net>2019-05-30 12:40:24 -0400
commit9e78e7fc0b20bcc0d5599f71d297b6fa1a2e7c5f (patch)
treefe898099383a5261bc112268940f3388ab0019b0 /scripts/documentation-file-ref-check
parent9b88ad5464af1bf7228991f1c46a9a13484790a4 (diff)
scripts/documentation-file-ref-check: better handle translations
Only seek for translation renames inside the translation directory. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/documentation-file-ref-check')
-rwxr-xr-xscripts/documentation-file-ref-check10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check
index 63e9542656f1..6b622b88f4cf 100755
--- a/scripts/documentation-file-ref-check
+++ b/scripts/documentation-file-ref-check
@@ -141,6 +141,10 @@ print "Auto-fixing broken references. Please double-check the results\n";
141foreach my $ref (keys %broken_ref) { 141foreach my $ref (keys %broken_ref) {
142 my $new =$ref; 142 my $new =$ref;
143 143
144 my $basedir = ".";
145 # On translations, only seek inside the translations directory
146 $basedir = $1 if ($ref =~ m,(Documentation/translations/[^/]+),);
147
144 # get just the basename 148 # get just the basename
145 $new =~ s,.*/,,; 149 $new =~ s,.*/,,;
146 150
@@ -161,18 +165,18 @@ foreach my $ref (keys %broken_ref) {
161 # usual reason for breakage: file renamed to .rst 165 # usual reason for breakage: file renamed to .rst
162 if (!$f) { 166 if (!$f) {
163 $new =~ s/\.txt$/.rst/; 167 $new =~ s/\.txt$/.rst/;
164 $f=qx(find . -iname $new) if ($new); 168 $f=qx(find $basedir -iname $new) if ($new);
165 } 169 }
166 170
167 # usual reason for breakage: use dash or underline 171 # usual reason for breakage: use dash or underline
168 if (!$f) { 172 if (!$f) {
169 $new =~ s/[-_]/[-_]/g; 173 $new =~ s/[-_]/[-_]/g;
170 $f=qx(find . -iname $new) if ($new); 174 $f=qx(find $basedir -iname $new) if ($new);
171 } 175 }
172 176
173 # Wild guess: seek for the same name on another place 177 # Wild guess: seek for the same name on another place
174 if (!$f) { 178 if (!$f) {
175 $f = qx(find . -iname $new) if ($new); 179 $f = qx(find $basedir -iname $new) if ($new);
176 } 180 }
177 181
178 my @find = split /\s+/, $f; 182 my @find = split /\s+/, $f;