texlive[46055] Master/texmf-dist: l3build (12dec17)

commits+karl at tug.org commits+karl at tug.org
Tue Dec 12 23:36:25 CET 2017


Revision: 46055
          http://tug.org/svn/texlive?view=revision&revision=46055
Author:   karl
Date:     2017-12-12 23:36:25 +0100 (Tue, 12 Dec 2017)
Log Message:
-----------
l3build (12dec17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/l3build/README.md
    trunk/Master/texmf-dist/doc/latex/l3build/l3build.pdf
    trunk/Master/texmf-dist/source/latex/l3build/l3build.dtx
    trunk/Master/texmf-dist/tex/latex/l3build/l3build.lua

Modified: trunk/Master/texmf-dist/doc/latex/l3build/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/l3build/README.md	2017-12-12 22:36:12 UTC (rev 46054)
+++ trunk/Master/texmf-dist/doc/latex/l3build/README.md	2017-12-12 22:36:25 UTC (rev 46055)
@@ -1,7 +1,7 @@
 l3build: a testing and building system for LaTeX3
 =================================================
 
-Release 2017/12/06
+Release 2017/12/12
 
 Overview
 --------

Modified: trunk/Master/texmf-dist/doc/latex/l3build/l3build.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/l3build/l3build.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/l3build/l3build.dtx	2017-12-12 22:36:12 UTC (rev 46054)
+++ trunk/Master/texmf-dist/source/latex/l3build/l3build.dtx	2017-12-12 22:36:25 UTC (rev 46055)
@@ -57,17 +57,19 @@
 \luavarset{modules}{\{\}}{The list of all modules in a bundle (when not auto-detecting)}
 \luavarset{exclmodules}{\{\}}{Directories to be excluded from automatic module detection}
 \luavarseparator
-\luavarset{maindir}    {"."}                      {Top level directory for the module/bundle}
-\luavarset{docfiledir} {maindir}                  {Directory containing documentation files}
+\luavarset{maindir}     {"."}                      {Top level directory for the module/bundle}
+\luavarset{docfiledir}  {"."}                 {Directory containing documentation files}
+\luavarset{sourcfiledir}{"."}                 {Directory containing source files}
 \luavarset{supportdir} {maindir .. "/support"}    {Directory containing general support files}
-\luavarset{testfiledir}{maindir .. "/testfiles"}  {Directory containing test files}
+\luavarset{testfiledir}{"./testfiles"}  {Directory containing test files}
 \luavarset{testsuppdir}{testfiledir .. "/support"}{Directory containing test-specific support files}
 \luavarseparator
-\luavarset{distribdir}{maindir .. "/build/distrib"}{Directory for generating distribution structure}
-\luavarset{localdir}  {maindir .. "/build/local"}  {Directory for extracted files in \enquote{sandboxed} \TeX{} runs}
-\luavarset{testdir}   {maindir .. "/build/test"}   {Directory for running tests}
-\luavarset{typesetdir}{maindir .. "/build/doc"}    {Directory for building documentation}
-\luavarset{unpackdir} {maindir .. "/build/unpack"} {Directory for unpacking sources}
+\luavarset{builddir}  {maindir .. "/build"}   {Directory for building and testing}
+\luavarset{distribdir}{builddir .. "/distrib"}{Directory for generating distribution structure}
+\luavarset{localdir}  {builddir .. "/local"}  {Directory for extracted files in \enquote{sandboxed} \TeX{} runs}
+\luavarset{testdir}   {builddir .. "/test"}   {Directory for running tests}
+\luavarset{typesetdir}{builddir .. "/doc"}    {Directory for building documentation}
+\luavarset{unpackdir} {builddir .. "/unpack"} {Directory for unpacking sources}
 \luavarseparator
 \luavarset{ctandir}{distribdir .. "/ctan"}{Directory for organising files for CTAN}
 \luavarset{tdsdir} {distribdir .. "/tds"} {Directory for organised files into TDS structure}
@@ -112,6 +114,9 @@
 \luavarset{stdengine}    {"pdftex"}{Engine to generate \texttt{.tlg} file from}
 \luavarset{checkformat}  {"latex"} {Format to use for tests}
 \luavarseparator
+\luavarset{checkconfigs}{\{\}}{Configurations to use for tests}
+\luavarset{stdconfig}   {\meta{Main script}}{Standard test configuration}
+\luavarseparator
 \luavarset{typesetexe}{"pdflatex"}{Executable for compiling \texttt{doc(s)}}
 \luavarset{unpackexe} {"tex"}     {Executable for running \texttt{unpack}}
 \luavarset{zipexe}    {"zip"}     {Executable for creating archive with \texttt{ctan}}
@@ -209,7 +214,7 @@
 %    }^^A
 % }
 %
