diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3build/l3build.lua | 148 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3build/regression-test.tex | 25 |
2 files changed, 100 insertions, 73 deletions
diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/tex/latex/l3build/l3build.lua index 958c30e0d6c..f5b15f4088f 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build.lua @@ -16,14 +16,14 @@ and all files in that bundle must be distributed together. The development version of the bundle can be found at - https://github.com/latex3/latex3 + https://github.com/latex3/l3build for those people who are interested. --]] -- Version information -release_date = "2017/06/25" +release_date = "2017/07/01" -- "module" is a deprecated function in Lua 5.2: as we want the name -- for other purposes, and it should eventually be 'free', simply @@ -40,9 +40,16 @@ bundle = bundle or "" if module == "" and bundle == "" then if string.match(arg[0], "l3build%.lua$") then print( - "\n" - .. "Error: Call l3build using a configuration file, not directly.\n" + "\n" .. + "l3build: A testing and building system for LaTeX\n\n" .. + "Release " .. release_date ) + if arg[1] and not string.match(arg[1], "version") then + print( + "\n" + .. "Error: Call l3build using a configuration file, not directly.\n" + ) + end else print( "\n" @@ -222,35 +229,41 @@ local function argparse() { date = "date" , engine = "engine" , + force = "force" , ["halt-on-error"] = "halt" , ["halt-on-failure"] = "halt" , help = "help" , pdf = "pdf" , quiet = "quiet" , - release = "release" , - testfiledir = "testfiledir" + rerun = "rerun" , + testfiledir = "testfiledir", + version = "version" } local short_options = { d = "date" , e = "engine" , + f = "force" , h = "help" , H = "halt" , p = "pdf" , q = "quiet" , - r = "release" , - t = "testfiledir" + r = "rerun" , + t = "testfiledir", + v = "version" } local option_args = { date = true , engine = true , + force = false, halt = false, help = false, pdf = false, quiet = false, - release = true, - testfiledir = true + rerun = false, + testfiledir = true , + version = true } local args = args -- arg[1] is a special case: must be a command or "-h"/"--help" @@ -357,10 +370,32 @@ options = argparse() local optdate = options["date"] local optengines = options["engine"] +local optforce = options["force"] local opthalt = options["halt"] local optpdf = options["pdf"] local optquiet = options["quiet"] -local optrelease = options["release"] +local optrerun = options["rerun"] +local optversion = options["version"] + +-- Sanity check +if optengines and not optforce then + -- Make a lookup table + local t = { } + for _, engine in pairs(checkengines) do + t[engine] = true + end + for _, engine in pairs(optengines) do + if not t[engine] then + print("\n! Error: Engine \"" .. engine .. "\" not set up for testing!") + print("\n Valid values are:") + for _, engine in ipairs(checkengines) do + print(" - " .. engine) + end + print("") + exit(1) + end + end +end -- Convert a file glob into a pattern for use by e.g. string.gub -- Based on https://github.com/davidm/lua-glob-pattern @@ -673,20 +708,12 @@ end -- -- Do some subtarget for all modules in a bundle -local function allmodules(target) - local date = "" - if optdate then - date = " --date=" .. optdate[1] - end - local engines = "" - if optengines then - engines = " --engine=" .. concat(optengines, ",") +function call(dirs, target) + local s = "" + for i = 2, #arg do + s = s .. " " .. arg[i] end - local release = "" - if optrelease then - release = " --release=" .. optrelease[1] - end - for _,i in ipairs(modules) do + for _,i in ipairs(dirs) do print( "Running script " .. scriptname .. " with target \"" .. target .. "\" for module " @@ -694,13 +721,7 @@ local function allmodules(target) ) local errorlevel = run( i, - "texlua " .. scriptname .. " " .. target - .. (opthalt and " -H" or "") - .. date - .. engines - .. (optpdf and " -p" or "") - .. (optquiet and " -q" or "") - .. release + "texlua " .. scriptname .. " " .. target .. s ) if errorlevel ~= 0 then return errorlevel @@ -1390,6 +1411,8 @@ function runtest(name, engine, hide, ext, makepdf) .. os_concat .. os_setenv .. " SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1" .. os_concat .. + os_setenv .. " FORCE_SOURCE_DATE=1" + .. os_concat .. -- Ensure lines are of a known length os_setenv .. " max_print_line=" .. maxprintline .. os_concat .. @@ -1637,11 +1660,13 @@ function help() print("Valid options are:") print(" --date|-d Sets the date to insert into sources") print(" --engine|-e Sets the engine to use for running test") + print(" --force|-f Force tests to run if engine is not set up") print(" --halt-on-error|-H Stops running tests after the first failure") print(" --pdf|-p Check/save PDF files") print(" --quiet|-q Suppresses TeX output when unpacking") - print(" --release|-r Sets the release to insert into sources") + print(" --rerun|-r Runs tests without any unpacking, etc.") print(" --testfiledir|-t Selects the specified testfile location") + print(" --version|-v Sets the version to insert into sources") print("") print("See l3build.pdf for further details.") end @@ -1649,7 +1674,9 @@ end function check(names) local errorlevel = 0 if testfiledir ~= "" and direxists(testfiledir) then - checkinit() + if not optrerun then + checkinit() + end local hide = true if names and next(names) then hide = false @@ -1740,7 +1767,7 @@ function clean() end function bundleclean() - local errorlevel = allmodules("clean") + local errorlevel = call(modules, "clean") for _,i in ipairs(cleanfiles) do errorlevel = rm(".", i) + errorlevel end @@ -1824,7 +1851,7 @@ function ctan(standalone) errorlevel = check() bundle = module else - errorlevel = allmodules("bundlecheck") + errorlevel = call(modules, "bundlecheck") end if errorlevel == 0 then rmdir(ctandir) @@ -1834,7 +1861,7 @@ function ctan(standalone) if standalone then errorlevel = bundlectan() else - errorlevel = allmodules("bundlectan") + errorlevel = call(modules, "bundlectan") end else print("\n====================") @@ -1897,7 +1924,7 @@ function bundlectan() end -- For the purposes here, any typesetting demo files need to be -- part of the main typesetting list - local typesetfiles + local typesetfiles = typesetfiles for _,v in pairs(typesetdemofiles) do insert(typesetfiles, v) end @@ -2025,7 +2052,7 @@ end -- Provide some standard search-and-replace functions if versionform ~= "" and not setversion_update_line then if versionform == "ProvidesPackage" then - function setversion_update_line(line, date, release) + function setversion_update_line(line, date, version) -- No real regex so do it one type at a time for _,i in pairs({"Class", "File", "Package"}) do if match( @@ -2035,7 +2062,7 @@ if versionform ~= "" and not setversion_update_line then line = gsub(line, "%[%d%d%d%d/%d%d/%d%d", "[" .. gsub(date, "%-", "/")) line = gsub( - line, "(%[%d%d%d%d/%d%d/%d%d) [^ ]*", "%1 " .. release + line, "(%[%d%d%d%d/%d%d/%d%d) [^ ]*", "%1 " .. version ) break end @@ -2043,7 +2070,7 @@ if versionform ~= "" and not setversion_update_line then return line end elseif versionform == "ProvidesExplPackage" then - function setversion_update_line(line, date, release) + function setversion_update_line(line, date, version) -- No real regex so do it one type at a time for _,i in pairs({"Class", "File", "Package"}) do if match( @@ -2053,7 +2080,7 @@ if versionform ~= "" and not setversion_update_line then line = gsub( line, "{%d%d%d%d/%d%d/%d%d}( *){[^}]*}", - "{" .. gsub(date, "%-", "/") .. "}%1{" .. release .. "}" + "{" .. gsub(date, "%-", "/") .. "}%1{" .. version .. "}" ) break end @@ -2061,22 +2088,22 @@ if versionform ~= "" and not setversion_update_line then return line end elseif versionform == "filename" then - function setversion_update_line(line, date, release) + function setversion_update_line(line, date, version) if match(line, "^\\def\\filedate{%d%d%d%d/%d%d/%d%d}$") then line = "\\def\\filedate{" .. gsub(date, "%-", "/") .. "}" end if match(line, "^\\def\\fileversion{[^}]+}$") then - line = "\\def\\fileversion{" .. release .. "}" + line = "\\def\\fileversion{" .. version .. "}" end return line end elseif versionform == "ExplFileDate" then - function setversion_update_line(line, date, release) + function setversion_update_line(line, date, version) if match(line, "^\\def\\ExplFileDate{%d%d%d%d/%d%d/%d%d}$") then line = "\\def\\ExplFileDate{" .. gsub(date, "%-", "/") .. "}" end if match(line, "^\\def\\ExplFileVersion{[^}]+}$") then - line = "\\def\\ExplFileVersion{" .. release .. "}" + line = "\\def\\ExplFileVersion{" .. version .. "}" end return line end @@ -2084,16 +2111,16 @@ if versionform ~= "" and not setversion_update_line then end -- Used to actually carry out search-and-replace -setversion_update_line = setversion_update_line or function(line, date, release) +setversion_update_line = setversion_update_line or function(line, date, version) return line end function setversion(dir) - local function rewrite(dir, file, date, release) + local function rewrite(dir, file, date, version) local changed = false local result = "" for line in lines(dir .. "/" .. file) do - local newline = setversion_update_line(line, date, release) + local newline = setversion_update_line(line, date, version) if newline ~= line then line = newline changed = true @@ -2121,14 +2148,14 @@ function setversion(dir) if optdate then date = optdate[1] or date end - local release = -1 - if optrelease then - release = optrelease[1] or release + local version = -1 + if optversion then + version = optversion[1] or version end local dir = dir or "." for _,i in pairs(versionfiles) do for _,j in pairs(filelist(dir, i)) do - rewrite(dir, j, date, release) + rewrite(dir, j, date, version) end end return 0 @@ -2210,8 +2237,9 @@ end function version() print( - "\n" - .. "l3build Release " .. gsub(release_date, "/", "-") .. "\n" + "\n" .. + "l3build: A testing and building system for LaTeX\n\n" .. + "Release " .. release_date ) end @@ -2227,28 +2255,28 @@ function stdmain(target, files) -- Detect all of the modules modules = modules or listmodules() if target == "doc" then - errorlevel = allmodules("doc") + errorlevel = call(modules, "doc") elseif target == "check" then - errorlevel = allmodules("bundlecheck") + errorlevel = call(modules, "bundlecheck") if errorlevel ~=0 then print("There were errors: checks halted!\n") end elseif target == "clean" then errorlevel = bundleclean() elseif target == "cmdcheck" and next(cmdchkfiles) ~= nil then - errorlevel = allmodules("cmdcheck") + errorlevel = call(modules, "cmdcheck") elseif target == "ctan" then errorlevel = ctan() elseif target == "install" then - errorlevel = allmodules("install") + errorlevel = call(modules, "install") elseif target == "setversion" then - errorlevel = allmodules("setversion") + errorlevel = call(modules, "setversion") -- Deal with any files in the bundle dir itself if errorlevel == 0 then errorlevel = setversion() end elseif target == "unpack" then - errorlevel = allmodules("bundleunpack") + errorlevel = call(modules, "bundleunpack") elseif target == "version" then version() else diff --git a/Master/texmf-dist/tex/latex/l3build/regression-test.tex b/Master/texmf-dist/tex/latex/l3build/regression-test.tex index eae274e09f6..4c12a1d5444 100644 --- a/Master/texmf-dist/tex/latex/l3build/regression-test.tex +++ b/Master/texmf-dist/tex/latex/l3build/regression-test.tex @@ -101,30 +101,29 @@ ============================================================% }% } -\long\def\TEST#1#2{% +\protected\long\def\BEGINTEST#1{% \global\advance\gTESTint by 1 % \SEPARATOR \LONGTYPEOUT{TEST \the\gTESTint: \detokenize{#1}}% \SEPARATOR \begingroup \let\TYPE\LONGTYPEOUT - #2% + +} +\protected\long\def\ENDTEST{% \endgroup \SEPARATOR \LONGTYPEOUT{}% } +\long\def\TEST#1#2{% + \BEGINTEST{#1}% + #2% + \ENDTEST +} \long\def\TESTEXP#1#2{% - \global\advance\gTESTint by 1 % - \SEPARATOR - \LONGTYPEOUT{% - TEST \the\gTESTint: \detokenize{#1}}% - \SEPARATOR - \begingroup - \long\def\TYPE##1{##1}% - \LONGTYPEOUT{#2}% - \endgroup - \SEPARATOR - \LONGTYPEOUT{}% + \BEGINTEST{#1}% + \LONGTYPEOUT{#2}% + \ENDTEST } \def \TRUE {\TYPE{TRUE}} \def \FALSE {\TYPE{FALSE}} |