From 10547251f700736da2801a4ee4e78a64dff741c9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 27 Jan 2018 22:10:49 +0000 Subject: l3build (27jan18) git-svn-id: svn://tug.org/texlive/trunk@46466 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/l3build/README.md | 2 +- Master/texmf-dist/doc/latex/l3build/l3build.pdf | Bin 671468 -> 672324 bytes Master/texmf-dist/source/latex/l3build/build.lua | 2 +- .../source/latex/l3build/config-plain.lua | 2 + Master/texmf-dist/source/latex/l3build/l3build.dtx | 25 ++++++----- Master/texmf-dist/source/latex/l3build/plain.lua | 2 - .../tex/latex/l3build/l3build-arguments.lua | 10 +++++ .../texmf-dist/tex/latex/l3build/l3build-check.lua | 48 +++++++++++++++------ .../texmf-dist/tex/latex/l3build/l3build-ctan.lua | 43 ++++++++---------- .../tex/latex/l3build/l3build-file-functions.lua | 6 ++- .../texmf-dist/tex/latex/l3build/l3build-help.lua | 1 + .../tex/latex/l3build/l3build-install.lua | 41 +++++++++++++++--- .../tex/latex/l3build/l3build-stdmain.lua | 4 ++ .../tex/latex/l3build/l3build-typesetting.lua | 6 ++- .../tex/latex/l3build/l3build-variables.lua | 3 ++ Master/texmf-dist/tex/latex/l3build/l3build.lua | 2 +- 16 files changed, 136 insertions(+), 61 deletions(-) create mode 100644 Master/texmf-dist/source/latex/l3build/config-plain.lua delete mode 100644 Master/texmf-dist/source/latex/l3build/plain.lua diff --git a/Master/texmf-dist/doc/latex/l3build/README.md b/Master/texmf-dist/doc/latex/l3build/README.md index 90bacc50185..e6e21ed5ece 100644 --- a/Master/texmf-dist/doc/latex/l3build/README.md +++ b/Master/texmf-dist/doc/latex/l3build/README.md @@ -1,7 +1,7 @@ l3build: a testing and building system for LaTeX3 ================================================= -Release 2018/01/10 +Release 2018/01/27 Overview -------- diff --git a/Master/texmf-dist/doc/latex/l3build/l3build.pdf b/Master/texmf-dist/doc/latex/l3build/l3build.pdf index 2b17667e936..cd72687e10f 100644 Binary files a/Master/texmf-dist/doc/latex/l3build/l3build.pdf and b/Master/texmf-dist/doc/latex/l3build/l3build.pdf differ diff --git a/Master/texmf-dist/source/latex/l3build/build.lua b/Master/texmf-dist/source/latex/l3build/build.lua index 08653cb0261..0a6bc7ceb55 100644 --- a/Master/texmf-dist/source/latex/l3build/build.lua +++ b/Master/texmf-dist/source/latex/l3build/build.lua @@ -7,7 +7,7 @@ module = "l3build" bundle = "" -- Non-standard settings -checkconfigs = {"build", "plain"} +checkconfigs = {"build", "config-plain"} checkdeps = { } checkengines = {"pdftex", "xetex", "luatex", "ptex", "uptex"} cleanfiles = {"*.pdf", "*.tex", "*.zip"} diff --git a/Master/texmf-dist/source/latex/l3build/config-plain.lua b/Master/texmf-dist/source/latex/l3build/config-plain.lua new file mode 100644 index 00000000000..b59b2c110ce --- /dev/null +++ b/Master/texmf-dist/source/latex/l3build/config-plain.lua @@ -0,0 +1,2 @@ +checkformat = "tex" +testfiledir = "testfiles-plain" \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/l3build/l3build.dtx b/Master/texmf-dist/source/latex/l3build/l3build.dtx index b022225a56b..7c92dae5a29 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.dtx +++ b/Master/texmf-dist/source/latex/l3build/l3build.dtx @@ -147,6 +147,7 @@ \luavarset{asciiengines}{\{"pdftex"\}}{Engines which should log as sure ASCII} \luavarset{checkruns} {1} {Number of runs to complete for a test before comparing the log} \luavarset{epoch} {1463734800} {Epoch (Unix date) to set for test runs} +\luavarset{flatten} {true} {Switch to flatten any source structure when sending to CTAN} \luavarset{maxprintline}{79} {Length of line to use in log files} \luavarset{packtdszip} {false} {Switch to build a TDS-style zip file for CTAN} \luavarset{scriptname} {"build.lua"} {Name of script used in dependencies} @@ -216,7 +217,7 @@ % }^^A % } % -% \date{Released 2018/01/10} +% \date{Released 2018/01/27} % % \maketitle % \tableofcontents @@ -319,12 +320,14 @@ % \item \texttt{--engine} (\texttt{-e}) Sets the engine to use for % testing % \item \texttt{--epoch} Sets the epoch for typesetting and testing +% \item \texttt{--first} Name of the first test to run % \item \texttt{--force} (\texttt{-f}) Force checks to run even if sanity % checks fail, \emph{e.g.}~when \texttt{--engine} is not given in % \luavar{checkengines} % \item \texttt{--halt-on-error} (\texttt{-H}) Specifies that checks % should stop as soon as possible, rather than running all requested % tests; the difference file is printed in the terminal directly in the case of failure +% \item \texttt{--last} Name of the last test to run % \item \texttt{--pdf} (\texttt{-p}) Test PDF file against a reference % version rather than using a log comparison % \item \texttt{--quiet} (\texttt{-q}) Suppresses output from unpacking @@ -655,7 +658,7 @@ % 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 +% 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 @@ -664,16 +667,16 @@ % 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 +% \begin{figure} +% \begin{lstlisting}[frame=single,language={[5.2]Lua},gobble = 6] +% -- Special config for these tests % checksearch = true % checkengines = {"xetex","luatex"} % testfiledir = "testfiles-TU" -% \end{lstlisting} -% \caption{The build script for the \pkg{xparse} module.} -% \label{fig:configs} -% \end{figure} +% \end{lstlisting} +% \caption{Example of using additional (or overriding) settings for configuring tests in a different subdirectory.} +% \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 @@ -726,7 +729,9 @@ % 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. +% tree locations. With the standard settings, this structure will be removed +% when creating a CTAN release: the variable \var{flatten} may be +% used to control this behavior. % % A series of example layouts and matching |build.lua| files are available from % \url{https://github.com/latex3/l3build/tree/master/examples}. diff --git a/Master/texmf-dist/source/latex/l3build/plain.lua b/Master/texmf-dist/source/latex/l3build/plain.lua deleted file mode 100644 index b59b2c110ce..00000000000 --- a/Master/texmf-dist/source/latex/l3build/plain.lua +++ /dev/null @@ -1,2 +0,0 @@ -checkformat = "tex" -testfiledir = "testfiles-plain" \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-arguments.lua b/Master/texmf-dist/tex/latex/l3build/l3build-arguments.lua index 83129a071f4..b1d5b44ac0a 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-arguments.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-arguments.lua @@ -56,6 +56,11 @@ option_list = desc = "Sets the epoch for tests and typesetting", type = "string" }, + first = + { + desc = "Name of first test to run", + type = "string" + }, force = { desc = "Force tests to run if engine is not set up", @@ -85,6 +90,11 @@ option_list = short = "q", type = "boolean" }, + last = + { + desc = "Name of last test to run", + type = "string" + }, rerun = { desc = "Skip setup: simply rerun tests", diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-check.lua b/Master/texmf-dist/tex/latex/l3build/l3build-check.lua index 617fa56a0c6..40c28561253 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-check.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-check.lua @@ -37,6 +37,7 @@ local gmatch = string.gmatch local gsub = string.gsub local match = string.match +local insert = table.insert local sort = table.sort local utf8_char = unicode.utf8.char @@ -316,6 +317,8 @@ local function formatlualog(logfile, newfile) -- The first time a new font is used, it shows up -- as being cached line = gsub(line, "(save cache:", "(load cache:") + -- Changes in PDF specials + line = gsub(line, "\\pdfliteral origin", "\\pdfliteral") -- A function to handle the box prefix part local function boxprefix(s) return gsub(match(s, "^(%.+)"), "%.", "%%.") @@ -543,9 +546,7 @@ function compare_pdf(name, engine) if not refpdffile then return end - if os_type == "windows" then - refpdffile = unix_to_win(refpdffile) - end + refpdffile = unix_to_win(refpdffile) errorlevel = execute( os_cmpexe .. " " .. refpdffile .. " " .. pdffile .. " > " .. cmpfile ) @@ -564,9 +565,6 @@ function compare_tlg(name, engine) if not tlgfile then return end - if os_type == "windows" then - tlgfile = unix_to_win(tlgfile) - end -- Do additional log formatting if the engine is LuaTeX, there is no -- LuaTeX-specific .tlg file and the default engine is not LuaTeX if engine == "luatex" @@ -575,16 +573,16 @@ function compare_tlg(name, engine) and stdengine ~= "luajittex" then local luatlgfile = testdir .. "/" .. name .. ".luatex" .. tlgext - if os_type == "windows" then - luatlgfile = unix_to_win(luatlgfile) - end formatlualog(tlgfile, luatlgfile) formatlualog(logfile, logfile) -- This allows code sharing below: we only need the .tlg name in one place tlgfile = luatlgfile end errorlevel = execute( - os_diffexe .. " " .. tlgfile .. " " .. logfile .. " > " .. difffile + os_diffexe .. " " + .. unix_to_win(tlgfile) .. " " + .. unix_to_win(logfile) .. " > " + .. unix_to_win(difffile) ) if errorlevel == 0 then os.remove(difffile) @@ -717,17 +715,43 @@ function check(names) -- No names passed: find all test files if not next(names) then for _,i in pairs(filelist(testfiledir, "*" .. lvtext)) do - table.insert(names, jobname(i)) + insert(names, jobname(i)) end for _,i in ipairs(filelist(unpackdir, "*" .. lvtext)) do if fileexists(testfiledir .. "/" .. i) then print("Duplicate test file: " .. i) return 1 else - table.insert(names, jobname(i)) + insert(names, jobname(i)) end end sort(names) + -- Deal limiting range of names + if options["first"] then + local allnames = names + local active = false + local firstname = options["first"] + names = { } + for _,name in ipairs(allnames) do + if name == firstname then + active = true + end + if active then + insert(names,name) + end + end + end + if options["last"] then + local allnames = names + local lastname = options["last"] + names = { } + for _,name in ipairs(allnames) do + insert(names,name) + if name == lastname then + break + end + end + end end -- https://stackoverflow.com/a/32167188 local function shuffle(tbl) diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-ctan.lua b/Master/texmf-dist/tex/latex/l3build/l3build-ctan.lua index 47688349d8e..ed29399a2d3 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-ctan.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-ctan.lua @@ -27,34 +27,27 @@ local insert = table.insert -- Copy files to the main CTAN release directory function copyctan() - local ctantarget = ctanpkg - if docfiledir ~= currentdir then - ctantarget = ctanpkg .. "/" .. gsub(docfiledir, "^%.*/", "") - end - mkdir(ctandir .. "/" .. ctantarget) - for _,filetype in pairs( - { - bibfiles, - demofiles, - docfiles, - pdffiles, - typesetlist - } - ) do - for _,file in pairs(filetype) do - cp(file, docfiledir, ctandir .. "/" .. ctantarget) + mkdir(ctandir .. "/" .. ctanpkg) + local function copyfiles(files,source) + if source == currentdir or flatten then + for _,filetype in pairs(files) do + cp(filetype,source,ctandir .. "/" .. ctanpkg) + end + else + for _,filetype in pairs(files) do + for _,file in pairs(tree(source,filetype)) do + local path,file = splitpath(file) + local ctantarget = ctandir .. "/" .. ctanpkg .. "/" .. path + mkdir(ctantarget) + cp(file,source,ctantarget) + end + end 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) + for _,tab in pairs({bibfiles,demofiles,docfiles,pdffiles,typesetlist}) do + copyfiles(tab,docfiledir) end + copyfiles(sourcefiles,sourcefiledir) for _,file in pairs(textfiles) do cp(file, currentdir, ctandir .. "/" .. ctanpkg) end diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-file-functions.lua b/Master/texmf-dist/tex/latex/l3build/l3build-file-functions.lua index d85a3d203d2..71311bf51c1 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-file-functions.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-file-functions.lua @@ -364,7 +364,11 @@ end -- Deal with the fact that Windows and Unix use different path separators function unix_to_win(path) - return gsub(path, "/", "\\") + if os_type == "windows" then + return gsub(path, "/", "\\") + else + return path + end end diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-help.lua b/Master/texmf-dist/tex/latex/l3build/l3build-help.lua index 656f82999ab..7226cfa896c 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-help.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-help.lua @@ -47,6 +47,7 @@ function help() print(" save Saves test validation log") end print(" setversion Update version information in sources") + print(" uninstall Uninstalls files from the local texmf tree") print(" unpack Unpacks the source files into the build tree") print("") print("Valid options are:") diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-install.lua b/Master/texmf-dist/tex/latex/l3build/l3build-install.lua index dd1526a0473..5fea175d377 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-install.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-install.lua @@ -22,6 +22,36 @@ for those people who are interested. --]] +local pairs = pairs +local print = print + +local set_program = kpse.set_program_name +local var_value = kpse.var_value + +local function gethome() + set_program("latex") + return options["texmfhome"] or var_value("TEXMFHOME") +end + +function uninstall() + local installdir = gethome() .. "/tex/" .. moduledir + if options["dry-run"] then + print("\n" .. "Installation root: " .. installdir) + local files = filelist(installdir) + -- Deal with an empty directory + if next(files) then + print("\n" .. "Files for removal:") + for _,file in pairs(filelist(installdir)) do + print("- " .. file) + end + else + print("No files present") + end + return 0 + else + return rmdir(installdir) + end +end -- Locally install files: only deals with those extracted, not docs etc. function install() @@ -29,24 +59,23 @@ function install() if errorlevel ~= 0 then return errorlevel end - kpse.set_program_name("latex") - local texmfhome = options["texmfhome"] or kpse.var_value("TEXMFHOME") - local installdir = texmfhome .. "/tex/" .. moduledir + local installdir = gethome() .. "/tex/" .. moduledir if options["dry-run"] then print("\n" .. "Installation root: " .. installdir - .. "\n" .. "Intallation files:" + .. "\n" .. "Installation files:" ) - for _,filetype in ipairs(installfiles) do + for _,filetype in pairs(installfiles) do for _,file in pairs(filelist(unpackdir,filetype)) do print("- " .. file) end end + return 0 else errorlevel = cleandir(installdir) if errorlevel ~= 0 then return errorlevel end - for _,filetype in ipairs(installfiles) do + for _,filetype in pairs(installfiles) do errorlevel = cp(filetype, unpackdir, installdir) if errorlevel ~= 0 then return errorlevel diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-stdmain.lua b/Master/texmf-dist/tex/latex/l3build/l3build-stdmain.lua index d8cd8da6278..200afa99329 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-stdmain.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-stdmain.lua @@ -72,6 +72,8 @@ function stdmain(target, files) if errorlevel == 0 then errorlevel = setversion() end + elseif target == "uninstall" then + errorlevel = call(modules, "uninstall") elseif target == "unpack" then errorlevel = call(modules, "bundleunpack") elseif target == "version" then @@ -107,6 +109,8 @@ function stdmain(target, files) end elseif target == "setversion" then errorlevel = setversion() + elseif target == "uninstall" then + errorlevel = uninstall() elseif target == "unpack" then errorlevel = unpack() elseif target == "version" then diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-typesetting.lua b/Master/texmf-dist/tex/latex/l3build/l3build-typesetting.lua index 46feb0375d7..229745dafc6 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-typesetting.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-typesetting.lua @@ -117,12 +117,14 @@ end function makeindex(name, dir, inext, outext, logext, style) if fileexists(typesetdir .. "/" .. name .. inext) then local path, name = splitpath(name) + if style == "" then style = nil end return( runtool( path, dir, "INDEXSTYLE", - makeindexexe .. " " .. makeindexopts .. " " - .. " -s " .. style .. " -o " .. name .. outext + makeindexexe .. " " .. makeindexopts + .. " -o " .. name .. outext + .. (style and (" -s " .. style) or "") .. " -t " .. name .. " " .. name .. inext ) ) diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-variables.lua b/Master/texmf-dist/tex/latex/l3build/l3build-variables.lua index 7115d1f86ae..d531be2dca8 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-variables.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-variables.lua @@ -177,6 +177,9 @@ end asciiengines = asciiengines or {"pdftex"} checkruns = checkruns or 1 epoch = epoch or 1463734800 +if flatten == nil then + flatten = true +end maxprintline = maxprintline or 79 packtdszip = packtdszip or false scriptname = scriptname or "build.lua" diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/tex/latex/l3build/l3build.lua index b18c2cbea87..947079b6e9f 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build.lua @@ -23,7 +23,7 @@ for those people who are interested. --]] -- Version information -release_date = "2018/01/10" +release_date = "2018/01/27" -- File operations are aided by the LuaFileSystem module local lfs = require("lfs") -- cgit v1.2.3