Commit 0a0dfdb2f9634272f1f1b3ec96e299613c3911c1

Ryan C. Gordon 2023-02-28T12:26:31

wikiheaders: Sort pages before listing them in README/FrontPage.md. (cherry picked from commit 99c38268cd1325bb64739217adbeebaae7ae6a84)

diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl
index 2927e6d..a20b208 100755
--- a/build-scripts/wikiheaders.pl
+++ b/build-scripts/wikiheaders.pl
@@ -1387,19 +1387,24 @@ if ($copy_direction == 1) {  # --copy-to-headers
             }
             closedir(DH);
 
-            open(FH, '>', "$wikireadmepath/FrontPage.md") or die("Can't open '$wikireadmepath/FrontPage.md': $!\n");
-            print FH "# All READMEs available here\n\n";
-
+            my @pages = ();
             opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n");
             while (readdir(DH)) {
                 my $dent = $_;
                 if ($dent =~ /\A(.*?)\.(mediawiki|md)\Z/) {
                     my $wikiname = $1;
                     next if $wikiname eq 'FrontPage';
-                    print FH "- [$wikiname]($wikiname)\n";
+                    push @pages, $wikiname;
                 }
             }
             closedir(DH);
+
+            open(FH, '>', "$wikireadmepath/FrontPage.md") or die("Can't open '$wikireadmepath/FrontPage.md': $!\n");
+            print FH "# All READMEs available here\n\n";
+            foreach (sort @pages) {
+                my $wikiname = $_;
+                print FH "- [$wikiname]($wikiname)\n";
+            }
             close(FH);
         }
     }