-% \date{Released 2017/12/06}
+% \date{Released 2017/12/12}
 %
 % \maketitle
 % \tableofcontents
@@ -304,6 +309,7 @@
 %
 % As well as these commands, the system recognises the options
 % \begin{itemize}
+%   \item \texttt{--config} (\texttt{-c}) Configuration(s) to use for testing
 % \item \texttt{--date} (\texttt{-d}) Date to use when setting version
 %   data
 % \item \texttt{--engine} (\texttt{-e}) Sets the engine to use for
@@ -618,32 +624,43 @@
 % \subsection{Multiple sets of tests}
 %
 % In most cases, a single set of tests will be appropriate for the module, with
-% a common set of configuration settings applying. However, there are situations
-% where you may need entirely independent sets of tests which have different
-% setting values, for example using different formats or where the entire set
-% will be engine-dependent. To support this, \pkg{l3build} offers the |--testfiledir|
-% (|-t|) command line option. When this is given with a directory argument it
-% overrides the \var{testfiledir} variable. Moreover, before the tests are run,
-% \pkg{l3build} will read |config.lua| within the directory (if available). This
-% should comprise a list of settings which apply to the tests in place of those in
-% the main build script.
+% a common set of configuration settings applying. However, there are
+% situations where you may need entirely independent sets of tests which have
+% different setting values, for example using different formats or where the
+% entire set will be engine-dependent. To support this, \pkg{l3build} offers
+% the possibility of using multiple configurations for tests. This is supported
+% using the \var{checkconfigs} table. This is used to list the names of each
+% configuration (|.lua| file) which will be used to run tests.
 %
-% For example, for the core \LaTeXe{} tests the main test files are contained
-% in a directory |testfiles| and have \var{checksearch} set \var{false}. To test
-% font loading for \XeTeX{} and \LuaTeX{} there are a second set of tests in
-% |testfiles-TU| which use the short |config.lua| file shown in
-% Figure~\ref{fig:testfiledir}. These additional tests are then run using
-% |texlua build.lua check --testfiledir=testfiles-TU|.
-% \begin{figure}
-%   \begin{lstlisting}[frame=single,language={[5.2]Lua},gobble = 6]
-%     -- Special config for these tests
+% For example, for the core \LaTeXe{} tests the main test files are contained 
+% in a directory |testfiles|. To test font loading for \XeTeX{} and \LuaTeX{}
+% there are a second set of tests in |testfiles-TU| which use the short
+% |build-TU.lua| file shown in Figure~\ref{fig:configs}. To run both sets of
+% tests, the main |build.lua| file contains the setting
+% |checkconfigs = {"build", "config-TU"}|. This will cause \pkg{l3build} to run
+% first using no additional settings (\emph{i.e.}~reading the normal
+% |build.lua| file alone), then running \emph{also} loading the settings from
+% |config-TU.lua|.
+% \begin{figure} 
+%   \begin{lstlisting}[frame=single,language={[5.2]Lua},gobble = 6] 
+%     -- Special config for these tests 
 %     checksearch  = true
 %     checkengines = {"xetex","luatex"}
