From 8f923948816b24e3c3f2449439dcce1c94888607 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 1 Feb 2015 21:52:07 +0000 Subject: l3build (1feb15) git-svn-id: svn://tug.org/texlive/trunk@36183 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/l3build/l3build.lua | 156 +++++++++++++++------ .../tex/latex/l3build/regression-test.tex | 2 +- 2 files changed, 112 insertions(+), 46 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/tex/latex/l3build/l3build.lua index e965353d2ea..5250161fb2c 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build.lua @@ -1,6 +1,6 @@ --[[ - File l3build.lua (C) Copyright 2014 The LaTeX3 Project + File l3build.lua (C) Copyright 2014-2015 The LaTeX3 Project It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this @@ -17,8 +17,8 @@ --]] -- Version information: should be identical to that in l3build.dtx -release_date = "2014/11/25" -release_ver = "5471" +release_date = "2015/02/01" +release_ver = "5504" -- "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,8 @@ 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"} +makeindexfiles = makeindexfiles or {"*.ist"} +readmefiles = readmefiles or {"README.md", "README.markdown", "README.txt"} sourcefiles = sourcefiles or {"*.dtx", "*.ins"} -- Files to copy for unpacking textfiles = textfiles or { } typesetfiles = typesetfiles or {"*.dtx"} @@ -420,6 +420,57 @@ function checkinit () end end +-- Copy files to the main CTAN release directory +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) + end + end +end + +-- Copy files to the correct places in the TDS tree +function copytds () + local function install (source, dest, files, tool) + 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 + local installdir = tdsdir .. "/" .. dest .. "/" .. moduledir + -- Convert the file table(s) to a list of individual files + local filenames = { } + for _,i in ipairs (files) do + for _,j in ipairs (i) do + for _,k in ipairs (filelist (source, j)) do + table.insert (filenames, k) + end + end + end + -- The target is only created if there are actual files to install + if next (filenames) ~= nil then + mkdir (installdir) + for _,i in ipairs (filenames) do + cp (i, source, installdir) + end + end + end + install (".", "doc", {demofiles, pdffiles, textfiles, typesetlist}) + install (unpackdir, "makeindex", {makeindexfiles}, true) + install (".", "source", {sourcelist}) + install (unpackdir, "tex", {installfiles}) +end + -- Unpack files needed to support testing/typesetting/unpacking function depinstall (deps) for _,i in ipairs (deps) do @@ -519,6 +570,13 @@ function formatlog (logfile, newfile) for i = 1, 31, 1 do line = string.gsub (line, string.char (i), "^^" .. string.char (64 + i)) end + -- For normalising UTF-8 to ASCII + local utf8 = unicode.utf8 + -- Unicode engines display chars in the upper half of the 8-bit range: + -- tidy up to match pdfTeX. + for i = 128, 255, 1 do + line = string.gsub (line, utf8.char (i), "^^" .. string.format ("%02x", i)) + end -- Minor LuaTeX difference: it does not include parentheses in one message line = string.gsub ( line, @@ -616,10 +674,12 @@ end 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 = engine - if checkformat == "latex" then - cmd = string.gsub (engine, "tex$", "latex") + -- Set up the format file name if it's one ending "...tex" + local format + if string.match (checkformat, "tex$") then + format = " -fmt=" .. string.gsub (engine, "(.*)tex$", "%1") .. checkformat + else + format = "" end local logfile = testdir .. "/" .. name .. logext local lvtfile = name .. lvtext @@ -629,17 +689,26 @@ function runtest (name, engine, hide) testdir, os_setenv .. " TEXINPUTS=." .. (checksearch and os_pathsep or "") .. os_concat .. - cmd .. " " .. checkopts .. " " .. lvtfile + engine .. format .. " " .. checkopts .. " " .. lvtfile .. (hide and (" > " .. os_null) or "") ) end formatlog (logfile, newfile) + -- Store secondary files for this engine + for _,i in ipairs (filelist (testdir, name .. ".???")) do + 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 )) + end + end + end end --- Strip the extension from a file name +-- Strip the extension from a file name (if present) function stripext (file) local name = string.match (file, "^(.*)%.") - return name + return name or file end function testexists (test) @@ -832,6 +901,11 @@ function ctan (standalone) else errorlevel = allmodules ("bundlectan") end + else + print ("\n====================") + print ("Tests failed, zip stage skipped!") + print ("====================\n") + return (errorlevel) end if errorlevel == 0 then for _,i in ipairs (readmefiles) do @@ -852,55 +926,47 @@ function ctan (standalone) cp (bundle .. ".zip", ctandir, ".") else print ("\n====================") - print ("Tests failed, zip stage skipped!") + print ("Typesetting failed, zip stage skipped!") print ("====================\n") end return (errorlevel) end function bundlectan () - 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 + -- Generate a list of individual file names excluding those in the second + -- argument: the latter is a table + local function excludelist (include, exclude) + local includelist = { } + local excludelist = { } + for _,i in ipairs (exclude) do + for _,j in ipairs (i) do + for _,k in ipairs (filelist (".", j)) do + excludelist[k] = true + end end end - installdir = tdsdir .. "/" .. dest .. "/" .. moduledir - mkdir (installdir) - for _,i in ipairs (files) do - if ctan then - cp (i, source, ctandir .. "/" .. bundle) + for _,i in ipairs (include) do + for _,j in ipairs (filelist (".", i)) do + if excludelist[j] then + else + table.insert (includelist, j) + end end - cp (i, source, installdir) end + return (includelist) end - unpack () - if next (makeindexfiles) ~= nil then - install (unpackdir, "makeindex", makeindexfiles, false, true) - end - install (unpackdir, "tex", installfiles, false) + unpack() local errorlevel = doc () if errorlevel == 0 then - -- Convert input names for typesetting into names of PDF files - local pdffiles = { } + -- Work out what PDF files are available + pdffiles = { } for _,i in ipairs (typesetfiles) do table.insert (pdffiles, (string.gsub (i, "%.%w+$", ".pdf"))) end - install (".", "doc", pdffiles, true) - install (".", "doc", demofiles, true) - install (".", "doc", textfiles, true) - install (".", "source", typesetfiles, true) - install (".", "source", sourcefiles, true) + typesetlist = excludelist (typesetfiles, {sourcefiles}) + sourcelist = excludelist (sourcefiles, {installfiles, makeindexfiles}) + copyctan () + copytds () end return (errorlevel) end diff --git a/Master/texmf-dist/tex/latex/l3build/regression-test.tex b/Master/texmf-dist/tex/latex/l3build/regression-test.tex index 660c8ff4a2a..792eac0f1e3 100644 --- a/Master/texmf-dist/tex/latex/l3build/regression-test.tex +++ b/Master/texmf-dist/tex/latex/l3build/regression-test.tex @@ -14,7 +14,7 @@ %% Do not distribute a modified version of this file. %% %% -%% File l3build.dtx (C) Copyright 2014 The LaTeX3 Project +%% File l3build.dtx (C) Copyright 2014-2015 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this -- cgit v1.2.3