From 9ceb10d38b20421548f36b6b95a53eb091571f39 Mon Sep 17 00:00:00 2001 From: ThomasBreuer Date: Fri, 8 Nov 2024 23:58:52 +0100 Subject: [PATCH 1/4] set an exit code in `make_doc` For that, - redirect the `Info` output generated by GAPDoc functions to a string, - extract the messages that describe warnings; according to frankluebeck/GAPDoc/commit/826c091491438c1f6ba1f330d17914f45b4bd3af, these are the lines starting with `"#W "`, - omit the LaTeX warnings about overfull boxes (I think we do not want to force ourselves to create manuals without these warning), - report failure if the set of remaining warnings is nonempty. --- doc/make_doc.in | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/doc/make_doc.in b/doc/make_doc.in index 4486ae3656..11f77c5844 100644 --- a/doc/make_doc.in +++ b/doc/make_doc.in @@ -19,6 +19,11 @@ base:="@abs_top_srcdir@";; books:=["ref", "tut", "hpc", "dev"];; latexOpts := rec(Maintitlesize := "\\\\fontsize{36}{38}\\\\selectfont");; UpdateXMLForUserPreferences(); +outputstring:= "";; +outputstream:= OutputTextString(outputstring, true);; +SetPrintFormattingStatus(outputstream, false); +SetInfoOutput(InfoGAPDoc, outputstream); +SetInfoOutput(InfoWarning, outputstream); for run in [1,2] do for book in books do path := Concatenation(base, "/doc/", book); @@ -29,10 +34,10 @@ for run in [1,2] do continue; fi; - Print("----------------------------\n"); - Print("Building GAP manual '",book,"' at ",path,"\n"); - Print("Run ",run," of 2\n"); - Print("----------------------------\n"); + AppendTo(outputstream, "----------------------------\n"); + AppendTo(outputstream, "Building GAP manual '",book,"' at ",path,"\n"); + AppendTo(outputstream, "Run ",run," of 2\n"); + AppendTo(outputstream, "----------------------------\n"); # for the reference manual, extra list of source files to scan if book = "ref" then @@ -66,4 +71,12 @@ for run in [1,2] do MakeGAPDocDoc( path, "main.xml", files, book, "../..", "MathJax" $NOPDF);; od; od; +CloseStream(outputstream); +UnbindInfoOutput(InfoGAPDoc); +UnbindInfoOutput(InfoWarning); +Print(outputstring); +outputstring:= ReplacedString(outputstring, "\c", "");; +errors:= Filtered(SplitString(outputstring, "\n"), + x -> StartsWith(x, "#W ") and x <> "#W There are overfull boxes:");; +QuitGap(Length(errors) = 0); EOF From 51a6ee26352798c4aac2ad993527041ffd6f1221 Mon Sep 17 00:00:00 2001 From: ThomasBreuer Date: Sun, 10 Nov 2024 00:57:14 +0100 Subject: [PATCH 2/4] show the errors if there are some (Funny. I got exit code 0 locally before this change.) --- doc/make_doc.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/make_doc.in b/doc/make_doc.in index 11f77c5844..8ccecc4255 100644 --- a/doc/make_doc.in +++ b/doc/make_doc.in @@ -78,5 +78,10 @@ Print(outputstring); outputstring:= ReplacedString(outputstring, "\c", "");; errors:= Filtered(SplitString(outputstring, "\n"), x -> StartsWith(x, "#W ") and x <> "#W There are overfull boxes:");; -QuitGap(Length(errors) = 0); +if Length(errors) = 0 then + QuitGap(true); +else + Print(errors, "\n"); + QuitGap(false); +fi; EOF From 00294a068261e4e9f50359d61efdc9bc0527158f Mon Sep 17 00:00:00 2001 From: ThomasBreuer Date: Sun, 10 Nov 2024 09:39:48 +0100 Subject: [PATCH 3/4] call GAP with the `-r` option in `make_doc` This way, create the documentation w.r.t. the installed GAP without private packages; this is useful for debugging. --- doc/make_doc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/make_doc.in b/doc/make_doc.in index 8ccecc4255..dd49619780 100644 --- a/doc/make_doc.in +++ b/doc/make_doc.in @@ -4,7 +4,7 @@ set -e set -o pipefail GAP=@abs_top_builddir@/gap -GAPARGS="-b -m 1g -x 80 -q --quitonbreak" +GAPARGS="-b -m 1g -x 80 -q --quitonbreak -r" if [ "$1" == "nopdf" ]; then NOPDF=", \"nopdf\"" else From 5a34c53f98fa0746b082210e2efe6b081d6cd312 Mon Sep 17 00:00:00 2001 From: ThomasBreuer Date: Sun, 10 Nov 2024 09:47:31 +0100 Subject: [PATCH 4/4] collect output messages separately in both runs (but print it for both runs, as in earlier times) --- doc/make_doc.in | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/make_doc.in b/doc/make_doc.in index dd49619780..ac535332e4 100644 --- a/doc/make_doc.in +++ b/doc/make_doc.in @@ -19,12 +19,14 @@ base:="@abs_top_srcdir@";; books:=["ref", "tut", "hpc", "dev"];; latexOpts := rec(Maintitlesize := "\\\\fontsize{36}{38}\\\\selectfont");; UpdateXMLForUserPreferences(); -outputstring:= "";; -outputstream:= OutputTextString(outputstring, true);; -SetPrintFormattingStatus(outputstream, false); -SetInfoOutput(InfoGAPDoc, outputstream); -SetInfoOutput(InfoWarning, outputstream); for run in [1,2] do + # collect output messages separately in both runs + outputstring:= "";; + outputstream:= OutputTextString(outputstring, true);; + SetPrintFormattingStatus(outputstream, false); + SetInfoOutput(InfoGAPDoc, outputstream); + SetInfoOutput(InfoWarning, outputstream); + for book in books do path := Concatenation(base, "/doc/", book); dir := Directory(path); @@ -70,11 +72,14 @@ for run in [1,2] do SetGapDocLaTeXOptions("color", latexOpts); MakeGAPDocDoc( path, "main.xml", files, book, "../..", "MathJax" $NOPDF);; od; + + CloseStream(outputstream); + UnbindInfoOutput(InfoGAPDoc); + UnbindInfoOutput(InfoWarning); + Print(outputstring); od; -CloseStream(outputstream); -UnbindInfoOutput(InfoGAPDoc); -UnbindInfoOutput(InfoWarning); -Print(outputstring); + +# evaluate the outputs for the second run outputstring:= ReplacedString(outputstring, "\c", "");; errors:= Filtered(SplitString(outputstring, "\n"), x -> StartsWith(x, "#W ") and x <> "#W There are overfull boxes:");;