Skip to content

Commit

Permalink
scripts/documentation-file-ref-check: add a fix logic for DT
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Jonathan Corbet <[email protected]>
  • Loading branch information
mchehab committed Jun 15, 2018
1 parent 5044024 commit be600e5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions scripts/documentation-file-ref-check
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ while (<IN>) {
next if (grep -e, glob("$ref $fulref"));

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

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

$f = qx(find . -iname $new) if ($new);
# usual reason for breakage: DT file moved around
if ($ref =~ /devicetree/) {
my $search = $new;
$search =~ s,^.*/,,;
$f = qx(find Documentation/devicetree/ -iname "*$search*") if ($search);
if (!$f) {
# Manufacturer name may have changed
$search =~ s/^.*,//;
$f = qx(find Documentation/devicetree/ -iname "*$search*") if ($search);
}
}

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

# Wild guess: seek for the same name on another place
if (!$f) {
$f = qx(find . -iname $new) if ($new);
}

my @find = split /\s+/, $f;

if (!$f) {
Expand Down

0 comments on commit be600e5

Please sign in to comment.