This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Porting/pod_rules.pl should not warn about files that it is rebuilding.
authorNicholas Clark <nick@ccl4.org>
Thu, 10 Nov 2011 10:18:06 +0000 (11:18 +0100)
committerNicholas Clark <nick@ccl4.org>
Fri, 18 Nov 2011 10:08:58 +0000 (11:08 +0100)
Previously it would generate warnings about inconsistencies in files, even if
it was about to rewrite the file to be consistent.

Porting/pod_lib.pl
Porting/pod_rules.pl

index 0d7755b..25e33d5 100644 (file)
@@ -196,25 +196,34 @@ sub get_pod_metadata {
         push @inconsistent, "$0: $i exists but is unknown by buildtoc\n"
             unless $our_pods{$i};
         push @inconsistent, "$0: $i exists but is unknown by MANIFEST\n"
-            if !$manipods{$i} && !$manireadmes{$i} && !$state{copies}{$i}
-                && !$state{generated}{$i} && !$cpanpods{$i};
+            if !$BuildFiles{'MANIFEST'} # Ignore if we're rebuilding MANIFEST
+                && !$manipods{$i} && !$manireadmes{$i} && !$state{copies}{$i}
+                    && !$state{generated}{$i} && !$cpanpods{$i};
         push @inconsistent, "$0: $i exists but is unknown by perl.pod\n"
-            if !$perlpods{$i} && !exists $state{copies}{$i} && !$cpanpods{$i} && !$ignoredpods{$i};
+            if !$BuildFiles{'perl.pod'} # Ignore if we're rebuilding perl.pod
+                && !$perlpods{$i} && !exists $state{copies}{$i}
+                    && !$cpanpods{$i} && !$ignoredpods{$i};
     }
     foreach my $i (sort keys %our_pods) {
         push @inconsistent, "$0: $i is known by buildtoc but does not exist\n"
             unless $disk_pods{$i} or $BuildFiles{$i} or $not_yet_there{$i};
     }
-    foreach my $i (sort keys %manipods) {
-        push @inconsistent, "$0: $i is known by MANIFEST but does not exist\n"
-            unless $disk_pods{$i};
-        push @inconsistent, "$0: $i is known by MANIFEST but is marked as generated\n"
-            if $state{generated}{$i};
+    unless ($BuildFiles{'MANIFEST'}) {
+        # Again, ignore these if we're about to rebuild MANIFEST
+        foreach my $i (sort keys %manipods) {
+            push @inconsistent, "$0: $i is known by MANIFEST but does not exist\n"
+                unless $disk_pods{$i};
+            push @inconsistent, "$0: $i is known by MANIFEST but is marked as generated\n"
+                if $state{generated}{$i};
+        }
     }
-    foreach my $i (sort keys %perlpods) {
-        push @inconsistent, "$0: $i is known by perl.pod but does not exist\n"
-            unless $disk_pods{$i} or $BuildFiles{$i} or $cpanpods_leaf{$i}
-                or $not_yet_there{$i};
+    unless ($BuildFiles{'perl.pod'}) {
+        # Again, ignore these if we're about to rebuild perl.pod
+        foreach my $i (sort keys %perlpods) {
+            push @inconsistent, "$0: $i is known by perl.pod but does not exist\n"
+                unless $disk_pods{$i} or $BuildFiles{$i} or $cpanpods_leaf{$i}
+                    or $not_yet_there{$i};
+        }
     }
     $state{inconsistent} = \@inconsistent;
     return \%state;
index 35e26c9..8be1468 100644 (file)
@@ -62,7 +62,10 @@ if ($Verbose) {
     print "I will be building $_\n" foreach keys %Build;
 }
 
-my $state = get_pod_metadata(!$Test);
+# For testing, generated files must be present and we're rebuilding nothing.
+# For normal rebuilding, generated files may not be present, and we mute
+# warnings about inconsistencies in any file we're about to rebuild.
+my $state = get_pod_metadata($Test ? () : (1, values %Build));
 
 my $test = 1;
 if ($Test) {