diff options
author | Karl Berry <karl@freefriends.org> | 2019-06-26 20:53:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-06-26 20:53:24 +0000 |
commit | 00ce1cef09943d8a78c8093e8c207db224596d58 (patch) | |
tree | 71efb67892f173bcc17c9f3c7c2936cbc1be7dc1 /Master/texmf-dist/scripts | |
parent | 5a828e3f77f32820a24b0d207e8e7e6ef8e2d188 (diff) |
l3build (26jun19)
git-svn-id: svn://tug.org/texlive/trunk@51478 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rw-r--r-- | Master/texmf-dist/scripts/l3build/l3build-check.lua | 8 | ||||
-rw-r--r-- | Master/texmf-dist/scripts/l3build/l3build-typesetting.lua | 196 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/l3build/l3build.lua | 2 |
3 files changed, 94 insertions, 112 deletions
diff --git a/Master/texmf-dist/scripts/l3build/l3build-check.lua b/Master/texmf-dist/scripts/l3build/l3build-check.lua index 301c0df1853..38e7f88a352 100644 --- a/Master/texmf-dist/scripts/l3build/l3build-check.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-check.lua @@ -98,7 +98,7 @@ end -- the 'business' part from the tests and removes system-dependent stuff local function normalize_log(content,engine,errlevels) local maxprintline = maxprintline - if match(engine,"^lua") then + if match(engine,"^lua") or match(engine,"^harf") then maxprintline = maxprintline + 1 -- Deal with an out-by-one error end local function killcheck(line) @@ -123,7 +123,9 @@ local function normalize_log(content,engine,errlevels) -- do this before wrapping lines line = gsub(line, "^l%.%d+ ", "l. ...") -- Also from lua stack traces. - line = gsub(line, "lua:%d+: in function", "lua:...: in function") + for str,_ in pairs({"field","function","upvalue"}) do + line = gsub(line, "lua:%d+: in " .. str, "lua:...: in " .. str) + end -- Allow for wrapped lines: preserve the content and wrap -- Skip lines that have an explicit marker for truncation if len(line) == maxprintline and @@ -637,7 +639,7 @@ function compare_tlg(name,engine,cleanup) 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 match(engine,"^lua") + if match(engine,"^lua") or match(engine,"harf") and not match(tlgfile, "%.luatex" .. "%" .. tlgext) and not match(stdengine,"^lua") then diff --git a/Master/texmf-dist/scripts/l3build/l3build-typesetting.lua b/Master/texmf-dist/scripts/l3build/l3build-typesetting.lua index 6ce80cdf7a3..5133d081719 100644 --- a/Master/texmf-dist/scripts/l3build/l3build-typesetting.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-typesetting.lua @@ -1,6 +1,6 @@ --[[ -File l3build-typesetting.lua Copyright (C) 2018 The LaTeX3 Project +File l3build-typesetting.lua Copyright (C) 2018,2019 The LaTeX3 Project It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -26,8 +26,14 @@ for those people who are interested. -- Auxiliary functions for typesetting: need to be generally available -- -local gsub = string.gsub -local match = string.match +local ipairs = ipairs +local pairs = pairs +local print = print + +local gsub = string.gsub +local match = string.match + +local os_type = os.type function dvitopdf(name, dir, engine, hide) if match(engine, "^u?ptex$") then @@ -51,37 +57,36 @@ function dvitopdf(name, dir, engine, hide) end -- An auxiliary used to set up the environmental variables -function runtool(subdir, dir, envvar, command) - dir = dir or "." - return( - run( - typesetdir .. "/" .. subdir, - (forcedocepoch and setepoch() or "") .. - -- Allow for local texmf files - os_setenv .. " TEXMFCNF=." .. os_pathsep - .. os_concat .. - os_setenv .. " " .. envvar .. "=." .. os_pathsep - .. abspath(localdir) .. os_pathsep - .. abspath(dir .. "/" .. subdir) - .. (typesetsearch and os_pathsep or "") - .. os_concat .. - command - ) - ) +function runcmd(cmd,dir,vars) + local dir = dir or "." + local dir = abspath(dir) + local vars = vars or {} + -- Allow for local texmf files + local env = os_setenv .. " TEXMFCNF=." .. os_pathsep + local envpaths = "." .. os_pathsep + .. abspath(localdir) .. os_pathsep + .. dir .. (typesetsearch and os_pathsep or "") + -- Deal with spaces in paths + if os_type == "windows" and match(envpaths," ") then + envpaths = gsub(envpaths,'"','') + end + for _,var in pairs(vars) do + env = env .. os_concat .. os_setenv .. " " .. var .. "=" .. envpaths + end + return run(dir,(forcedocepoch and setepoch() or "") .. env .. os_concat .. cmd) end -function biber(name, dir) - if fileexists(typesetdir .. "/" .. name .. ".bcf") then - local path, name = splitpath(name) - return( - runtool(path, dir, "BIBINPUTS", biberexe .. " " .. biberopts .. " " .. name) - ) +function biber(name,dir) + if fileexists(dir .. "/" .. name .. ".bcf") then + return + runcmd(biberexe .. " " .. biberopts .. " " .. name,dir,{"BIBINPUTS"}) end return 0 end -function bibtex(name, dir) - if fileexists(typesetdir .. "/" .. name .. ".aux") then +function bibtex(name,dir) + local dir = dir or "." + if fileexists(dir .. "/" .. name .. ".aux") then -- LaTeX always generates an .aux file, so there is a need to -- look inside it for a \citation line local grep @@ -90,103 +95,76 @@ function bibtex(name, dir) else grep = "\\\\\\\\" end - local path, name = splitpath(name) - if run( - typesetdir, + if run(dir, os_grepexe .. " \"^" .. grep .. "citation{\" " .. name .. ".aux > " .. os_null - ) + run( - typesetdir, + ) + run(dir, os_grepexe .. " \"^" .. grep .. "bibdata{\" " .. name .. ".aux > " .. os_null ) == 0 then - return( - -- Cheat slightly as we need to set two variables - runtool( - path, dir, - "BIBINPUTS", - os_setenv .. " BSTINPUTS=." .. os_pathsep - .. abspath(localdir) - .. (typesetsearch and os_pathsep or "") .. - os_concat .. - bibtexexe .. " " .. bibtexopts .. " " .. name - ) - ) + return runcmd(bibtexexe .. " " .. bibtexopts .. " " .. name,dir, + {"BIBINPUTS","BSTINPUTS"}) end end return 0 end -function makeindex(name, dir, inext, outext, logext, style) - if fileexists(typesetdir .. "/" .. name .. inext) then - local path, name = splitpath(name) +function makeindex(name,dir,inext,outext,logext,style) + local dir = dir or "." + if fileexists(dir .. "/" .. name .. inext) then if style == "" then style = nil end - return( - runtool( - path, dir, - "INDEXSTYLE", - makeindexexe .. " " .. makeindexopts - .. " -o " .. name .. outext - .. (style and (" -s " .. style) or "") - .. " -t " .. name .. logext .. " " .. name .. inext - ) - ) + return runcmd(makeindexexe .. " " .. makeindexopts + .. " -o " .. name .. outext + .. (style and (" -s " .. style) or "") + .. " -t " .. name .. logext .. " " .. name .. inext, + dir, + {"INDEXSTYLE"}) end return 0 end -function tex(file, dir) - local path, name = splitpath(file) - return( - runtool( - path, dir, - "TEXINPUTS", - typesetexe .. " " .. typesetopts .. " \"" .. typesetcmds - .. "\\input " .. name .. "\"" - ) - ) +function tex(file,dir) + local dir = dir or "." + return runcmd(typesetexe .. " " .. typesetopts .. " \"" .. typesetcmds + .. "\\input " .. file .. "\"", + dir,{"TEXINPUTS"}) end -function typesetpdf(file, dir) - local name = gsub(file, "%.[^.]+$", "") +local function typesetpdf(file,dir) + local dir = dir or "." + local name = jobname(file) print("Typesetting " .. name) - local errorlevel = typeset(file, dir) - if errorlevel == 0 then - name = name .. ".pdf" - os.remove(jobname(name)) - cp(name, typesetdir, docfiledir) - else + local errorlevel = typeset(file,dir) + if errorlevel ~= 0 then print(" ! Compilation failed") + return errorlevel end - return errorlevel + pdfname = name .. pdfext + rm(docfiledir,pdfname) + return cp(pdfname,dir,docfiledir) end -typeset = typeset or function(file, dir) +typeset = typeset or function(file,dir) dir = dir or "." - local errorlevel = tex(file, dir) + local errorlevel = tex(file,dir) if errorlevel ~= 0 then return errorlevel - else - local name = jobname(file) - errorlevel = biber(name, dir) + bibtex(name, dir) - if errorlevel == 0 then - local function cycle(name, dir) - return( - makeindex(name, dir, ".glo", ".gls", ".glg", glossarystyle) + - makeindex(name, dir, ".idx", ".ind", ".ilg", indexstyle) + - tex(file, dir) - ) - end - for i = 1, typesetruns do - errorlevel = cycle(name, dir) - if errorlevel ~= 0 then break end - end - end + end + local name = jobname(file) + errorlevel = biber(name,dir) + bibtex(name,dir) + if errorlevel ~= 0 then return errorlevel end + for i = 2,typesetruns do + errorlevel = + makeindex(name,dir,".glo",".gls",".glg",glossarystyle) + + makeindex(name,dir,".idx",".ind",".ilg",indexstyle) + + tex(file,dir) + if errorlevel ~= 0 then break end + end + return errorlevel end - -- A hook to allow additional typesetting of demos typeset_demo_tasks = typeset_demo_tasks or function() return 0 @@ -213,34 +191,36 @@ function doc(files) depinstall(typesetdeps) 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 - for j,_ in pairs(tree(dir, i)) do - if not done[j] then - j = gsub(j, "^%./", "") - -- Allow for command line selection of files + local done = {} + for _,typesetfiles in ipairs({typesetdemofiles,typesetfiles}) do + for _,glob in pairs(typesetfiles) do + for _,dir in ipairs({typesetdir,unpackdir}) do + for _,file in pairs(tree(dir,glob)) do + local path,srcname = splitpath(file) + local name = jobname(srcname) + if not done[name] then local typeset = true + -- Allow for command line selection of files if files and next(files) then typeset = false - for _,k in ipairs(files) do - if k == gsub(j, "%.[^.]+$", "") then + for _,file in pairs(files) do + if name == file then typeset = true break end end end + -- Now know if we should typeset this source if typeset then - local errorlevel = typesetpdf(j, dir) + local errorlevel = typesetpdf(srcname,path) if errorlevel ~= 0 then return errorlevel else - done[j] = true + done[name] = true end end end diff --git a/Master/texmf-dist/scripts/l3build/l3build.lua b/Master/texmf-dist/scripts/l3build/l3build.lua index 9d51648553a..0f6947cbbd9 100755 --- a/Master/texmf-dist/scripts/l3build/l3build.lua +++ b/Master/texmf-dist/scripts/l3build/l3build.lua @@ -25,7 +25,7 @@ for those people who are interested. --]] -- Version information -release_date = "2019-06-18" +release_date = "2019-06-26" -- File operations are aided by the LuaFileSystem module local lfs = require("lfs") |