summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3build
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-02 21:42:38 +0000
committerKarl Berry <karl@freefriends.org>2015-04-02 21:42:38 +0000
commitb2dcb6358d02b5256659808c99916fe8c5975e35 (patch)
tree8de9428b72775a5afc8006b9686993f86cd10f4d /Master/texmf-dist/tex/latex/l3build
parentfdd807f99ca5dbba98a05ce12bd086949df0ad47 (diff)
l3build (2apr15)
git-svn-id: svn://tug.org/texlive/trunk@36706 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3build')
-rw-r--r--Master/texmf-dist/tex/latex/l3build/l3build.lua142
1 files changed, 99 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/tex/latex/l3build/l3build.lua
index 5250161fb2c..1edf777cfa1 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 = "2015/02/01"
-release_ver = "5504"
+release_date = "2015/04/02"
+release_ver = "5564"
-- "module" is a deprecated function in Lua 5.2: as we want the name
-- for other purposes, and it should eventually be 'free', simply
@@ -71,19 +71,22 @@ tdsroot = tdsroot or "latex"
-- Location for installation on CTAN or in TEXMFHOME
if bundle == "" then
moduledir = tdsroot .. "/" .. module
+ ctanpkg = ctanpkg or module
else
moduledir = tdsroot .. "/" .. bundle .. "/" .. module
+ ctanpkg = ctanpkg or bundle
end
-- File types for various operations
-- Use Unix-style globs
-- All of these may be set earlier, so a initialised conditionally
+auxfiles = auxfiles or {"*.aux", "*.toc"}
binaryfiles = binaryfiles or {"*.pdf", "*.zip"}
checkfiles = checkfiles or { } -- Extra files unpacked purely for tests
checksuppfiles = checksuppfiles or { }
cmdchkfiles = cmdchkfiles or { }
demofiles = demofiles or { }
-cleanfiles = cleanfiles or {"*.pdf", "*.zip"}
+cleanfiles = cleanfiles or {"*.log", "*.pdf", "*.zip"}
excludefiles = excludefiles or {"*~"} -- Any Emacs stuff
installfiles = installfiles or {"*.sty"}
makeindexfiles = makeindexfiles or {"*.ist"}
@@ -425,7 +428,7 @@ function copyctan ()
-- Do all of the copying in one go
for _,i in ipairs ({demofiles, pdffiles, sourcefiles, textfiles, typesetlist}) do
for _,j in ipairs (i) do
- cp (j, ".", ctandir .. "/" .. bundle)
+ cp (j, ".", ctandir .. "/" .. ctanpkg)
end
end
end
@@ -463,7 +466,7 @@ function copytds ()
for _,i in ipairs (filenames) do
cp (i, source, installdir)
end
- end
+ end
end
install (".", "doc", {demofiles, pdffiles, textfiles, typesetlist})
install (unpackdir, "makeindex", {makeindexfiles}, true)
@@ -546,13 +549,15 @@ function formatlog (logfile, newfile)
line, "cm, mm, dd, cc, bp, or sp", "cm, mm, dd, cc, nd, nc, bp, or sp"
)
-- Normalise a case where a LuaTeX bug misprints \csname\endcsname
- -- This comes before the normalisation of the appearance of
+ -- This comes before the normalisation of the appearance of
-- \csname\endcsname in case we alter that!
line = string.gsub (line, "\\ycsnam\\rendcsnam", "\\csname\\endcsname")
-- Normalise a case where fixing a TeX bug changes the message text
line = string.gsub (line, "\\csname\\endcsname ", "\\csname\\endcsname")
-- Zap "on line <num>" and replace with "on line ..."
line = string.gsub (line, "on line %d*", "on line ...")
+ -- Zap line numbers from \show, \showbox, \box_show and the like
+ line = string.gsub (line, "^l.%d* (\\[^ ]*show)", "l. ... %1")
-- Remove spaces at the start of lines: deals with the fact that LuaTeX
-- uses a different number to the other engines
line = string.gsub (line, "^%s+", "")
@@ -617,6 +622,18 @@ function formatlog (logfile, newfile)
io.close (newfile)
end
+-- Look for files, directory by directory, and return the first existing
+function locate (dirs, names)
+ for _,i in ipairs (dirs) do
+ for _,j in ipairs (names) do
+ local path = i .. "/" .. j
+ if fileexists (path) then
+ return (path)
+ end
+ end
+ end
+end
+
-- List all modules
function listmodules ()
local modules = { }
@@ -650,9 +667,13 @@ function runcheck (name, engine, hide)
local difffile = testdir .. "/" .. testname .. os_diffext
local newfile = testdir .. "/" .. testname .. logext
-- Use engine-specific file if available
- local tlgfile = testfiledir .. "/" .. name .. "." .. i .. tlgext
- if not fileexists (tlgfile) then
- tlgfile = testfiledir .. "/" .. name .. tlgext
+ local tlgfile = locate (
+ {testfiledir, unpackdir},
+ {name .. "." .. i .. tlgext, name .. tlgext}
+ )
+ if not tlgfile then
+ print ("Error: failed to find " .. tlgext .. " file for " .. name .. "!")
+ os.exit (1)
end
if os_windows then
tlgfile = unix_to_win (tlgfile)
@@ -672,7 +693,9 @@ end
-- Run one of the test files: doesn't check the result so suitable for
-- both creating and verifying .tlg files
function runtest (name, engine, hide)
- cp (name .. lvtext, testfiledir, testdir)
+ local lvtfile = name .. lvtext
+ cp (lvtfile, fileexists (testfiledir .. "/" .. lvtfile)
+ and testfiledir or unpackdir, testdir)
local engine = engine or stdengine
-- Set up the format file name if it's one ending "...tex"
local format
@@ -682,7 +705,6 @@ function runtest (name, engine, hide)
format = ""
end
local logfile = testdir .. "/" .. name .. logext
- local lvtfile = name .. lvtext
local newfile = testdir .. "/" .. name .. "." .. engine .. logext
for i = 1, checkruns, 1 do
run (
@@ -699,7 +721,11 @@ function runtest (name, engine, hide)
local ext = string.match (i, "%....")
if ext ~= lvtext and ext ~= tlgext and ext ~= logext then
if not fileexists (testsuppdir .. "/" .. i) then
- ren (testdir, i, string.gsub (i, name, name .. "." .. engine ))
+ ren (
+ testdir, i, string.gsub (
+ i, string.gsub (name, "%-", "%%-"), name .. "." .. engine
+ )
+ )
end
end
end
@@ -711,12 +737,9 @@ function stripext (file)
return name or file
end
+-- Look for a test: could be in the testfiledir or the unpackdir
function testexists (test)
- if fileexists (testfiledir .. "/" .. test .. lvtext) then
- return true
- else
- return false
- end
+ return (locate ({testfiledir, unpackdir}, {test .. lvtext}))
end
-- Standard versions of the main targets for building modules
@@ -760,16 +783,28 @@ end
function checkall ()
local errorlevel = 0
if testfiledir ~= "" and direxists (testfiledir) then
- checkinit ()
- print ("Running checks on")
- for _,i in ipairs (filelist (testfiledir, "*" .. lvtext)) do
- local name = stripext (i)
+ local function execute (name)
+ local name = stripext (name)
print (" " .. name)
local errlevel = runcheck (name, nil, true)
if errlevel ~= 0 then
errorlevel = 1
end
end
+ checkinit ()
+ print ("Running checks on")
+ for _,i in ipairs (filelist (testfiledir, "*" .. lvtext)) do
+ execute (i)
+ end
+ for _,i in ipairs (filelist (unpackdir, "*" .. lvtext)) do
+ if fileexists (testfiledir .. "/" .. i) then
+ print ("Duplicate test file: " .. i)
+ errorlevel = 1
+ break
+ else
+ execute (i)
+ end
+ end
if errorlevel ~= 0 then
checkdiff ()
else
@@ -780,8 +815,8 @@ function checkall ()
end
function checklvt (name, engine)
+ checkinit ()
if testexists (name) then
- checkinit ()
print ("Running checks on " .. name)
local errorlevel = runcheck (name, engine)
if errorlevel ~= 0 then
@@ -823,6 +858,12 @@ function clean ()
end
end
+function auxclean ()
+ for _,i in ipairs (auxfiles) do
+ rm (".", i)
+ end
+end
+
function bundleclean ()
allmodules ("clean")
for _,i in ipairs (cleanfiles) do
@@ -893,7 +934,7 @@ function ctan (standalone)
end
if errorlevel == 0 then
rmdir (ctandir)
- mkdir (ctandir .. "/" .. bundle)
+ mkdir (ctandir .. "/" .. ctanpkg)
rmdir (tdsdir)
mkdir (tdsdir)
if standalone then
@@ -914,16 +955,16 @@ function ctan (standalone)
cp (name, ".", dir)
ren (dir, name, stripext (name))
end
- installtxt (j, ctandir .. "/" .. bundle)
+ installtxt (j, ctandir .. "/" .. ctanpkg)
installtxt (j, tdsdir .. "/doc/" .. tdsroot .. "/" .. bundle)
end
end
- dirzip (tdsdir, bundle .. ".tds")
+ dirzip (tdsdir, ctanpkg .. ".tds")
if packtdszip then
- cp (bundle .. ".tds.zip", tdsdir, ctandir)
+ cp (ctanpkg .. ".tds.zip", tdsdir, ctandir)
end
- dirzip (ctandir, bundle)
- cp (bundle .. ".zip", ctandir, ".")
+ dirzip (ctandir, ctanpkg)
+ cp (ctanpkg .. ".zip", ctandir, ".")
else
print ("\n====================")
print ("Typesetting failed, zip stage skipped!")
@@ -979,28 +1020,36 @@ function doc ()
local name = stripext (file)
-- A couple of short functions to deal with the repeated steps in a
-- clear way
+ local function biber (name)
+ if fileexists (typesetdir .. "/" .. name .. ".bcf") then
+ return (run (typesetdir, "biber " .. name))
+ end
+ end
local function makeindex (name, inext, outext, logext, style)
if fileexists (typesetdir .. "/" .. name .. inext) then
- run (
- typesetdir ,
- "makeindex -s " .. style .. " -o " .. name .. outext
- .. " -t " .. name .. logext .. " " .. name .. inext
- )
+ return (
+ run (
+ typesetdir ,
+ "makeindex -s " .. style .. " -o " .. name .. outext
+ .. " -t " .. name .. logext .. " " .. name .. inext
+ )
+ )
end
end
local function typeset (file)
- local errorlevel =
+ return (
os.execute (
- os_setenv .. " TEXINPUTS=" .. typesetdir ..
+ os_setenv .. " TEXINPUTS=" .. typesetdir ..
os_pathsep .. localdir .. (typesetsearch and os_pathsep or "") ..
os_concat ..
- typesetexe .. " " .. typesetopts ..
+ typesetexe .. " " .. typesetopts ..
" -output-directory=" .. typesetdir ..
- " \"" .. typesetcmds ..
+ " \"" .. typesetcmds ..
"\\input " .. typesetdir .. "/" .. file .. "\""
)
- return errorlevel
+ )
end
+ auxclean ()
os.remove (name .. ".pdf")
print ("Typesetting " .. name)
local errorlevel = typeset (file)
@@ -1008,6 +1057,7 @@ function doc ()
print (" ! Compilation failed")
return (errorlevel)
else
+ biber (name)
makeindex (name, ".glo", ".gls", ".glg", glossarystyle)
makeindex (name, ".idx", ".ind", ".ilg", indexstyle)
typeset (file)
@@ -1056,16 +1106,22 @@ end
function save (name, engine)
local tlgfile = name .. (engine and ("." .. engine) or "") .. tlgext
local newfile = name .. "." .. (engine or stdengine) .. logext
- if fileexists (testfiledir .. "/" .. name .. lvtext) then
- checkinit ()
+ checkinit ()
+ if testexists (name) then
print ("Creating and copying " .. tlgfile)
runtest (name, engine, false)
ren (testdir, newfile, tlgfile)
cp (tlgfile, testdir, testfiledir)
+ if fileexists (unpackdir .. "/" .. tlgfile) then
+ print (
+ "Saved " .. tlgext
+ .. " file overrides unpacked version of the same name"
+ )
+ end
else
print (
- "Test input \"" .. testfiledir .. "/" .. name .. lvtext ..
- "\" not found"
+ "Test input \"" .. testfiledir .. "/" .. name .. lvtext
+ .. "\" not found"
)
end
end
@@ -1082,7 +1138,7 @@ end
-- Split off from the main unpack so it can be used on a bundle and not
-- leave only one modules files
-function bundleunpack ()
+bundleunpack = bundleunpack or function ()
mkdir (localdir)
cleandir (unpackdir)
for _,i in ipairs (sourcefiles) do