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/tex | |
parent | 6c2678db440b5260ec13602bde6efebdd00f8549 (diff) |
l3build
git-svn-id: svn://tug.org/texlive/trunk@34672 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3build/l3build.lua | 102 |
1 files changed, 57 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/tex/latex/l3build/l3build.lua index 99f68bdbc77..02a6f8c066c 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build.lua +++ b/Master/texmf-dist/tex/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) |