summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/l3build
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-12-09 21:05:14 +0000
committerKarl Berry <karl@freefriends.org>2021-12-09 21:05:14 +0000
commitd591e5abd44a7f052daf9e40281051f5aeeb2c02 (patch)
tree92674fe1a6f9c080c15b6d5fda2b77e8019bbdc3 /Master/texmf-dist/scripts/l3build
parentaaf82f524c0dfe58de47f941d55875e5a7a3e8da (diff)
l3build (9dec21)
git-svn-id: svn://tug.org/texlive/trunk@61260 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/l3build')
-rw-r--r--Master/texmf-dist/scripts/l3build/l3build-aux.lua13
-rw-r--r--Master/texmf-dist/scripts/l3build/l3build-check.lua15
-rw-r--r--Master/texmf-dist/scripts/l3build/l3build-ctan.lua20
-rw-r--r--Master/texmf-dist/scripts/l3build/l3build-install.lua38
-rw-r--r--Master/texmf-dist/scripts/l3build/l3build-typesetting.lua6
-rw-r--r--Master/texmf-dist/scripts/l3build/l3build-variables.lua1
-rwxr-xr-xMaster/texmf-dist/scripts/l3build/l3build.lua13
7 files changed, 86 insertions, 20 deletions
diff --git a/Master/texmf-dist/scripts/l3build/l3build-aux.lua b/Master/texmf-dist/scripts/l3build/l3build-aux.lua
index 42e7f6a53a5..2f6902a7b02 100644
--- a/Master/texmf-dist/scripts/l3build/l3build-aux.lua
+++ b/Master/texmf-dist/scripts/l3build/l3build-aux.lua
@@ -166,3 +166,16 @@ function dep_install(deps)
end
return 0
end
+
+-- Construct a localtexmf including any tdsdirs
+-- Needed for checking and typesetting, hence global
+function localtexmf()
+ local paths = ""
+ for src,_ in pairs(tdsdirs) do
+ paths = paths .. os_pathsep .. abspath(src) .. "//"
+ end
+ if texmfdir and texmfdir ~= "" and direxists(texmfdir) then
+ paths = paths .. os_pathsep .. abspath(texmfdir) .. "//"
+ end
+ return paths
+end
diff --git a/Master/texmf-dist/scripts/l3build/l3build-check.lua b/Master/texmf-dist/scripts/l3build/l3build-check.lua
index 249b22164a8..65ac2222717 100644
--- a/Master/texmf-dist/scripts/l3build/l3build-check.lua
+++ b/Master/texmf-dist/scripts/l3build/l3build-check.lua
@@ -719,6 +719,7 @@ function runtest(name, engine, hide, ext, test_type, breakout)
cp(lvtfile, fileexists(testfiledir .. "/" .. lvtfile)
and testfiledir or unpackdir, testdir)
local checkopts = checkopts
+ local tokens = ""
engine = engine or stdengine
local binary = engine
local format = gsub(engine,"tex$",checkformat)
@@ -730,6 +731,8 @@ function runtest(name, engine, hide, ext, test_type, breakout)
binary = engine_info.binary or binary
format = engine_info.format or format
checkopts = engine_info.options or checkopts
+ tokens = engine_info.tokens and (' "' .. engine_info.tokens .. '" ')
+ or tokens
end
end
-- Finalise format string
@@ -742,10 +745,10 @@ function runtest(name, engine, hide, ext, test_type, breakout)
end
-- Special casing for ConTeXt
local function setup(file)
- return " -jobname=" .. name .. " " .. ' "\\input ' .. file .. '" '
+ return " -jobname=" .. name .. tokens .. ' "\\input ' .. file .. '" '
end
if match(checkformat,"^context$") then
- function setup(file) return ' "' .. file .. '" ' end
+ function setup(file) return tokens .. ' "' .. file .. '" ' end
end
local basename = testdir .. "/" .. name
local gen_file = basename .. test_type.generated
@@ -764,19 +767,15 @@ function runtest(name, engine, hide, ext, test_type, breakout)
-- Ensure there is no stray .log file
rmfile(testdir,name .. logext)
local errlevels = {}
- local localtexmf = ""
- if texmfdir and texmfdir ~= "" and direxists(texmfdir) then
- localtexmf = os_pathsep .. abspath(texmfdir) .. "//"
- end
for i = 1, checkruns do
errlevels[i] = run(
testdir,
-- No use of localdir here as the files get copied to testdir:
-- avoids any paths in the logs
- os_setenv .. " TEXINPUTS=." .. localtexmf
+ os_setenv .. " TEXINPUTS=." .. localtexmf()
.. (checksearch and os_pathsep or "")
.. os_concat ..
- os_setenv .. " LUAINPUTS=." .. localtexmf
+ os_setenv .. " LUAINPUTS=." .. localtexmf()
.. (checksearch and os_pathsep or "")
.. os_concat ..
-- Avoid spurious output from (u)pTeX
diff --git a/Master/texmf-dist/scripts/l3build/l3build-ctan.lua b/Master/texmf-dist/scripts/l3build/l3build-ctan.lua
index 1f5aa2bc906..2efdd14067d 100644
--- a/Master/texmf-dist/scripts/l3build/l3build-ctan.lua
+++ b/Master/texmf-dist/scripts/l3build/l3build-ctan.lua
@@ -33,17 +33,28 @@ local newzip = require"l3build-zip"
-- Copy files to the main CTAN release directory
function copyctan()
- mkdir(ctandir .. "/" .. ctanpkg)
+ local pkgdir = ctandir .. "/" .. ctanpkg
+ mkdir(pkgdir)
+
+ -- Handle pre-formed sources: do two passes to avoid any cleandir() issues
+ for _,dest in pairs(tdsdirs) do
+ mkdir(pkgdir .. "/" .. dest)
+ end
+ for src,dest in pairs(tdsdirs) do
+ cp("*",src,pkgdir .. "/" .. dest)
+ end
+
+ -- Now deal with the one-at-a-time files
local function copyfiles(files,source)
if source == currentdir or flatten then
for _,filetype in pairs(files) do
- cp(filetype,source,ctandir .. "/" .. ctanpkg)
+ cp(filetype,source,pkgdir)
end
else
for _,filetype in pairs(files) do
for _,p in ipairs(tree(source,filetype)) do
local path = dirname(p.src)
- local ctantarget = ctandir .. "/" .. ctanpkg .. "/"
+ local ctantarget = pkgdir .. "/"
.. source .. "/" .. path
mkdir(ctantarget)
cp(p.src,source,ctantarget)
@@ -57,8 +68,9 @@ function copyctan()
end
copyfiles(sourcefiles,sourcefiledir)
for _,file in pairs(textfiles) do
- cp(file, textfiledir, ctandir .. "/" .. ctanpkg)
+ cp(file, textfiledir, pkgdir)
end
+
end
function bundlectan()
diff --git a/Master/texmf-dist/scripts/l3build/l3build-install.lua b/Master/texmf-dist/scripts/l3build/l3build-install.lua
index 78fe2d4b2f6..6a28463e653 100644
--- a/Master/texmf-dist/scripts/l3build/l3build-install.lua
+++ b/Master/texmf-dist/scripts/l3build/l3build-install.lua
@@ -32,6 +32,7 @@ local var_value = kpse.var_value
local gsub = string.gsub
local lower = string.lower
local match = string.match
+local format = string.format
local insert = table.insert
@@ -107,6 +108,23 @@ function uninstall()
errorlevel = zapdir(path)
if errorlevel ~= 0 then return errorlevel end
end
+ -- We remove all directories which contain at least one ordinary file in the source tree
+ for src, dest in pairs(tdsdirs) do
+ dest = dest .. '/'
+ local skipdir
+ for _, p in ipairs(tree(src, '**')) do
+ local src = p.src:sub(2) -- Skip the first '.'
+ if skipdir and src:sub(1, #skipdir) ~= skipdir then
+ skipdir = nil
+ end
+ if (not skipdir) and (not direxists(p.cwd)) then
+ skipdir = dirname(src)
+ errorlevel = zapdir(dest .. skipdir)
+ if errorlevel ~= 0 then return errorlevel end
+ skipdir = skipdir .. '/'
+ end
+ end
+ end
return 0
end
@@ -287,6 +305,26 @@ function install_files(target,full,dry_run)
+ create_install_map(unpackdir,"makeindex",{makeindexfiles},module)
+ create_install_map(unpackdir,"scripts",{scriptfiles},module)
+ for src, dest in pairs(tdsdirs) do
+ dest = target .. '/' .. dest
+ insert(installmap,
+ {file = '*', source = src, dest = dest})
+ dest = dest .. '/'
+ local skipdir
+ for _, p in ipairs(tree(src, '**')) do
+ local src = p.src:sub(2) -- Skip the first '.'
+ if skipdir and src:sub(1, #skipdir) ~= skipdir then
+ skipdir = nil
+ end
+ if (not skipdir) and (not direxists(p.cwd)) then
+ skipdir = dirname(src)
+ errorlevel = cleandir(dest .. skipdir)
+ if errorlevel ~= 0 then return errorlevel end
+ skipdir = skipdir .. '/'
+ end
+ end
+ end
+
if errorlevel ~= 0 then return errorlevel end
-- Files are all copied in one shot: this ensures that cleandir()
diff --git a/Master/texmf-dist/scripts/l3build/l3build-typesetting.lua b/Master/texmf-dist/scripts/l3build/l3build-typesetting.lua
index cc04ac1e38e..c173b2593b1 100644
--- a/Master/texmf-dist/scripts/l3build/l3build-typesetting.lua
+++ b/Master/texmf-dist/scripts/l3build/l3build-typesetting.lua
@@ -54,11 +54,7 @@ function runcmd(cmd,dir,vars)
vars = vars or {}
-- Allow for local texmf files
local env = os_setenv .. " TEXMFCNF=." .. os_pathsep
- local localtexmf = ""
- if texmfdir and texmfdir ~= "" and direxists(texmfdir) then
- localtexmf = os_pathsep .. abspath(texmfdir) .. "//"
- end
- local envpaths = "." .. localtexmf .. os_pathsep
+ local envpaths = "." .. localtexmf() .. os_pathsep
.. abspath(localdir) .. os_pathsep
.. dir .. (typesetsearch and os_pathsep or "")
-- Deal with spaces in paths
diff --git a/Master/texmf-dist/scripts/l3build/l3build-variables.lua b/Master/texmf-dist/scripts/l3build/l3build-variables.lua
index d78c39c92f6..ffabf3490a7 100644
--- a/Master/texmf-dist/scripts/l3build/l3build-variables.lua
+++ b/Master/texmf-dist/scripts/l3build/l3build-variables.lua
@@ -229,6 +229,7 @@ manifestfile = manifestfile or "MANIFEST.md"
-- Non-standard installation locations
tdslocations = tdslocations or { }
+tdsdirs = tdsdirs or {}
-- Upload settings
curlexe = curlexe or "curl"
diff --git a/Master/texmf-dist/scripts/l3build/l3build.lua b/Master/texmf-dist/scripts/l3build/l3build.lua
index 2c555373f60..1d8d58c6946 100755
--- a/Master/texmf-dist/scripts/l3build/l3build.lua
+++ b/Master/texmf-dist/scripts/l3build/l3build.lua
@@ -25,7 +25,7 @@ for those people who are interested.
--]]
-- Version information
-release_date = "2021-12-06"
+release_date = "2021-12-09"
-- File operations are aided by the LuaFileSystem module
local lfs = require("lfs")
@@ -133,8 +133,8 @@ else
checkconfigs = options["config"] or checkconfigs
end
-if options["target"] == "check" then
- if #checkconfigs > 1 then
+if #checkconfigs > 1 then
+ if options["target"] == "check" then
local errorlevel = 0
local opts = options
local failed = { }
@@ -196,6 +196,13 @@ if options["target"] == "check" then
-- Avoid running the 'main' set of tests twice
exit(0)
end
+ elseif options["target"] == "clean" then
+ local failure
+ for i = 1, #checkconfigs do
+ opts["config"] = {checkconfigs[i]}
+ failure = 0 ~= call({"."}, "clean", opts) or failure
+ end
+ exit(failure and 1 or 0)
end
end
if #checkconfigs == 1 and