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 --- .../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 +- 10 files changed, 117 insertions(+), 47 deletions(-) (limited to 'Master/texmf-dist/tex/latex/l3build') 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