-%   \end{lstlisting}
-% \caption{The build script for the \pkg{xparse} module.}
-% \label{fig:testfiledir}
-% \end{figure}
+%     testfiledir  = "testfiles-TU"
+%   \end{lstlisting} 
+% \caption{The build script for the \pkg{xparse} module.} 
+% \label{fig:configs} 
+% \end{figure} 
 %
+% To allow selection of a one or more configurations, and to allow saving of
+% |.tlg| files in non-standard configurations, the |--config| (|-c|) option may
+% be used. This works in the same way as |--engine|: it takes a comma list of
+% configurations to apply, overriding \var{checkconfigs}.
+%
+% Note that the setting \var{stdconfig} is used to determine the \emph{vanilla}
+% configuration: this will typically be the name of the main script (usually
+% |build| for a standard |build.lua| file).
+%
 % \subsection{Dependencies}
 %
 % If you have multiple packages that are developed separately but still interact in some way, it's often desirable to integrate them when performing regression tests.
@@ -678,7 +695,19 @@
 % This ensures that the \pkg{l3kernel} code is included in all processes involved in unpacking and checking and so on.
 % The name of the script file in the dependency is set with the |scriptname| variable; by default these are |"build.lua"|.
 %
+% \subsection{Non-standard source layouts}
 %
