doc: fix build-docdep.perl

We renamed from .txt to .adoc all the asciidoc source files and
necessary includes.  We also need to adjust the build-docdep tool to
work on files whose suffix is .adoc when computing the documentation
dependencies.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2025-03-01 10:25:10 -08:00
parent 561de07b57
commit 06d9252bcc

View File

@ -4,15 +4,15 @@
my %include = (); my %include = ();
my %included = (); my %included = ();
for my $text (<*.txt>) { for my $adoc (<*.adoc>) {
open I, '<', $text || die "cannot read: $text"; open I, '<', $adoc || die "cannot read: $adoc";
while (<I>) { while (<I>) {
if (/^include::/) { if (/^include::/) {
chomp; chomp;
s/^include::\s*//; s/^include::\s*//;
s/\[\]//; s/\[\]//;
s/{build_dir}/${build_dir}/; s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1; $include{$adoc}{$_} = 1;
$included{$_} = 1; $included{$_} = 1;
} }
} }
@ -23,14 +23,14 @@
my $changed = 1; my $changed = 1;
while ($changed) { while ($changed) {
$changed = 0; $changed = 0;
while (my ($text, $included) = each %include) { while (my ($adoc, $included) = each %include) {
for my $i (keys %$included) { for my $i (keys %$included) {
# $text has include::$i; if $i includes $j # $adoc has include::$i; if $i includes $j
# $text indirectly includes $j. # $adoc indirectly includes $j.
if (exists $include{$i}) { if (exists $include{$i}) {
for my $j (keys %{$include{$i}}) { for my $j (keys %{$include{$i}}) {
if (!exists $include{$text}{$j}) { if (!exists $include{$adoc}{$j}) {
$include{$text}{$j} = 1; $include{$adoc}{$j} = 1;
$included{$j} = 1; $included{$j} = 1;
$changed = 1; $changed = 1;
} }
@ -40,10 +40,10 @@
} }
} }
foreach my $text (sort keys %include) { foreach my $adoc (sort keys %include) {
my $included = $include{$text}; my $included = $include{$adoc};
if (! exists $included{$text} && if (! exists $included{$adoc} &&
(my $base = $text) =~ s/\.txt$//) { (my $base = $adoc) =~ s/\.adoc$//) {
print "$base.html $base.xml : ", join(" ", sort keys %$included), "\n"; print "$base.html $base.xml : ", join(" ", sort keys %$included), "\n";
} }
} }