summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3build/l3build.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-08-26 17:33:09 +0000
committerKarl Berry <karl@freefriends.org>2014-08-26 17:33:09 +0000
commit6c4cd2ab2f8d1ebe3a051d700c3005d73eefe04c (patch)
tree16833d474c6532347c42dee6b34fa77aed22eca6 /Master/texmf-dist/tex/latex/l3build/l3build.lua
parent097e7dc0afa442be238a967b292237470680626e (diff)
l3 (26aug14)
git-svn-id: svn://tug.org/texlive/trunk@35045 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3build/l3build.lua')
-rw-r--r--Master/texmf-dist/tex/latex/l3build/l3build.lua128
1 files changed, 87 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/tex/latex/l3build/l3build.lua
index 02a6f8c066c..9e6bd7d8c59 100644
--- a/Master/texmf-dist/tex/latex/l3build/l3build.lua
+++ b/Master/texmf-dist/tex/latex/l3build/l3build.lua
@@ -17,20 +17,43 @@
--]]
-- Version information: should be identical to that in l3build.dtx
-release_date = "2014/07/19"
-release_ver = "5240"
+release_date = "2014/08/25"
+release_ver = "5378"
+
+-- "module" is a deprecated function in Lua 5.2: as we want the name
+-- for other purposes, and it should eventually be 'free', simply
+-- remove the built-in
+if type (module) == "function" then
+ module = nil
+end
-- Ensure the module and bundle exist
module = module or ""
bundle = bundle or ""
+-- Sanity check
+if module == "" and bundle == "" then
+ if string.match (arg[0], ".*l3build%.lua$") then
+ print (
+ "\n" ..
+ "Error: Call l3build using a configuration file, not directly.\n"
+ )
+ else
+ print (
+ "\n" ..
+ "Error: Specify either bundle or module in configuration script.\n"
+ )
+ end
+ os.exit (1)
+end
+
-- Directory structure for the build system
-- Use Unix-style path separators
maindir = maindir or "."
-- Substructure for tests and support files
testfiledir = testfiledir or "testfiles" -- Set to "" to cancel any tests
-testsupdir = testsupdir or testfiledir .. "/support"
+testsuppdir = testsuppdir or testfiledir .. "/support"
supportdir = supportdir or maindir .. "/support"
-- Structure within a development area
@@ -64,7 +87,7 @@ cleanfiles = cleanfiles or {"*.pdf", "*.zip"}
excludefiles = excludefiles or {"*~"} -- Any Emacs stuff
installfiles = installfiles or {"*.sty"}
sourcefiles = sourcefiles or {"*.dtx", "*.ins"} -- Files to copy for unpacking
-txtfiles = txtfiles or {"*.markdown"}
+txtfiles = txtfiles or {"*.md", "*.markdown"}
typesetfiles = typesetfiles or {"*.dtx"}
typesetsuppfiles = typesetsuppfiles or { }
unpackfiles = unpackfiles or {"*.ins"} -- Files to actually unpack
@@ -378,9 +401,9 @@ function checkinit ()
for _,i in ipairs (checkfiles) do
cp (i, unpackdir, testdir)
end
- if direxists (testsupdir) then
- for _,i in ipairs (filelist (testsupdir)) do
- cp (i, testsupdir, testdir)
+ if direxists (testsuppdir) then
+ for _,i in ipairs (filelist (testsuppdir)) do
+ cp (i, testsuppdir, testdir)
end
end
for _,i in ipairs (checksuppfiles) do
@@ -441,6 +464,10 @@ function formatlog (logfile, newfile)
line = string.gsub (line, string.match (logfile, ".*/(.*)%" .. logext .. "$"), "")
-- Zap ./ at begin of filename
line = string.gsub (line, "%(%.%/", "(")
+ -- Zap paths if places other than 'here' are accessible
+ if checksearch then
+ line = string.gsub (line, "%(.*/([%w-]+%.[%w-]+)%s*$", "(../%1")
+ end
-- XeTeX knows only the smaller set of dimension units
line = string.gsub (
line, "cm, mm, dd, cc, bp, or sp", "cm, mm, dd, cc, nd, nc, bp, or sp"
@@ -463,6 +490,12 @@ function formatlog (logfile, newfile)
for i = 1, 31, 1 do
line = string.gsub (line, string.char (i), "^^" .. string.char (64 + i))
end
+ -- Minor LuaTeX difference: it does not include parentheses in one message
+ line = string.gsub (
+ line,
+ "%(If you're confused by all this, try typing `I}' now%.%)",
+ "If you're confused by all this, try typing `I}' now."
+ )
-- Minor LuaTeX bug: it prints an extra "'" in one message: add enough
-- context to hopefully hit only the bug
line = string.gsub (
@@ -524,6 +557,7 @@ function runcheck (name, engine, hide)
end
local errorlevel = 0
for _,i in ipairs (checkengines) do
+ cp (name .. tlgext, testfiledir, testdir)
runtest (name, i, hide)
local testname = name .. "." .. i
local difffile = testdir .. "/" .. testname .. os_diffext
@@ -593,30 +627,40 @@ end
help = help or function ()
print ""
if testfiledir ~= "" then
- print " build check - run automated check system "
+ print " build check - run all automated tests for all engines"
end
if module ~= "" and testfiledir ~= "" then
- print " build checklvt <name> - check one test file <name> for all engines"
- print " build checklvt <name> <engine> - check one test file <name> for <engine> "
+ print " build check <name> - check one test file <name> for all engines"
+ print " build check <name> <engine> - check one test file <name> for <engine> "
end
- print " build clean - clean out directory tree "
+ print " build clean - clean out directory tree "
if next (cmdchkfiles) ~= nil then
- print " build cmdcheck - check commands documented are defined "
+ print " build cmdcheck - check commands documented are defined "
end
if module == "" or bundle == "" then
- print " build ctan - create CTAN-ready archive "
+ print " build ctan - create CTAN-ready archive "
end
- print " build doc - runs all documentation files "
- print " build install - install files in local texmf tree "
+ print " build doc - runs all documentation files "
+ print " build install - install files in local texmf tree "
if module ~= "" and testfiledir ~= "" then
- print " build savetlg <name> - save test log for <name> for all engines "
- print " build savetlg <name> <engine> - save test log for <name> for <engine> "
+ print " build save <name> - save test log for <name> for all engines "
+ print " build save <name> <engine> - save test log for <name> for <engine> "
end
- print " build unpack - extract packages "
+ print " build unpack - extract packages "
print ""
end
-function check ()
+function check (name, engine)
+ local errorlevel = 0
+ if name then
+ errorlevel = checklvt (name, engine)
+ else
+ errorlevel = checkall ()
+ end
+ return (errorlevel)
+end
+
+function checkall ()
local errorlevel = 0
if testfiledir ~= "" and direxists (testfiledir) then
checkinit ()
@@ -630,11 +674,7 @@ function check ()
end
end
if errorlevel ~= 0 then
- print ("\n Check failed with difference files")
- for _,i in ipairs (filelist (testdir, "*" .. os_diffext)) do
- print (" - " .. testdir .. "/" .. i)
- end
- print ("")
+ checkdiff ()
else
print ("\n All checks passed\n")
end
@@ -643,23 +683,33 @@ function check ()
end
function checklvt (name, engine)
- local engine = engine or stdengine
if testexists (name) then
checkinit ()
print ("Running checks on " .. name)
- runcheck (name, engine)
- if fileexists (testdir .. "/" .. name .. "." .. engine .. os_diffext) then
- print (" Check fails with diff file")
- print (
- " " .. testdir .. "/" .. name .. "." .. engine .. os_diffext)
+ local errorlevel = runcheck (name, engine)
+ if errorlevel ~= 0 then
+ checkdiff ()
else
- print (" Check passes")
+ if engine then
+ print (" Check passes")
+ else
+ print ("\n All checks passed\n")
+ end
end
else
print ("Test \"" .. name .. "\" not set up!")
end
end
+-- A short auxiliary to print the list of differences for check
+function checkdiff ()
+ print ("\n Check failed with difference files")
+ for _,i in ipairs (filelist (testdir, "*" .. os_diffext)) do
+ print (" - " .. testdir .. "/" .. i)
+ end
+ print ("")
+end
+
-- Remove all generated files
function clean ()
-- To make sure that distribdir never contains any stray subdirs,
@@ -745,7 +795,9 @@ function ctan (standalone)
errorlevel = allmodules ("bundlecheck")
end
if errorlevel == 0 then
+ rmdir (ctandir)
mkdir (ctandir .. "/" .. bundle)
+ rmdir (tdsdir)
mkdir (tdsdir)
if standalone then
errorlevel = bundlectan ()
@@ -892,7 +944,7 @@ function install ()
end
end
-function savetlg (name, engine)
+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
@@ -999,13 +1051,7 @@ function stdmain (target, file, engine)
elseif target == "doc" then
doc ()
elseif target == "check" and testfiledir ~= "" then
- check ()
- elseif target == "checklvt" and testfiledir ~= "" then
- if file then
- checklvt (file, engine)
- else
- help ()
- end
+ check (file, engine)
elseif target == "clean" then
clean ()
elseif target == "cmdcheck" and next (cmdchkfiles) ~= nil then
@@ -1014,9 +1060,9 @@ function stdmain (target, file, engine)
ctan (true)
elseif target == "install" then
install ()
- elseif target == "savetlg" and testfiledir ~= "" then
+ elseif target == "save" and testfiledir ~= "" then
if file then
- savetlg (file, engine)
+ save (file, engine)
else
help ()
end