[latex3-commits] [git/LaTeX3-latex3-l3build] master: New specialformats table (fixes #84) (e1f620a)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Feb 5 10:32:24 CET 2019


Repository : https://github.com/latex3/l3build
On branch  : master
Link       : https://github.com/latex3/l3build/commit/e1f620a92e22beff2582ad25eb653ce5d2a50424

>---------------------------------------------------------------

commit e1f620a92e22beff2582ad25eb653ce5d2a50424
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Feb 5 09:32:24 2019 +0000

    New specialformats table (fixes #84)


>---------------------------------------------------------------

e1f620a92e22beff2582ad25eb653ce5d2a50424
 CHANGELOG.md          |    2 ++
 l3build-check.lua     |   46 ++++++++++++++++++----------------------------
 l3build-variables.lua |   11 +++++++++++
 l3build.dtx           |   27 +++++++++++++++++++++++++++
 4 files changed, 58 insertions(+), 28 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a3c9c05..8044091 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,8 @@ this project uses date-based 'snapshot' version identifiers.
 
 ### Added
 
+- Table-based control of binary/format combinations: `specialformats`
+  (see #84)
 - Switch `--debug` for chasing problems with the `upload` target
 
 ### Changed
diff --git a/l3build-check.lua b/l3build-check.lua
index 837b635..87d8d3f 100644
--- a/l3build-check.lua
+++ b/l3build-check.lua
@@ -670,24 +670,25 @@ function runtest(name, engine, hide, ext, pdfmode, breakout)
   local lvtfile = name .. (ext or lvtext)
   cp(lvtfile, fileexists(testfiledir .. "/" .. lvtfile)
     and testfiledir or unpackdir, testdir)
+  local checkopts = checkopts
   local engine = engine or stdengine
-  local realengine = engine
-  local format = ""
-  if checkformat == "latex" then
-    -- Special case for e-LaTeX format
-    if engine == "etex" then
-      format = " -fmt=latex"
-    -- Use "...latex" formats for other engines
-    elseif not match(engine,"latex") then
-      format = " -fmt=" .. gsub(engine,"tex","latex")
-    end
-    -- Special case for (u)pTeX LaTeX
-    if match(engine,"^u?ptex$") then
-      realengine = "e" .. engine
-    end
+  local binary = engine
+  local format = gsub(engine,"tex$",checkformat)
+  -- Special binary/format combos
+  if specialformats[checkformat] and next(specialformats[checkformat]) then
+    local t = specialformats[checkformat]
+    if t[engine] and next(t[engine]) then
+      local t = t[engine]
+      binary    = t.binary  or binary
+      checkopts = t.options or checkopts
+      format    = t.format  or format
+    end
+  end
+  -- Finalise format string
+  if format ~= "" then
+    format = " --fmt=" .. format
   end
   -- Special casing for XeTeX engine
-  local checkopts = checkopts
   if match(engine, "xetex") and not pdfmode then
     checkopts = checkopts .. " -no-pdf"
   end
@@ -695,19 +696,8 @@ function runtest(name, engine, hide, ext, pdfmode, breakout)
   local function setup(file)
     return " -jobname=" .. name .. " " .. ' "\\input ' .. file .. '" '
   end
-  if match(checkformat, "^context$") then
-    format = ""
+  if match(checkformat,"^context$") then
     function setup(file) return ' "' .. file .. '" '  end
-    if match(engine,"^lua") then
-      realengine = "context"
-    elseif engine == "pdftex" then
-      realengine = "texexec"
-    elseif engine == "xetex" then
-      realengine = "texexec --xetex"
-    else
-      print("Engine incompatible with format")
-      exit(1)
-    end
   end
   local basename = testdir .. "/" .. name
   local logfile = basename .. logext
@@ -743,7 +733,7 @@ function runtest(name, engine, hide, ext, pdfmode, breakout)
       -- Ensure lines are of a known length
       os_setenv .. " max_print_line=" .. maxprintline
         .. os_concat ..
-      realengine .. format 
+      binary .. format 
         .. " " .. asciiopt .. " " .. checkopts
         .. setup(lvtfile)
         .. (hide and (" > " .. os_null) or "")
diff --git a/l3build-variables.lua b/l3build-variables.lua
index ad88aed..1288a6b 100644
--- a/l3build-variables.lua
+++ b/l3build-variables.lua
@@ -115,6 +115,17 @@ zipopts     = zipopts     or "-v -r -X"
 -- Engines for testing
 checkengines = checkengines or {"pdftex", "xetex", "luatex"}
 checkformat  = checkformat  or "latex"
+specialformats = specialformats or { }
+specialformats.context = specialformats.context or {
+    luatex = {binary = "context", format = ""},
+    pdftex = {binary = "texexec", format = ""},
+    xetex  = {binary = "texexec", format = "", options = "--xetex"}
+  }
+specialformats.latex = specialformats.latex or {
+    etex  = {format = "latex"},
+    ptex  = {binary = "eptex"},
+    uptex = {binary = "euptex"}
+  }
 stdengine    = stdengine    or "pdftex"
 
 -- The tests themselves
diff --git a/l3build.dtx b/l3build.dtx
index ec353c0..2a3a9d7 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -110,6 +110,7 @@
 \luavarset{checkengines}{\{"pdftex", "xetex", "luatex"\}}{Engines to check with \texttt{check} by default}
 \luavarset{stdengine}    {"pdftex"}{Engine to generate \texttt{.tlg} file from}
 \luavarset{checkformat}  {"latex"} {Format to use for tests}
+\luavarset{specialformats}{\meta{table}} {Non-standard engine/format combinations}
 \luavarseparator
 \luavarset{checkconfigs}{\{\}}{Configurations to use for tests}
 \luavarseparator
@@ -765,6 +766,32 @@
 % A series of example layouts and matching |build.lua| files are available from
 % \url{https://github.com/latex3/l3build/tree/master/examples}.
 %
+% \subsection{Non-standard formats/binaries}
+%
+% The standard approach used by \pkg{l3build} is to use a combination
+% of \var{engine} and \var{checkformat} to generate the \emph{binary} and
+% \emph{format} combination used for tests. For example, when |pdftex| is
+% the \var{engine} and |latex| is the \var{checkformat}, the system call
+% used is
+% \begin{verbatim}
+%   pdftex --fmt=pdflatex
+% \end{verbatim}
+% \emph{i.e.}~the binary names is the same as the \var{engine}, and the format
+% is a simple substitution of the \var{checkformat} into \var{engine}, replacing
+% |tex|.
+%
+% For more complex set ups, \var{specialformats} should be used. This is a
+% table with one entry per \var{checkformat}. Each entry is itself a table,
+% and these contain a list of engines and settings for |binary|, |format|
+% and |options|. For example, for Con\TeX{}t and appropriate set up is
+% \begin{verbatim}
+% specialformats.context = {
+%   luatex = {binary = "context", format = ""},
+%   pdftex = {binary = "texexec", format = ""},
+%   xetex  = {binary = "texexec", format = "", options = "--xetex"}
+% }
+% \end{verbatim}
+%
 % \subsection{Output normalisation}
 % \label{sec:norm}
 %





More information about the latex3-commits mailing list