diff options
author | Karl Berry <karl@freefriends.org> | 2014-07-20 22:15:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-07-20 22:15:02 +0000 |
commit | 97666739085cbc6593468e7f5a2cc04f2eaf0de2 (patch) | |
tree | cb376a0a93994b3b2f420e124d678f7efc1d0a68 /Master/texmf-dist/source/latex/l3build | |
parent | 6c2678db440b5260ec13602bde6efebdd00f8549 (diff) |
l3build
git-svn-id: svn://tug.org/texlive/trunk@34672 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3build')
-rw-r--r-- | Master/texmf-dist/source/latex/l3build/l3build.dtx | 29 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3build/l3build.lua | 102 |
2 files changed, 75 insertions, 56 deletions
diff --git a/Master/texmf-dist/source/latex/l3build/l3build.dtx b/Master/texmf-dist/source/latex/l3build/l3build.dtx index 54b031c021f..c24304f0f68 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.dtx +++ b/Master/texmf-dist/source/latex/l3build/l3build.dtx @@ -39,8 +39,8 @@ \RequirePackage{expl3} \def\ExplFileName{l3build} \def\ExplFileDescription{L3 Regression test suite} -\def\ExplFileDate{2014/06/15} -\def\ExplFileVersion{5141} +\def\ExplFileDate{2014/07/19} +\def\ExplFileVersion{5240} \documentclass[full]{l3doc} \renewcommand\partname{Part} \usepackage{multicol,needspace} @@ -74,6 +74,9 @@ \luavarset{module}{""}{The name of the module.} \luavarset{bundle}{""}{The name of the bundle in which the module belongs.} \luavarseparator +\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} {"."}{The top level directory for this module or bundle.} \luavarset{supportdir} {maindir .. "/support"} {Where copies of files to support check/doc compilation are stored.} \luavarset{testfiledir} {maindir .. "/testfiles"} {Where the tests are.} @@ -95,7 +98,7 @@ \luavarset{cmdchkfiles} {\{~\}}{Files need to perform command checking (\cls{l3doc}-based documentation only).} \luavarset{demofiles} {\{~\}}{Files which show how to use a module.} \luavarset{cleanfiles} {\{"*.pdf", "*.zip"\}}{Files to delete when cleaning.} -\luavarset{excludefiles} {\{"*\string~"\}} {Files to ignore entirely (default for Emacs auto-save files).} +\luavarset{excludefiles} {\{"*\string~"\}} {Files to ignore entirely (default for Emacs backup files).} \luavarset{installfiles} {\{"*.sty"\}} {Files to install to the \TeX{} tree and similar tasks.} \luavarset{sourcefiles} {\{"*.dtx", "*.ins"\}}{Files to copy for unpacking.} \luavarset{txtfiles} {\{"*.markdown"\}} {Files which should have the extension removed when sent to CTAN.} @@ -112,8 +115,9 @@ \luavarset{typesetdeps} {\{~\}} {\dots for typesetting docs.} \luavarset{unpackdeps} {\{~\}} {\dots for unpacking.} \luavarseparator -\luavarset{chkengines} {\{"pdftex", "xetex", "luatex"\}} {Engines to check with \texttt{checklvt} by default.} -\luavarset{stdengine} {"pdtex"} {Engine to generate \texttt{.tlg} file from.} +\luavarset{checkengines}{\{"pdftex", "xetex", "luatex"\}} {Engines to check with \texttt{checklvt} by default.} +\luavarset{stdengine} {"pdtex"} {Engine to generate \texttt{.tlg} file from.} +\luavarset{checkformat} {"latex"} {Format to use for tests.} \luavarseparator \luavarset{typesetexe} {"pdflatex"} {Executable for compiling \texttt{doc(s)}.} \luavarset{unpackexe} {"tex"} {Executable for running \texttt{unpack}.} @@ -297,7 +301,9 @@ % This range of possibilities allow sensible defaults but significant flexibility for defining your own test setups. % % Checking can be performed with any or all of the `engines' \texttt{pdftex}, \texttt{xetex}, and \texttt{luatex}. -% By default, each test is executed with all three, being compared against the \texttt{.tlg} file produced from the \var{pdftex} engine (these defaults are controlled by the |chkengines| and |stdengine| variable respectively). +% By default, each test is executed with all three, being compared against the \texttt{.tlg} file produced from the \var{pdftex} engine (these defaults are controlled by the |checkengines| and |stdengine| variable respectively). +% The format used for tests can be altered by setting \var{checkformat}: the default setting \texttt{latex} means that tests are run using \emph{e.g.}~\texttt{pdflatex}, whereas setting to \texttt{plain} will run tests using \emph{e.g.}~\texttt{pdftex}. +% (Currently, this should be one of \texttt{latex} or \texttt{plain}.) % To perform the check, the engine typesets each test \var{checkruns} times. % More detail on this in the documentation on |savetlg|. % Options passed to the binary are defined in the variable \var{checkopts}. @@ -308,7 +314,7 @@ % % \begin{buildcmd}{checklvt \meta{name} [\meta{engine}]} % Checks only the test \texttt{\meta{name}.lvt} with optionally specified \meta{engine} (one of |pdftex|, |xetex|, or |luatex|). -% If an \meta{engine} is not specified, all three engines are checked (or those defined by the |chkengines| variable if changed from the default). +% If an \meta{engine} is not specified, all three engines are checked (or those defined by the |checkengines| variable if changed from the default). % \end{buildcmd} % % \begin{buildcmd}{cmdcheck} @@ -347,7 +353,7 @@ % abc.sty % \end{Verbatim} % The files copied into the archive are controlled by a number of variables. -% The `root' of the TDS structure is defined by \var{tdsroot}, which is \luavar{tdsroot} by default. Plain users would redefine this to |"generic"|, for example. +% The `root' of the TDS structure is defined by \var{tdsroot}, which is \luavar{tdsroot} by default. Plain users would redefine this to |"plain"| (or perhaps |"generic"|), for example. % % \pagebreak[2] % The |doc| tree is constructed from: @@ -611,7 +617,7 @@ % The |\END| command signals the end of the test (but read on). % Some additional diagnostic information is printed at this time to debug if the test did not complete `properly' in terms of mismatched brace groups or \cs{if}\dots\cs{fi} groups. % -% In a \LaTeX{} document, |\end{document}| will implicity call |\END| at the very end of the compilation process. +% In a \LaTeX{} document, |\end{document}| will implicitly call |\END| at the very end of the compilation process. % If |\END| is used directly (replacing |\end{document}| in the test), the compilation will halt almost immediately, and various tasks that |\end{document}| usually performs will not occur (such as potentially writing to the various |.toc| files, and so on). This can be an advantage if there is additional material printed to the log file in this stage that you wish to ignore, but it is a disadvantage if the test relies on various auxiliary data for a subsequent typesetting run. % (See the \var{checkruns} variable for how these tests would be test up.) % @@ -640,7 +646,8 @@ % \end{itemize} % An example of some of these commands is shown following. % \begin{Verbatim} -% \begin{TEST}{bool_set,~lazy~evaluation} +% \TEST{bool_set,~lazy~evaluation} +% { % \bool_set:Nn \l_tmpa_bool % { % \int_compare_p:nNn 1=1 @@ -653,7 +660,7 @@ % && \int_compare_p:nNn 2=2 % } % \bool_if:NTF \l_tmpa_bool \TRUE \FALSE -% \end{TEST} +% } % \end{Verbatim} % This test will produce the following in the output. % \begin{Verbatim} diff --git a/Master/texmf-dist/source/latex/l3build/l3build.lua b/Master/texmf-dist/source/latex/l3build/l3build.lua index 99f68bdbc77..02a6f8c066c 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.lua +++ b/Master/texmf-dist/source/latex/l3build/l3build.lua @@ -17,8 +17,8 @@ --]] -- Version information: should be identical to that in l3build.dtx -release_date = "2014/06/15" -release_ver = "5141" +release_date = "2014/07/19" +release_ver = "5240" -- Ensure the module and bundle exist module = module or "" @@ -87,8 +87,9 @@ unpackopts = unpackopts or "" zipopts = zipopts or "-v -r -X" -- Engines for testing -chkengines = chkengines or {"pdftex", "xetex", "luatex"} -stdengine = stdengine or "pdftex" +checkengines = checkengines or {"pdftex", "xetex", "luatex"} +checkformat = checkformat or "latex" +stdengine = stdengine or "pdftex" -- Enable access to trees outside of the repo -- As these may be set false, a more elaborate test than normal is needed @@ -362,9 +363,7 @@ end -- Set up the check system files: needed for checking one or more tests and -- for saving the test files function checkinit () - cleandir (localdir) cleandir (testdir) - cleandir (unpackdir) depinstall (checkdeps) -- Copy dependencies to the test directory itself: this makes the paths -- a lot easier to manage, and is important for dealing with the log and @@ -393,8 +392,7 @@ end function depinstall (deps) for _,i in ipairs (deps) do print ("Installing dependency: " .. i) - run (i, "texlua " .. scriptname .. " localinstall") - cleandir (unpackdir) + run (i, "texlua " .. scriptname .. " unpack") end end @@ -499,15 +497,33 @@ function formatlog (logfile, newfile) io.close (newfile) end +-- List all modules +function listmodules () + local modules = { } + local exclmodules = exclmodules or { } + for entry in lfs.dir (".") do + if entry ~= "." and entry ~= ".." then + local attr = lfs.attributes (entry) + assert (type (attr) == "table") + if attr.mode == "directory" then + if not exclmodules[entry] then + table.insert (modules, entry) + end + end + end + end + return (modules) +end + -- Runs a single test: needs the name of the test rather than the .lvt file -- One 'test' here may apply to multiple engines function runcheck (name, engine, hide) - local chkengines = chkengines + local checkengines = checkengines if engine then - chkengines = {engine} + checkengines = {engine} end local errorlevel = 0 - for _,i in ipairs (chkengines) do + for _,i in ipairs (checkengines) do runtest (name, i, hide) local testname = name .. "." .. i local difffile = testdir .. "/" .. testname .. os_diffext @@ -538,7 +554,10 @@ function runtest (name, engine, hide) cp (name .. lvtext, testfiledir, testdir) local engine = engine or stdengine -- Engine name doesn't include the "la" for LaTeX! - local cmd = string.gsub (engine, "tex$", "latex") + local cmd = engine + if checkformat == "latex" then + cmd = string.gsub (engine, "tex$", "latex") + end local logfile = testdir .. "/" .. name .. logext local lvtfile = name .. lvtext local newfile = testdir .. "/" .. name .. "." .. engine .. logext @@ -632,7 +651,7 @@ function checklvt (name, engine) if fileexists (testdir .. "/" .. name .. "." .. engine .. os_diffext) then print (" Check fails with diff file") print ( - " " .. testdir .. os_dirsep .. name .. "." .. engine .. os_diffext) + " " .. testdir .. "/" .. name .. "." .. engine .. os_diffext) else print (" Check passes") end @@ -643,6 +662,9 @@ end -- Remove all generated files function clean () + -- To make sure that distribdir never contains any stray subdirs, + -- it is entirely removed then recreated rather than simply deleting + -- all of the files rmdir (distribdir) mkdir (distribdir) cleandir (localdir) @@ -665,7 +687,7 @@ end -- Check commands are defined function cmdcheck () - cleandir (localdir) + mkdir (localdir) cleandir (testdir) depinstall (checkdeps) local engine = string.gsub (stdengine, "tex$", "latex") @@ -717,11 +739,9 @@ function ctan (standalone) end local errorlevel if standalone then - clean () errorlevel = check () bundle = module else - bundleclean () errorlevel = allmodules ("bundlecheck") end if errorlevel == 0 then @@ -791,6 +811,12 @@ function doc () local name = stripext (file) -- A couple of short functions to deal with the repeated steps in a -- clear way + local function glossary (name) + run ( + typesetdir , + "makeindex -s gglo.ist -o " .. name .. ".gls " .. name .. ".glo" + ) + end local function index (name) run ( typesetdir , @@ -817,17 +843,20 @@ function doc () print (" ! Compilation failed") return (errorlevel) else - for i = 1, 2 do -- Do twice - index (name) - typeset (file) + if fileexists (typesetdir .. "/" .. name .. ".idx") then + index (name) end + if fileexists (typesetdir .. "/" .. name .. ".glo") then + glossary (name) + end + typeset (file) + typeset (file) cp (name .. ".pdf", typesetdir, ".") end return (errorlevel) end -- Set up - cleandir (localdir) - mkdir (typesetdir) + cleandir (typesetdir) for _,i in ipairs (sourcefiles) do cp (i, ".", typesetdir) end @@ -835,9 +864,10 @@ function doc () cp (i, ".", typesetdir) end for _,i in ipairs (typesetsuppfiles) do - cp (i, supportdir, localdir) + cp (i, supportdir, typesetdir) end depinstall (typesetdeps) + unpack () -- Main loop for doc creation for _,i in ipairs (typesetfiles) do for _,j in ipairs (filelist (".", i)) do @@ -850,14 +880,6 @@ function doc () return 0 end --- Unpack then install -function localinstall () - unpack () - for _,i in ipairs (installfiles) do - cp (i, unpackdir, localdir) - end -end - -- Locally install files: only deals with those extracted, not docs etc. function install () unpack () @@ -892,13 +914,16 @@ end function unpack () depinstall (unpackdeps) bundleunpack () + for _,i in ipairs (installfiles) do + cp (i, unpackdir, localdir) + end end -- Split off from the main unpack so it can be used on a bundle and not -- leave only one modules files function bundleunpack () mkdir (localdir) - mkdir (unpackdir) + cleandir (unpackdir) for _,i in ipairs (sourcefiles) do cp (i, ".", unpackdir) end @@ -938,16 +963,7 @@ function stdmain (target, file, engine) -- apart from ctan all of the targets are then just mappings if module == "" then -- Detect all of the modules - modules = { } - for entry in lfs.dir (".") do - if entry ~= "." and entry ~= ".." then - local attr = lfs.attributes (entry) - assert (type (attr) == "table") - if attr.mode == "directory" then - table.insert (modules, entry) - end - end - end + modules = modules or listmodules () if target == "doc" then allmodules ("doc") elseif target == "check" then @@ -965,8 +981,6 @@ function stdmain (target, file, engine) elseif target == "install" then allmodules ("install") elseif target == "unpack" then - -- bundleunpack avoids cleaning out the dir, so do it once here - cleandir (unpackdir) allmodules ("bundleunpack") elseif target == "version" then version () @@ -1000,8 +1014,6 @@ function stdmain (target, file, engine) ctan (true) elseif target == "install" then install () - elseif target == "localinstall" then -- 'Hidden' target - localinstall () elseif target == "savetlg" and testfiledir ~= "" then if file then savetlg (file, engine) |