diff options
author | Karl Berry <karl@freefriends.org> | 2014-11-21 22:35:43 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-11-21 22:35:43 +0000 |
commit | a5904a024e3d8bac40e5e80452e1dd3af40a3fe6 (patch) | |
tree | 2d5546523782b4837b51616d275d7e6272459742 /Master/texmf-dist/source | |
parent | f28a59950c355ca1760a49ea5309b10594155e4f (diff) |
l3build (21nov14)
git-svn-id: svn://tug.org/texlive/trunk@35640 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/l3build/l3build.dtx | 12 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/l3build/l3build.lua | 139 |
2 files changed, 98 insertions, 53 deletions
diff --git a/Master/texmf-dist/source/latex/l3build/l3build.dtx b/Master/texmf-dist/source/latex/l3build/l3build.dtx index daf670e9666..71746aa523d 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.dtx +++ b/Master/texmf-dist/source/latex/l3build/l3build.dtx @@ -100,8 +100,10 @@ \luavarset{cleanfiles} {\{"*.pdf", "*.zip"\}}{Files to delete when cleaning.} \luavarset{excludefiles} {\{"*\string~"\}} {Files to ignore entirely (default for Emacs backup files).} \luavarset{installfiles} {\{"*.sty"\}} {Files to install to the \TeX{} tree and similar tasks.} +\luavarset{makeindexfiles} { }{MakeIndex files to be included in a TDS-style zip} +\luavarset{readmefiles} {\{"*.md", "*.markdown", "*.txt"\}} {Files which should have the extension removed when sent to CTAN.} \luavarset{sourcefiles} {\{"*.dtx", "*.ins"\}}{Files to copy for unpacking.} -\luavarset{txtfiles} {\{"*.markdown"\}} {Files which should have the extension removed when sent to CTAN.} +\luavarset{textfiles} {\{ \}}{Plain text files to send to CTAN as-is.} \luavarset{typesetfiles} {\{"*.dtx"\}} {Files to typeset for documentation.} \luavarset{typesetsuppfiles}{\{~\}} {Files needed to support typesetting when \enquote{sandboxed}.} \luavarset{unpackfiles} {\{"*.ins"\}} {Files to run to perform unpacking.} @@ -133,6 +135,9 @@ \luavarset{typesetsearch}{true} {Look in \texttt{tds} dirs for typesetting docs?} \luavarset{unpacksearch} {true} {Look in \texttt{tds} dirs for unpacking?} \luavarseparator +\luavarset{glossarystyle}{"gglo.ist"}{MakeIndex style file for glossary/changes creation} +\luavarset{indexstyle} {"gind.ist"}{MakeIndex style for index creation} +\luavarseparator \luavarset{checkruns} {1} {How many times to run a check file before comparing the log.} \luavarset{packtdszip} {false} {Build a TDS-style zip file for CTAN?} \luavarset{scriptname} {"build.lua"} {Name of script used in dependencies.} @@ -363,8 +368,9 @@ % The |doc| tree is constructed from: % \begin{itemize} % \item all files matched by \var{demofiles}, and -% \item all files matched by \var{typesetfiles} with their extension replaced with |.pdf|, and -% \item all files matched by \var{txtfiles}, but when copied their extension is entirely removed (e.g., |README.markdown| is copied as just |README|). +% \item all files matched by \var{typesetfiles} with their extension replaced with |.pdf|, +% \item all files matched by \var{textfiles}, and +% \item all files matched by \var{readmefiles}, but when copied their extension is entirely removed (e.g., |README.markdown| is copied as just |README|). % \end{itemize} % The |source| tree is constructed from all files matched by \var{typesetfiles} and \var{sourcefiles}. % The |tex| tree from all files matched by \var{installfiles}. diff --git a/Master/texmf-dist/source/latex/l3build/l3build.lua b/Master/texmf-dist/source/latex/l3build/l3build.lua index 3abb619392b..2b20e41474e 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.lua +++ b/Master/texmf-dist/source/latex/l3build/l3build.lua @@ -17,8 +17,8 @@ --]] -- Version information: should be identical to that in l3build.dtx -release_date = "2014/09/15" -release_ver = "5423" +release_date = "2014/11/21" +release_ver = "5462" -- "module" is a deprecated function in Lua 5.2: as we want the name -- for other purposes, and it should eventually be 'free', simply @@ -86,8 +86,10 @@ demofiles = demofiles or { } cleanfiles = cleanfiles or {"*.pdf", "*.zip"} excludefiles = excludefiles or {"*~"} -- Any Emacs stuff installfiles = installfiles or {"*.sty"} +makeindexfiles = makeindexfiles or { } +readmefiles = readmefiles or {"*.md", "*.markdown", "*.txt"} sourcefiles = sourcefiles or {"*.dtx", "*.ins"} -- Files to copy for unpacking -txtfiles = txtfiles or {"*.md", "*.markdown"} +textfiles = textfiles or { } typesetfiles = typesetfiles or {"*.dtx"} typesetsuppfiles = typesetsuppfiles or { } unpackfiles = unpackfiles or {"*.ins"} -- Files to actually unpack @@ -112,7 +114,7 @@ zipopts = zipopts or "-v -r -X" -- Engines for testing checkengines = checkengines or {"pdftex", "xetex", "luatex"} checkformat = checkformat or "latex" -stdengine = stdengine or "pdftex" +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 @@ -127,6 +129,10 @@ if unpacksearch == nil then unpacksearch = true end +-- Additional settings to fine-tune typesetting +glossarystyle = glossarystyle or "gglo.ist" +indexstyle = indexstyle or "gind.ist" + -- Other required settings checkruns = checkruns or 1 packtdszip = packtdszip or false -- Not actually needed but clearer @@ -228,14 +234,16 @@ if string.sub (package.config, 1, 1) == "\\" then os_pathsep = ";" os_setenv = "set" os_windows = true + os_yes = "for /l %I in (1,1,200) do @echo y" else os_concat = ";" os_diffext = ".diff" - os_diffexe = "diff -c" + os_diffexe = "diff -c --strip-trailing-cr" os_null = "/dev/null" os_pathsep = ":" os_setenv = "export" os_windows = false + os_yes = "printf 'y\\n%.0s' {1..200}" end -- File operations are aided by the LuaFileSystem module, which is available @@ -439,8 +447,8 @@ function formatlog (logfile, newfile) then line = "" elseif - -- Various things that only LuaTeX adds to boxes: at least while - -- we don't have bidi tests these lines can be removed + -- Various things that only LuaTeX adds to boxes: + -- Remove the 'no-op' versions string.match (line, "^%.*\\whatsit$") or string.match (line, "^%.*\\localinterlinepenalty=0$") or string.match (line, "^%.*\\localbrokenpenalty=0$") or @@ -462,7 +470,18 @@ function formatlog (logfile, newfile) local function normalize (line) local line = line -- Remove test file name from lines - line = string.gsub (line, string.match (logfile, ".*/(.*)%" .. logext .. "$"), "") + -- This needs ato extract the base name from the log name, + -- and one to allow for the case that there might be "-" chars + -- in the name (other cases are ignored) + line = string.gsub ( + line, + string.gsub ( + string.match ("/" .. logfile, ".*/(.*)%" .. logext .. "$"), + "-", + "%%-" + ), + "" + ) -- Zap ./ at begin of filename line = string.gsub (line, "%(%.%/", "(") -- Zap paths if places other than 'here' are accessible @@ -489,7 +508,8 @@ function formatlog (logfile, newfile) line = string.gsub ( line, "glue set (%d+.%d%d%d%d)%dfil", "glue set %1fil" ) - -- For the present, remove direction information on boxes + -- Remove 'normal' direction information on boxes in LuaTeX: + -- any bidi/vertical stuff will still show line = string.gsub (line, ", direction TLT", "") -- LuaTeX displays low chars differently: tidy up to ^^ notation for i = 1, 31, 1 do @@ -614,7 +634,7 @@ end -- Strip the extension from a file name function stripext (file) - local name = string.gsub (file, "%..*$", "") + local name = string.match (file, "^(.*)%.") return name end @@ -810,7 +830,7 @@ function ctan (standalone) end end if errorlevel == 0 then - for _,i in ipairs (txtfiles) do + for _,i in ipairs (readmefiles) do for _,j in ipairs (filelist (".", i)) do local function installtxt (name, dir) cp (name, ".", dir) @@ -828,14 +848,30 @@ function ctan (standalone) cp (bundle .. ".zip", ctandir, ".") else print ("\n====================") - print ("Zip creation failed!") + print ("Tests failed, zip stage skipped!") print ("====================\n") end + return (errorlevel) end function bundlectan () - local function install (source, dest, files, ctan) - local installdir = tdsdir .. "/" .. dest .. "/" .. moduledir + local function install (source, dest, files, ctan, tool) + local installdir + local moduledir = moduledir + -- For material associated with secondary tools (BibTeX, MakeIndex) + -- the structure needed is slightly different from those items going + -- into the tex/doc/source trees + if tool then + -- "base" is reserved for the tools themselves: make the assumption + -- in this case that the tdsroot name is the right place for stuff to + -- go (really just for the team) + if module == "base" then + moduledir = tdsroot + else + moduledir = module + end + end + installdir = tdsdir .. "/" .. dest .. "/" .. moduledir mkdir (installdir) for _,i in ipairs (files) do if ctan then @@ -845,6 +881,9 @@ function bundlectan () end end unpack () + if next (makeindexfiles) ~= nil then + install (unpackdir, "makeindex", makeindexfiles, false, true) + end install (unpackdir, "tex", installfiles, false) local errorlevel = doc () if errorlevel == 0 then @@ -855,6 +894,7 @@ function bundlectan () end install (".", "doc", pdffiles, true) install (".", "doc", demofiles, true) + install (".", "doc", textfiles, true) install (".", "source", typesetfiles, true) install (".", "source", sourcefiles, true) end @@ -869,17 +909,14 @@ 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 ( + local function makeindex (name, inext, outext, logext, style) + if fileexists (typesetdir .. "/" .. name .. inext) then + run ( typesetdir , - "makeindex -s gind.ist -o " .. name .. ".ind " .. name .. ".idx" - ) + "makeindex -s " .. style .. " -o " .. name .. outext + .. " -t " .. name .. logext .. " " .. name .. inext + ) + end end local function typeset (file) local errorlevel = @@ -901,12 +938,8 @@ function doc () print (" ! Compilation failed") return (errorlevel) else - if fileexists (typesetdir .. "/" .. name .. ".idx") then - index (name) - end - if fileexists (typesetdir .. "/" .. name .. ".glo") then - glossary (name) - end + makeindex (name, ".glo", ".gls", ".glg", glossarystyle) + makeindex (name, ".idx", ".ind", ".ilg", indexstyle) typeset (file) typeset (file) cp (name .. ".pdf", typesetdir, ".") @@ -990,6 +1023,12 @@ function bundleunpack () end for _,i in ipairs (unpackfiles) do for _,j in ipairs (filelist (unpackdir, i)) do + -- This 'yes' business is needed to pass a series of "y\n" to + -- TeX if \askforoverwrite is true + -- That is all done using a file as it's the only way on Windows and + -- on Unix the "yes" command can't be used inside os.execute (it never + -- stops, which confuses Lua) + os.execute (os_yes .. ">>" .. localdir .. "/yes") os.execute ( -- Notice that os.execute is used from 'here' as this ensures that -- localdir points to the correct place: running 'inside' @@ -999,7 +1038,7 @@ function bundleunpack () os_setenv .. " TEXINPUTS=" .. unpackdir .. os_pathsep .. localdir .. (unpacksearch and os_pathsep or "") .. os_concat .. unpackexe .. " " .. unpackopts .. " -output-directory=" .. unpackdir - .. " " .. unpackdir .. "/" .. j + .. " " .. unpackdir .. "/" .. j .. " < " .. localdir .. "/yes" ) end end @@ -1017,29 +1056,29 @@ end -- function stdmain (target, file, engine) + local errorlevel -- If the module name is empty, the script is running in a bundle: -- apart from ctan all of the targets are then just mappings if module == "" then -- Detect all of the modules modules = modules or listmodules () if target == "doc" then - allmodules ("doc") + errorlevel = allmodules ("doc") elseif target == "check" then - local errorlevel = allmodules ("bundlecheck") + errorlevel = allmodules ("bundlecheck") if errorlevel ~=0 then print ("There were errors: checks halted!\n") - os.exit (errorlevel) end elseif target == "clean" then - bundleclean () + errorlevel = bundleclean () elseif target == "cmdcheck" and next (cmdchkfiles) ~= nil then - allmodules ("cmdcheck") + errorlevel = allmodules ("cmdcheck") elseif target == "ctan" then - ctan () + errorlevel = ctan () elseif target == "install" then - allmodules ("install") + errorlevel = allmodules ("install") elseif target == "unpack" then - allmodules ("bundleunpack") + errorlevel = allmodules ("bundleunpack") elseif target == "version" then version () else @@ -1048,27 +1087,26 @@ function stdmain (target, file, engine) else if target == "bundleunpack" then -- 'Hidden' as only needed 'higher up' depinstall (unpackdeps) - bundleunpack () + errorlevel = bundleunpack () elseif target == "bundlecheck" then - local errorlevel = check () - os.exit (errorlevel) + errorlevel = check () elseif target == "bundlectan" then - bundlectan () + errorlevel = bundlectan () elseif target == "doc" then - doc () + errorlevel = doc () elseif target == "check" and testfiledir ~= "" then - check (file, engine) + errorlevel = check (file, engine) elseif target == "clean" then - clean () + errorlevel = clean () elseif target == "cmdcheck" and next (cmdchkfiles) ~= nil then - cmdcheck () + errorlevel = cmdcheck () elseif target == "ctan" and bundle == "" then -- Stand-alone module - ctan (true) + errorlevel = ctan (true) elseif target == "install" then - install () + errorlevel = install () elseif target == "save" and testfiledir ~= "" then if file then - save (file, engine) + errorlevel = save (file, engine) else help () end @@ -1080,6 +1118,7 @@ function stdmain (target, file, engine) help () end end + os.exit (errorlevel) end -- Allow main function to be disabled 'higher up' |