From 8b4a1c96a99236cf05ec1932866aa67135dc76b9 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Fri, 31 Jan 2014 20:54:54 +0800 Subject: [PATCH] Make configpm produce better diagnostics for malformed glossary entries Patch 8b6a017ccef7126ae5bcac137fa9a45de4f2c155 added some malformed entries to Porting/Glossary. (The entries were missing a trailing colon). These malformed entries would produce a cryptic one-line warning, but only when various files were being regenerated. To make things more difficult these warnings would be produced at the top of, or in the middle of a large stream of other compilation actions, easily allowing one to overlook them. Even if you noticed them the information provided did not make it particularly easy to figure out what was wrong. This patch changes things so that the warnings contain more information, it also causes configpm to die, and thus break the build process, once it finishes scanning the glossary if there were any warnings during processing. This allows us to avoid whackamole when dealing with multiple broken entries, and makes it painfully obvious if there are issues processing the glossary file, which should prevent any future repeat of the errors in 8b6a017ccef7126. --- configpm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configpm b/configpm index a8a8ca1..d5bf5f2 100755 --- a/configpm +++ b/configpm @@ -974,6 +974,7 @@ if ($Opts{glossary}) { my %seen = (); my $text = 0; $/ = ''; +my $errors= 0; sub process { if (s/\A(\w*)\s+\(([\w.]+)\):\s*\n(\t?)/=item C<$1>\n\nFrom F<$2>:\n\n/m) { @@ -998,7 +999,9 @@ EOF } elsif (!$text || !/\A\t/) { warn "Expected a Configure variable header", - ($text ? " or another paragraph of description" : () ); + ($text ? " or another paragraph of description" : () ), + ", instead we got:\n$_"; + $errors++; } s/n't/n\00t/g; # leave can't, won't etc untouched s/^\t\s+(.*)/\n$1/gm; # Indented lines ===> new paragraph @@ -1035,6 +1038,13 @@ if ($Opts{glossary}) { process; print CONFIG_POD; } + if ($errors) { + die "Errors encountered while processing $Glossary. ", + "Header lines are expected to be of the form:\n", + "NAME (CLASS):\n", + "Maybe there is a malformed header?\n", + ; + } } print CONFIG_POD <<'ENDOFTAIL'; -- 2.7.4