scripts/documentation-file-ref-check: teach about .txt -> .yaml renames
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 29 May 2019 23:09:30 +0000 (20:09 -0300)
committerJonathan Corbet <corbet@lwn.net>
Thu, 30 May 2019 16:40:24 +0000 (10:40 -0600)
At DT, files are being renamed to jason. Teach the script how to
handle such renames when used in fix mode.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
scripts/documentation-file-ref-check

index 5d775ca7469b2dcae8ba108d79e4d40066466f0e..ff16db2690793ea43ac7fe06e7c971121b3bfab8 100755 (executable)
@@ -165,13 +165,22 @@ foreach my $ref (keys %broken_ref) {
 
        # 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);
+               # usual reason for breakage: DT file renamed to .yaml
                if (!$f) {
-                       # Manufacturer name may have changed
-                       $search =~ s/^.*,//;
+                       my $new_ref = $ref;
+                       $new_ref =~ s/\.txt$/.yaml/;
+                       $f=$new_ref if (-f $new_ref);
+               }
+
+               if (!$f) {
+                       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);
+                       }
                }
        }