From 98ef295c9b1d6bf05ecfc8d4c1e3f6ee5bd226d5 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 16 Aug 2014 11:56:21 +0000 Subject: [PATCH] check-help-strings.pl: work better when running in a subdir The script used to get confused if you ran it in a subdir of the OMPI tree (e.g., it would report help files not found if source code referred to a help file that was not under the subdir in which it was run). Now the script searches the whole tree for help files, but only analyzes the source from the subdir in which it was started. Meaning: it should always find all help files, and won't get confused like it did before. This commit was SVN r32548. --- contrib/check-help-strings.pl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/contrib/check-help-strings.pl b/contrib/check-help-strings.pl index 619f1a6e2d..97607c3cb3 100755 --- a/contrib/check-help-strings.pl +++ b/contrib/check-help-strings.pl @@ -117,7 +117,11 @@ sub match_files { # Find all source and help files print "Searching for source and help files...\n"; -print "Starting in: $start\n"; +my $startrel = $start; +if ($top ne $start) { + $startrel =~ s/^$top//; + $startrel =~ s/^\///; +} find(\&match_files, "."); ########################################################################### @@ -126,7 +130,7 @@ find(\&match_files, "."); my $help_topics; my $help_file_refs; -print "Indexing help files...\n"; +print "Indexing help files (from entire source tree)...\n"; foreach my $info (@help_files) { verbose("Indexing help: $info->{full}\n"); @@ -175,7 +179,11 @@ foreach my $info (@help_files) { # Search source files for calls to opal_show_help and (o)rte_show_help -print "Searching source files...\n"; +if ($start eq $top) { + print "Searching source files (from entire source tree)...\n"; +} else { + print "Searching source files (under $startrel)...\n"; +} # Helper: for a given filename/topic, see if it exists sub check_file_topic { @@ -235,6 +243,10 @@ sub check_name { foreach my $info (@source_files) { verbose("Searching source: $info->{full}\n"); + # If this source file is not in the target area, then skip it + next + if ($info->{relative} != /^$startrel/); + my $src; open(FH, $info->{full}) || die "Can't open $info->{full}"; while () {