+% A variety of source layouts are supported. In general, a \enquote{flat}
+% layout with all source files \enquote{here} is most convenient. However,
+% \pkg{l3build} supports placement of both code and documentation source
+% files in other locations using the \var{sourcefiledir} and \var{docfiledir}
+% variables. For pre-built trees, the glob syntax \texttt{**/*.\meta{ext}} may
+% be useful in these cases: this enables recursive searching in the appropriate
+% tree locations.
+%
+% A series of example layouts and matching |build.lua| files are available from
+% \url{https://github.com/latex3/l3build/tree/master/examples}.
+%
 % \subsection{Output normalisation}
 % \label{sec:norm}
 %
@@ -1136,6 +1165,13 @@
 % apply to a case where multiple \BibTeX{} runs are needed (perhaps where
 % citations can appear within other references).
 %
+% Where there are complex requirements for pre-compiled demonstration
+% files, the hook |typeset_demo_hook()| is available: it runs after
+% copying files to the typesetting location but before the main typesetting
+% run. This may be used for example to script a very large number of
+% demonstrations using a single source (see the \pkg{beamer} package
+% for an example of this).
+%
 % \begin{figure}[!b]
 %   \begin{lstlisting}[frame=single,language={[5.2]Lua},gobble = 6]
 %     #!/usr/bin/env texlua

Modified: trunk/Master/texmf-dist/tex/latex/l3build/l3build.lua
===================================================================
--- trunk/Master/texmf-dist/tex/latex/l3build/l3build.lua	2017-12-12 22:36:12 UTC (rev 46054)
+++ trunk/Master/texmf-dist/tex/latex/l3build/l3build.lua	2017-12-12 22:36:25 UTC (rev 46055)
@@ -23,7 +23,7 @@
 --]]
 
 -- Version information
-release_date = "2017/12/06"
+release_date = "2017/12/12"
 
 -- "module" is a deprecated function in Lua 5.2: as we want the name
 -- for other purposes, and it should eventually be 'free', simply
@@ -61,20 +61,23 @@
 
 -- Directory structure for the build system
 -- Use Unix-style path separators
-maindir = maindir or "."
+currentdir = "."
+maindir    = maindir or currentdir
 
 -- Substructure for file locations
-docfiledir  = docfiledir  or maindir
-supportdir  = supportdir  or maindir .. "/support"
-testfiledir = testfiledir or "testfiles"
-testsuppdir = testsuppdir or testfiledir .. "/support"
+docfiledir    = docfiledir    or currentdir
+sourcefiledir = sourcefiledir or currentdir
+supportdir    = supportdir    or maindir .. "/support"
+testfiledir   = testfiledir   or currentdir .. "/testfiles"
+testsuppdir   = testsuppdir   or testfiledir .. "/support"
 
 -- Structure within a development area
-distribdir = distribdir or maindir .. "/build/distrib"
-localdir   = localdir   or maindir .. "/build/local"
-testdir    = testdir    or maindir .. "/build/test"
-typesetdir = typesetdir or maindir .. "/build/doc"
-unpackdir  = unpackdir  or maindir .. "/build/unpacked"
+builddir   = builddir   or maindir .. "/build"
+distribdir = distribdir or builddir .. "/distrib"
+localdir   = localdir   or builddir .. "/local"
+testdir    = testdir    or builddir .. "/test"
+typesetdir = typesetdir or builddir .. "/doc"
+unpackdir  = unpackdir  or builddir .. "/unpacked"
 
 -- Substructure for CTAN release material
 ctandir = ctandir or distribdir .. "/ctan"
@@ -136,6 +139,10 @@
 checkformat  = checkformat  or "latex"
 stdengine    = stdengine    or "pdftex"
 
+-- Configs for testing
+stdconfig    = stdconfig    or string.gsub(arg[0], "%.lua$", "")
+checkconfigs = checkconfigs or {stdconfig}
+
 -- Enable access to trees outside of the repo
 -- As these may be set false, a more elaborate test than normal is needed
 if checksearch == nil then
@@ -238,6 +245,12 @@
 
 local option_list =
   {
+    config =
+      {
+        desc  = "Sets the config(s) used for running tests",
+        short = "c",
+        type  = "table"
+      },
     date =
       {
         desc  = "Sets the date to insert into sources",
@@ -246,7 +259,7 @@
       },
     engine =
       {
-        desc  = "Sets the engine to use for running test",
+        desc  = "Sets the engine(s) to use for running test",
         short = "e",
         type  = "table"
       },
@@ -291,12 +304,6 @@
         short = "r",
         type  = "boolean"
       },
-    testfiledir =
-      {
-        desc  = "Selects the specified testfile location",
-        short = "t",
-        type  = "table"
-      },
     version =
       {
         desc  = "Sets the version to insert into sources",
@@ -609,7 +616,7 @@
       else
         errorlevel = execute(
           'xcopy /y "' .. unix_to_win(source) .. '" "'
-             .. unix_to_win(dest) .. '" > nul'
+             .. unix_to_win(dest .. '/') .. '" > nul'
         )
       end
     else
@@ -675,28 +682,28 @@
 -- table, the keys are paths relative to the given starting path, the values
 -- are their counterparts relative to the current working directory.
 function tree(path, glob)
-  function cropdots(path)
+  local function cropdots(path)
     return gsub(gsub(path, "^%./", ""), "/%./", "/")
   end
-  function always_true()
+  local function always_true()
     return true
   end
-  function is_dir(file)
+  local function is_dir(file)
     return lfs_attributes(file)["mode"] == "directory"
   end
   local dirs = {["."] = cropdots(path)}
-  for pattern, critereon in gmatch(cropdots(glob), "([^/]+)(/?)") do
-    local critereon = critereon == "/" and is_dir or always_true
+  for pattern, criterion in gmatch(cropdots(glob), "([^/]+)(/?)") do
+    local criterion = criterion == "/" and is_dir or always_true
     function fill(path, dir, table)
       for _, file in ipairs(filelist(dir, pattern)) do
         local fullpath = path .. "/" .. file
         if file ~= "." and file ~= ".." and
-          fullpath ~= maindir .. "/build" and
+          fullpath ~= builddir and
           (sub(pattern, 1, 1) == "."
             or sub(file, 1, 1) ~= ".")
         then
           local fulldir = dir .. "/" .. file
-          if critereon(fulldir) then
+          if criterion(fulldir) then
             table[fullpath] = fulldir
           end
         end
@@ -740,6 +747,8 @@
 function ren(dir, source, dest)
   local dir = dir .. "/"
   if os_type == "windows" then
+    local source = gsub(source, "^%.+/", "")
+    local dest = gsub(dest, "^%.+/", "")
     return execute("ren " .. unix_to_win(dir) .. source .. " " .. dest)
   else
     return execute("mv " .. dir .. source .. " " .. dir .. dest)
@@ -837,7 +846,7 @@
   for _,i in ipairs(filelist(localdir)) do
     cp(i, localdir, testdir)
   end
-  bundleunpack({".", testfiledir})
+  bundleunpack({sourcefiledir, testfiledir})
   for _,i in ipairs(installfiles) do
     cp(i, unpackdir, testdir)
   end
@@ -857,22 +866,37 @@
 
 -- Copy files to the main CTAN release directory
 function copyctan()
-  -- Do all of the copying in one go
-  for _,i in ipairs(
+  local ctantarget = ctanpkg
+  if docfiledir ~= currentdir then
+    ctantarget = ctanpkg .. "/" .. gsub(docfiledir, "^%.*/", "")
+  end
+  mkdir(ctandir .. "/" .. ctantarget)
+  for _,filetype in pairs(
       {
         bibfiles,
         demofiles,
         docfiles,
         pdffiles,
-        sourcefiles,
-        textfiles,
         typesetlist
       }
     ) do
-    for _,j in ipairs(i) do
-      cp(j, ".", ctandir .. "/" .. ctanpkg)
+    for _,file in pairs(filetype) do
+      cp(file, docfiledir, ctandir .. "/" .. ctantarget)
     end
   end
+  ctantarget = ctanpkg
+  if sourcefiledir ~= currentdir then
+    ctantarget = ctanpkg .. "/" .. gsub(sourcefiledir, "^%.*/", "")
+  end
+  mkdir(ctandir .. "/" .. ctantarget)
+  for _,file in pairs(sourcefiles) do
+    if sourcedir ~= currentdir then
+    end
+    cp(file, sourcefiledir, ctandir .. "/" .. ctantarget)
+  end
+  for _,file in pairs(textfiles) do
+    cp(file, currentdir, ctandir .. "/" .. ctanpkg)
+  end
 end
 
 -- Copy files to the correct places in the TDS tree
@@ -896,8 +920,8 @@
     local filenames = { }
     for _,i in ipairs(files) do
       for _,j in ipairs(i) do
-        for _,k in ipairs(filelist(source, j)) do
-          insert(filenames, k)
+        for file,_ in pairs(tree(source, j)) do
+          insert(filenames, file)
         end
       end
     end
@@ -911,13 +935,13 @@
     end
   end
   install(
-    ".",
+    docfiledir,
     "doc",
     {bibfiles, demofiles, docfiles, pdffiles, textfiles, typesetlist}
   )
   install(unpackdir, "makeindex", {makeindexfiles}, true)
   install(unpackdir, "bibtex/bst", {bstfiles}, true)
-  install(".", "source", {sourcelist})
+  install(sourcefiledir, "source", {sourcelist})
   install(unpackdir, "tex", {installfiles})
 end
 
@@ -1746,7 +1770,7 @@
   if errorlevel == 0 then
     name = name .. ".pdf"
     os_remove(jobname(name))
-    cp(name, typesetdir, ".")
+    cp(name, typesetdir, docfiledir)
   else
     print(" ! Compilation failed")
   end
@@ -1920,7 +1944,9 @@
     cleandir(typesetdir) +
     cleandir(unpackdir)
   for _,i in ipairs(cleanfiles) do
-    errorlevel = rm(".", i) + errorlevel
+    for _,dir in pairs({maindir, sourcefiledir, docfiledir}) do
+      errorlevel = rm(dir, i) + errorlevel
+    end
   end
   return errorlevel
 end
@@ -1928,7 +1954,7 @@
 function bundleclean()
   local errorlevel = call(modules, "clean")
   for _,i in ipairs(cleanfiles) do
-    errorlevel = rm(".", i) + errorlevel
+    errorlevel = rm(maindir, i) + errorlevel
   end
   return (
     errorlevel     +
@@ -1942,19 +1968,24 @@
   mkdir(localdir)
   cleandir(testdir)
   depinstall(checkdeps)
-  for _,i in ipairs({bibfiles, docfiles, sourcefiles, typesetfiles}) do
-    for _,j in ipairs(i) do
-      cp(j, ".", testdir)
+  for _,filetype in pairs(
+      {bibfiles, docfiles, typesetfiles, typesetdemofiles}
+    ) do
+    for _,file in pairs(filetype) do
+      cp(file, docfiledir, typesetdir)
     end
   end
-  for _,i in ipairs(typesetsuppfiles) do
-    cp(i, supportdir, testdir)
+  for _,file in pairs(sourcefiles) do
+    cp(file, sourcefiledir, testdir)
   end
+  for _,file in pairs(typesetsuppfiles) do
+    cp(file, supportdir, testdir)
+  end
   local engine = gsub(stdengine, "tex$", "latex")
   local localdir = abspath(localdir)
   print("Checking source files")
   for _,i in ipairs(cmdchkfiles) do
-    for _,j in ipairs(filelist(".", i)) do
+    for _,j in ipairs(filelist(sourcefiledir, i)) do
       print("  " .. jobname(j))
       run(
         testdir,
@@ -2030,7 +2061,7 @@
   end
   if errorlevel == 0 then
     for _,i in ipairs(textfiles) do
-      for _,j in pairs({unpackdir, "."}) do
+      for _,j in pairs({unpackdir, currentdir}) do
         cp(i, j, ctandir .. "/" .. ctanpkg)
         cp(i, j, tdsdir .. "/doc/" .. tdsroot .. "/" .. bundle)
       end
@@ -2040,7 +2071,7 @@
       cp(ctanpkg .. ".tds.zip", tdsdir, ctandir)
     end
     dirzip(ctandir, ctanpkg)
-    cp(ctanpkg .. ".zip", ctandir, ".")
+    cp(ctanpkg .. ".zip", ctandir, currentdir)
   else
     print("\n====================")
     print("Typesetting failed, zip stage skipped!")
@@ -2052,22 +2083,23 @@
 function bundlectan()
   -- Generate a list of individual file names excluding those in the second
   -- argument: the latter is a table
-  local function excludelist(include, exclude)
+  local function excludelist(include, exclude, dir)
     local include = include or { }
     local exclude = exclude or { }
+    local dir = dir or currentdir
     local includelist = { }
     local excludelist = { }
     for _,i in ipairs(exclude) do
       for _,j in ipairs(i) do
-        for _,k in ipairs(filelist(".", j)) do
-          excludelist[k] = true
+        for file,_ in pairs(tree(dir, j)) do
+          excludelist[file] = true
         end
       end
     end
     for _,i in ipairs(include) do
-      for _,j in ipairs(filelist(".", i)) do
-        if not excludelist[j] then
-          insert(includelist, j)
+      for file,_ in pairs(tree(dir, i)) do
+        if not excludelist[file] then
+          insert(includelist, file)
         end
       end
     end
@@ -2087,9 +2119,9 @@
     for _,v in pairs(typesetdemofiles) do
       insert(typesetfiles, v)
     end
-    typesetlist = excludelist(typesetfiles, {sourcefiles})
+    typesetlist = excludelist(typesetfiles, {sourcefiles}, docfiledir)
     sourcelist = excludelist(
-      sourcefiles, {bstfiles, installfiles, makeindexfiles}
+      sourcefiles, {bstfiles, installfiles, makeindexfiles}, sourcefiledir
     )
     copyctan()
     copytds()
@@ -2097,25 +2129,37 @@
   return errorlevel
 end
 
+-- A hook to allow additional typesetting of demos
+typeset_demo_tasks = typeset_demo_tasks or function()
+  return 0
+end
+
 -- Typeset all required documents
 -- Uses a set of dedicated auxiliaries that need to be available to others
 function doc(files)
   -- Set up
   cleandir(typesetdir)
-  for _,i in ipairs(
-    {bibfiles, docfiles, sourcefiles, typesetfiles, typesetdemofiles}
-  ) do
-    for _,j in ipairs(i) do
-      cp(j, ".", typesetdir)
-    end
+  for _,filetype in pairs( 
+      {bibfiles, docfiles, typesetfiles, typesetdemofiles} 
+    ) do 
+    for _,file in pairs(filetype) do 
+      cp(file, docfiledir, typesetdir) 
+    end 
+  end 
+  for _,file in pairs(sourcefiles) do 
+    cp(file, sourcefiledir, typesetdir) 
+  end 
+  for _,file in pairs(typesetsuppfiles) do
+    cp(file, supportdir, typesetdir)
   end
-  for _,i in ipairs(typesetsuppfiles) do
-    cp(i, supportdir, typesetdir)
-  end
   depinstall(typesetdeps)
-  unpack({sourcefiles, typesetsourcefiles}, {".", docfiledir})
+  unpack({sourcefiles, typesetsourcefiles}, {sourcefiledir, docfiledir})
   -- Main loop for doc creation
   local done = {}
+  local errorlevel = typeset_demo_tasks()
+  if errorlevel ~= 0 then
+    return errorlevel
+  end
   for _, typesetfiles in ipairs({typesetdemofiles, typesetfiles}) do
     for _,i in ipairs(typesetfiles) do
       for _, dir in ipairs({unpackdir, typesetdir}) do
@@ -2280,7 +2324,7 @@
   return line
 end
 
-function setversion(dir)
+function setversion()
   local function rewrite(dir, file, date, version)
     local changed = false
     local result = ""
@@ -2311,10 +2355,11 @@
   end
   local date = options["date"] or os_date("%Y-%m-%d")
   local version = options["version"] or -1
-  local dir = dir or "."
-  for _,i in pairs(versionfiles) do
-    for _,j in pairs(filelist(dir, i)) do
-      rewrite(dir, j, date, version)
+  for _,dir in pairs({currentdir, sourcefiledir, docfiledir}) do
+    for _,i in pairs(versionfiles) do
+      for file,_ in pairs(tree(dir, i)) do
+        rewrite(dir, file, date, version)
+      end
     end
   end
   return 0
@@ -2351,7 +2396,7 @@
   if errorlevel ~=0 then
     return errorlevel
   end
-  for _,i in ipairs(sourcedirs or {"."}) do
+  for _,i in ipairs(sourcedirs or {sourcefiledir}) do
     for _,j in ipairs(sources or {sourcefiles}) do
       for _,k in ipairs(j) do
         errorlevel = cp(k, i, unpackdir)
@@ -2487,18 +2532,32 @@
 -- Allow main function to be disabled 'higher up'
 main = main or stdmain
 
--- Pick up and read any per-run testfiledir
-if options["testfiledir"] then
-  if #options["testfiledir"] == 1 then
-    testfiledir = options["testfiledir"][1]
-    if fileexists(testfiledir .. "/config.lua") then
-      dofile(testfiledir .. "/config.lua")
+-- Deal with multiple configs for tests
+checkconfigs = options["config"] or checkconfigs
+if options["target"] == "check" then
+  if #checkconfigs > 1 then
+    local errorlevel = 0
+    local opts = options
+    for i = 1, #checkconfigs do
+      opts["config"] = {checkconfigs[i]}
+      errorlevel = call({"."}, "check", opts)
+      if errorlevel ~= 0 then exit(1) end
     end
-  else
-    print("Cannot use more than one testfile dir at a time!")
-    return 1
+    -- Avoid running the 'main' set of tests twice
+    exit(0)
   end
 end
+if #checkconfigs == 1 and
+   checkconfigs[1] ~= stdconfig and
+   (options["target"] == "check" or options["target"] == "save") then
+   local config = "./" .. checkconfigs[1] .. ".lua"
+   if fileexists(config) then
+     dofile(config)
+   else
+     print("Error: Cannot find configuration " ..  checkconfigs[1])
+     exit(1)
+   end
+end
 
 -- Call the main function
 main(options["target"], options["files"])



More information about the tex-live-commits mailing list