Skip to content

Commit be600e5

Browse files
committed
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>
1 parent 5044024 commit be600e5

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

scripts/documentation-file-ref-check

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ while (<IN>) {
6464
next if (grep -e, glob("$ref $fulref"));
6565

6666
if ($fix) {
67-
if (!($ref =~ m/(devicetree|scripts|Kconfig|Kbuild)/)) {
67+
if (!($ref =~ m/(scripts|Kconfig|Kbuild)/)) {
6868
$broken_ref{$ref}++;
6969
}
7070
} else {
@@ -84,17 +84,31 @@ foreach my $ref (keys %broken_ref) {
8484
# get just the basename
8585
$new =~ s,.*/,,;
8686

87-
# Seek for the same name on another place, as it may have been moved
8887
my $f="";
8988

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+
}
91100

92101
# usual reason for breakage: file renamed to .rst
93102
if (!$f) {
94103
$new =~ s/\.txt$/.rst/;
95104
$f=qx(find . -iname $new) if ($new);
96105
}
97106

107+
# Wild guess: seek for the same name on another place
108+
if (!$f) {
109+
$f = qx(find . -iname $new) if ($new);
110+
}
111+
98112
my @find = split /\s+/, $f;
99113

100114
if (!$f) {

0 commit comments

Comments
 (0)