Flag to get_pod_metadata() whether generated files are expected.
authorNicholas Clark <nick@ccl4.org>
Wed, 9 Nov 2011 16:25:57 +0000 (17:25 +0100)
committerNicholas Clark <nick@ccl4.org>
Fri, 18 Nov 2011 10:08:58 +0000 (11:08 +0100)
This permits Porting/pod_rules.pl to be run from a clean checkout without
warning, which simplifies updating perl's version.

Porting/pod_lib.pl
Porting/pod_rules.pl
pod/buildtoc

index 684b494..6caeb19 100644 (file)
@@ -19,6 +19,8 @@ sub open_or_die {
 }
 
 sub get_pod_metadata {
+    # Do we expect to find generated pods on disk?
+    my $permit_missing_generated = shift;
     my %BuildFiles;
 
     foreach my $path (@_) {
@@ -162,6 +164,14 @@ sub get_pod_metadata {
     my_die "could not find the pod listing of perl.pod\n"
         unless %perlpods;
 
+    # Are we running before known generated files have been generated?
+    # (eg in a clean checkout)
+    my %not_yet_there;
+    if ($permit_missing_generated) {
+        # If so, don't complain if these files aren't yet in place
+        %not_yet_there = (%manireadmes, %{$state{generated}}, %{$state{copies}})
+    }
+
     my @inconsistent;
     foreach my $i (sort keys %disk_pods) {
         push @inconsistent, "$0: $i exists but is unknown by buildtoc\n"
@@ -174,7 +184,7 @@ sub get_pod_metadata {
     }
     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};
+            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"
@@ -184,7 +194,8 @@ sub get_pod_metadata {
     }
     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};
+            unless $disk_pods{$i} or $BuildFiles{$i} or $cpanpods_leaf{$i}
+                or $not_yet_there{$i};
     }
     $state{inconsistent} = \@inconsistent;
     return \%state;
index d7b7842..35e26c9 100644 (file)
@@ -62,7 +62,7 @@ if ($Verbose) {
     print "I will be building $_\n" foreach keys %Build;
 }
 
-my $state = get_pod_metadata();
+my $state = get_pod_metadata(!$Test);
 
 my $test = 1;
 if ($Test) {
index ef7cbb0..4058181 100644 (file)
@@ -21,7 +21,7 @@ BEGIN {
 die "$0: Usage: $0 [--quiet]\n"
     unless GetOptions (quiet => \$Quiet) && !@ARGV;
 
-my $state = get_pod_metadata('pod/perltoc.pod');
+my $state = get_pod_metadata(0, 'pod/perltoc.pod');
 
 warn @{$state->{inconsistent}} if @{$state->{inconsistent}};