All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH 3/3] runlatex.sh: Give up early on undefined refs
Date: Sun, 31 May 2020 09:35:35 +0900	[thread overview]
Message-ID: <1a1cc3cf-a557-bb04-1569-e68ee95f9951@gmail.com> (raw)
In-Reply-To: <64483a19-eee6-f406-7456-01feb232d019@gmail.com>

From 073429a7f9e68b4b7f51c9b766bf8aa24da83081 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sun, 31 May 2020 08:18:34 +0900
Subject: [PATCH 3/3] runlatex.sh: Give up early on undefined refs

Successive "undefined refs"s mean true missing/misspelled labels/refs.

Add code to detect second "undefined refs" and to give up early.

Also add code to skip an unnecessary pdflatex run when .aux and
.bbl files are up-to-date.
This can happen when you run "make" after removing perfbook.pdf,
e.g., with a different LATEX_OPT setting.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 utilities/runlatex.sh | 42 +++++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/utilities/runlatex.sh b/utilities/runlatex.sh
index 2aef9e2c..9687be95 100644
--- a/utilities/runlatex.sh
+++ b/utilities/runlatex.sh
@@ -51,6 +51,18 @@ identical_warnings () {
 	return 1 ;
 }
 
+exerpt_warnings () {
+	if grep -q "LaTeX Warning:" $basename.log
+	then
+		echo "----- Excerpt around remaining warning messages -----"
+		grep -B 8 -A 5 "LaTeX Warning:" $basename.log | tee $basename-warning.log
+		echo "----- You can see $basename-warning.log for the warnings above. -----"
+		echo "----- If you need to, see $basename.log for details. -----"
+		rm -f $basename-warning-prev.log
+		exit 1
+	fi
+}
+
 iterate_latex () {
 	pdflatex $LATEX_OPT $basename > /dev/null 2>&1 < /dev/null || :
 	if grep -q '! Emergency stop.' $basename.log
@@ -83,26 +95,30 @@ basename=`echo $1 | sed -e 's/\.tex$//'`
 
 if ! test -r $basename-first.log
 then
-	if ! sh utilities/mpostcheck.sh
-	then
-		exit 1
-	fi
+	echo "No need to update aux and bbl files."
 	echo "pdflatex 1 for $basename.pdf"
-	iterate_latex
+	iter=1
+else
+	rm -f $basename-first.log
+	echo "pdflatex 2 for $basename.pdf # for possible bib update"
+	iter=2
 fi
-rm -f $basename-first.log
-iter=2
-echo "pdflatex 2 for $basename.pdf # for possible bib update"
 iterate_latex
 min_iter=2
 while grep -q 'LaTeX Warning: There were undefined references' $basename.log
 do
+	if test $undefined_refs
+	then
+		echo "Undefined refs remain, giving up."
+		exerpt_warnings
+	fi
 	if identical_warnings
 	then
 		break
 	fi
 	iter=`expr $iter + 1`
 	echo "pdflatex $iter for $basename.pdf # remaining undefined refs"
+	undefined_refs=1
 	iterate_latex
 done
 min_iter=3
@@ -116,15 +132,7 @@ do
 	echo "pdflatex $iter for $basename.pdf # label(s) may have changed"
 	iterate_latex
 done
-if grep -q "LaTeX Warning:" $basename.log
-then
-	echo "----- Excerpt around remaining warning messages -----"
-	grep -B 8 -A 5 "LaTeX Warning:" $basename.log | tee $basename-warning.log
-	echo "----- You can see $basename-warning.log for the warnings above. -----"
-	echo "----- If you need to, see $basename.log for details. -----"
-	rm -f $basename-warning-prev.log
-	exit 1
-fi
+exerpt_warnings
 rm -f $basename-warning.log $basename-warning-prev.log
 echo "'$basename.pdf' is ready."
 # cleveref version check (Ubuntu 18.04 LTS has buggy one
-- 
2.17.1



  parent reply	other threads:[~2020-05-31  0:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-31  0:30 [PATCH 0/3] defer: misc updates Akira Yokosawa
2020-05-31  0:32 ` [PATCH 1/3] defer: Annotate consecutive QQZs as such for 'nq' build Akira Yokosawa
2020-05-31  0:33 ` [PATCH 2/3] FAQ.txt: Advertise 'nq' build in #9 Akira Yokosawa
2020-05-31  0:35 ` Akira Yokosawa [this message]
2020-05-31 16:50 ` [PATCH 0/3] defer: misc updates Paul E. McKenney
2020-05-31 23:11   ` Akira Yokosawa
2020-06-01  1:18     ` Paul E. McKenney
2020-06-01 15:10       ` Akira Yokosawa
2020-06-01 16:13         ` Paul E. McKenney
2020-06-01 22:51           ` Akira Yokosawa
2020-06-01 23:45             ` Paul E. McKenney
2020-06-02 14:27               ` Akira Yokosawa
2020-06-02 15:28                 ` Paul E. McKenney
2020-06-02 23:05                   ` Akira Yokosawa
2020-06-03  1:02                     ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a1cc3cf-a557-bb04-1569-e68ee95f9951@gmail.com \
    --to=akiyks@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=perfbook@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.