]> Sergey Matveev's repositories - public-inbox.git/commitdiff
build: do not repeatedly build some docs
authorEric Wong <e@80x24.org>
Tue, 9 Nov 2021 00:20:50 +0000 (00:20 +0000)
committerEric Wong <e@80x24.org>
Tue, 9 Nov 2021 00:43:37 +0000 (00:43 +0000)
Text versions of manpages do not need to be generated for normal
installations, they're only used for generating HTML and our
amazing, award-winning homepage.

We'll also rely on touch(1) instead of Perl utime to benefit
users w/o git-set-file-times in txt2pre.  Perl numeric values
cannot represent nanosecond resolution accurately even with
Time::HiRes; which causes nanosecond-aware make(1)
implementations to repeatedly rebuild.

Documentation/common.perl
Documentation/txt2pre
Makefile.PL

index 5fdbe8da055efd13f6a8d41cf54a5278ebf85c4c..3a6617c474304ab598ac85964be00f27861aeef3 100755 (executable)
@@ -34,11 +34,15 @@ L<http://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/meta/>
                        ^AUTO-GENERATED-SEARCH-TERMS-END\n
                        !search_terms()!emsx;
        $s =~ s/[ \t]+$//sgm;
-       next if $s eq $orig;
-       seek($fh, 0, SEEK_SET) or die "seek: $!";
-       truncate($fh, 0) or die "truncate: $!";
-       print $fh $s or die "print: $!";
-       close $fh or die "close: $!";
+       if ($s eq $orig) {
+               my $t = time;
+               utime($t, $t, $fh);
+       } else {
+               seek($fh, 0, SEEK_SET) or die "seek: $!";
+               truncate($fh, 0) or die "truncate: $!";
+               print $fh $s or die "print: $!";
+               close $fh or die "close: $!";
+       }
 }
 
 sub search_terms {
index 04bc3b0e3921e77e440f97f7b2a2b92c71bb1f8d..3ecd9100815dc69eb227444d988ed9dffe755ef1 100755 (executable)
@@ -177,9 +177,3 @@ print '<html><head>',
   "<title>$title</title>",
   "</head><body><pre>",  $str , '</pre></body></html>';
 STDOUT->flush;
-
-# keep mtime on website consistent so clients can cache
-if (-f STDIN && -f STDOUT) {
-       my @st = stat(STDIN);
-       utime($st[8], $st[9], \*STDOUT);
-}
index c0aef4880baf9c8481d21d1e3c7d879321b40e9f..cde6194bc54a494ea53b90bf0e607eee79214eba 100644 (file)
@@ -23,7 +23,7 @@ push @dtxt, @{$v->{txt}};
 for my $txt (@dtxt) {
        my $html = $txt;
        $html =~ s/\.txt\z/.html/ or $html .= '.html';
-       $t->{"$html : $txt"} = [ "\$(txt2pre) <$txt" ];
+       $t->{"$html : $txt"} = [ "\$(txt2pre) <$txt", "touch -r $txt \$@" ];
 }
 $v->{t_slash_star_dot_t} = [ grep(m!\At/.*\.t\z!, @manifest) ];
 my @scripts = qw(scripts/ssoma-replay); # legacy
@@ -74,9 +74,10 @@ for my $i (@sections) {
                my $txt = "Documentation/$m.txt";
                $t->{"$m.$i : $pod"} = [ "\$(podman) -s$i $pod \$@" ];
                $t->{"$txt : $m.$i"} = [ "\$(man2text) ./$m.$i >\$\@+",
-                                       "touch -r $pod \$\@+",
+                                       "touch -r $pod \$\@+ ./$m.$i",
                                        "mv \$\@+ \$@" ];
-               $t->{"Documentation/$m.html : $txt"} = [ "\$(txt2pre) <$txt" ];
+               $t->{"Documentation/$m.html : $txt"} = [ "\$(txt2pre) <$txt",
+                                                       "touch -r $txt \$@" ];
                $t->{".$m.cols : $m.$i"} = [
                        "\@echo CHECK80 $m.$i;".
                        "COLUMNS=80 \$(MAN) ./$m.$i | \$(check_man)",
@@ -91,13 +92,13 @@ for my $i (@sections) {
        push @{$v->{manuals}}, @$manuals;
        push @{$v->{mantxt}}, map { "Documentation/$_.txt" } @$ary;
 }
-push @dtxt, @{$v->{mantxt}};
+push @dtxt;
 $v->{docs} = [ @dtxt, 'NEWS' ];
 $v->{docs_html} = [ map {;
                my $x = $_;
                $x =~ s/\.txt\z//;
                "$x.html"
-       } @{$v->{docs}} ];
+       } (@{$v->{docs}}, @{$v->{mantxt}}) ];
 $v->{gz_docs} = [ map { "$_.gz" } (@{$v->{docs}},@{$v->{docs_html}}) ];
 $v->{rsync_docs} = [ @{$v->{gz_docs}}, @{$v->{docs}},
        @{$v->{docs_html}}, qw(NEWS.atom NEWS.atom.gz)];