doc: Sort man page entries in AdminRef

The AdminRef is a collection of OpenAFS man pages in a single document.
Unfortunately, the man pages are not listed in any particular order, but
rather just the order found by reading the unsorted directory entries.

Change the generate-xml script so the man pages are in sorted order in
the generated AdminRef document.  Instead of writing the man page
references after processing each page, save each entry in a list, and
then sort the list after all the pages have been processed.

Also, check the exit code of the pod2refentry script so errors are not
ignored while generating the AdminRef document.

Change-Id: I624485e4efd1fb0c08642b379a12c946f5793336
Reviewed-on: https://gerrit.openafs.org/15827
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
This commit is contained in:
Michael Meffie 2024-08-08 14:40:28 -04:00
parent 1bcc1e54a5
commit 6ff968264f

View File

@ -11,10 +11,10 @@ open(ENTITIES, ">entities.dtd") || die;
foreach $section (@sections) {
printf "generating section %s...\n", $section;
my @entities = ();
mkdir(sprintf "sect%d", $section);
opendir($DIR, sprintf "%s/pod%d", $doc_man_pages, $section) || die;
open(SECT, sprintf ">sect%d.xml", $section) || die;
while ($podfile = readdir($DIR)) {
next unless $podfile =~ /\.pod$/;
@ -23,14 +23,24 @@ foreach $section (@sections) {
printf "pod2refentry < %s > %s\n", $podfile, $xmlfile;
system(sprintf "./pod2refentry --section=%d < %s/pod%d/%s > sect%d/%s",
my $rc = system(sprintf "./pod2refentry --section=%d < %s/pod%d/%s > sect%d/%s",
$section, $doc_man_pages, $section, $podfile, $section, $xmlfile);
if ($rc != 0) {
die "Failed to generate sect${section}/${xmlfile}: $rc\n";
}
printf ENTITIES "<!ENTITY %s%s SYSTEM \"sect%d/%s\">\n",
$entity, $section, $section, $xmlfile;
printf SECT "&%s%s;\n", $entity, $section;
push(@entities, $entity);
}
closedir($DIR);
open(SECT, sprintf ">sect%d.xml", $section) || die;
foreach $entity (sort(@entities)) {
printf SECT "&%s%s;\n", $entity, $section;
}
close(SECT);
}