From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 061DE1F953 for ; Tue, 9 Nov 2021 00:20:51 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] build: do not repeatedly build some docs Date: Tue, 9 Nov 2021 00:20:50 +0000 Message-Id: <20211109002050.6854-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 | 14 +++++++++----- Documentation/txt2pre | 6 ------ Makefile.PL | 11 ++++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Documentation/common.perl b/Documentation/common.perl index 5fdbe8da..3a6617c4 100755 --- a/Documentation/common.perl +++ b/Documentation/common.perl @@ -34,11 +34,15 @@ L ^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 { diff --git a/Documentation/txt2pre b/Documentation/txt2pre index 04bc3b0e..3ecd9100 100755 --- a/Documentation/txt2pre +++ b/Documentation/txt2pre @@ -177,9 +177,3 @@ print '', "$title", "
",  $str , '
'; 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); -} diff --git a/Makefile.PL b/Makefile.PL index c0aef488..cde6194b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -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)];