[svn:parrot] r42355 - branches/pmc_headers_move/tools/dev

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Nov 8 09:11:53 UTC 2009


Author: bacek
Date: Sun Nov  8 09:11:53 2009
New Revision: 42355
URL: https://trac.parrot.org/parrot/changeset/42355

Log:
Fix checkdepends.pl script to handle includes little bit more correctly.

Modified:
   branches/pmc_headers_move/tools/dev/checkdepend.pl

Modified: branches/pmc_headers_move/tools/dev/checkdepend.pl
==============================================================================
--- branches/pmc_headers_move/tools/dev/checkdepend.pl	Sun Nov  8 08:45:59 2009	(r42354)
+++ branches/pmc_headers_move/tools/dev/checkdepend.pl	Sun Nov  8 09:11:53 2009	(r42355)
@@ -22,7 +22,8 @@
 
 =cut
 
-my $files = `ack -fa . | grep '\\.c\$'`;
+# TODO Unskip pmc generated files.
+my $files = `ack -fa . | grep '\\.c\$' | grep -v 'src/pmc/'`;
 
 my %deps;
 
@@ -48,6 +49,7 @@
 }
 $rules =~ s/\\\n/ /g;
 $rules =~ s/\Q$(SRC_DIR)\E/src/g;
+$rules =~ s/\Q$(PMC_INC_DIR)\E/include/g;
 $rules =~ s/\Q$(O)\E//g;
 
 foreach my $file (keys %deps) {
@@ -61,23 +63,25 @@
     {
         $declared =~ s/\s+/ /g;
         foreach my $inc (@{$deps{$file}}) {
+            # Skip #include "parrot/foo.h". It's in GENERAL_H_FILES rule.
+            next if $inc =~ m{^parrot/}o;
+
             # incs can be relative, but makefile is from top level
             my $file_dir = (File::Spec->splitpath($file))[1];
             my $make_dep = collapse_path(File::Spec->catfile($file_dir,$inc));
 
-            if (! defined $make_dep) {
-                # this means we didn't construct the right relative path.
-                # probably looking in include/ instead of  .
-                diag "skipping $inc...\n";
-                next;
-            }
-
-            if ($declared !~ /\b\Q$make_dep\E\b/) {
-              # this isn't the actual comparison, just to give nice output
-              # on failure.
-              is($declared,$inc,$file);
-              $failed = 1;
-            }
+            # If it's include from src
+            next if defined($make_dep) && ($declared =~ /\b\Q$make_dep\E\b/);
+
+            # Try to costruct "global" include
+            $make_dep = collapse_path(File::Spec->catfile('include', $inc));
+            next if defined($make_dep) && ($declared =~ /\b\Q$make_dep\E\b/);
+
+            # this isn't the actual comparison, just to give nice output
+            # on failure.
+            diag "make_dep $make_dep\n";
+            is($inc, $declared, $file);
+            $failed = 1;
         }
     }
     pass("$file has proper deps") unless $failed;


More information about the parrot-commits mailing list