From c615296cb3fb6bf46114cf3deb409b0134498006 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 21 Feb 2018 23:34:25 +0000 Subject: l3build (21feb18) git-svn-id: svn://tug.org/texlive/trunk@46706 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/l3build/README.md | 2 +- Master/texmf-dist/doc/latex/l3build/l3build.pdf | Bin 672324 -> 672272 bytes Master/texmf-dist/source/latex/l3build/l3build.dtx | 11 ++-- .../texmf-dist/tex/latex/l3build/l3build-check.lua | 16 ++--- .../texmf-dist/tex/latex/l3build/l3build-ctan.lua | 7 ++- .../tex/latex/l3build/l3build-file-functions.lua | 68 +++++++++++++-------- Master/texmf-dist/tex/latex/l3build/l3build.lua | 2 +- 7 files changed, 59 insertions(+), 47 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/l3build/README.md b/Master/texmf-dist/doc/latex/l3build/README.md index e6e21ed5ece..e4730041927 100644 --- a/Master/texmf-dist/doc/latex/l3build/README.md +++ b/Master/texmf-dist/doc/latex/l3build/README.md @@ -1,7 +1,7 @@ l3build: a testing and building system for LaTeX3 ================================================= -Release 2018/01/27 +Release 2018/02/20 Overview -------- diff --git a/Master/texmf-dist/doc/latex/l3build/l3build.pdf b/Master/texmf-dist/doc/latex/l3build/l3build.pdf index cd72687e10f..125ee8d5ee7 100644 Binary files a/Master/texmf-dist/doc/latex/l3build/l3build.pdf and b/Master/texmf-dist/doc/latex/l3build/l3build.pdf differ diff --git a/Master/texmf-dist/source/latex/l3build/l3build.dtx b/Master/texmf-dist/source/latex/l3build/l3build.dtx index 7c92dae5a29..9b875e562a4 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.dtx +++ b/Master/texmf-dist/source/latex/l3build/l3build.dtx @@ -217,7 +217,7 @@ % }^^A % } % -% \date{Released 2018/01/27} +% \date{Released 2018/02/20} % % \maketitle % \tableofcontents @@ -1386,13 +1386,12 @@ % the |basename()|. % \end{function} % -% \begin{function}{unix_to_win()} +% \begin{function}{normalize_path()} % \begin{syntax} -% |unix_to_win(|\meta{path}|)| +% |normalize_path(|\meta{path}|)| % \end{syntax} -% Returns a string comprising the \meta{path} with |/| characters replaced -% by |\\| and thus suitable for use with Windows-specific commands which -% require this form of path. +% When called on Windows, returns a string comprising the \meta{path} with +% |/| characters replaced by |\\|. In other cases returns the path unchanged. % \end{function} % % \subsection{System-dependent strings} diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-check.lua b/Master/texmf-dist/tex/latex/l3build/l3build-check.lua index 40c28561253..66319cc62bf 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-check.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-check.lua @@ -546,9 +546,9 @@ function compare_pdf(name, engine) if not refpdffile then return end - refpdffile = unix_to_win(refpdffile) errorlevel = execute( - os_cmpexe .. " " .. refpdffile .. " " .. pdffile .. " > " .. cmpfile + os_cmpexe .. " " .. normalize_path(refpdffile) + .. " " .. pdffile .. " > " .. cmpfile ) if errorlevel == 0 then os.remove(cmpfile) @@ -578,12 +578,8 @@ function compare_tlg(name, engine) -- This allows code sharing below: we only need the .tlg name in one place tlgfile = luatlgfile end - errorlevel = execute( - os_diffexe .. " " - .. unix_to_win(tlgfile) .. " " - .. unix_to_win(logfile) .. " > " - .. unix_to_win(difffile) - ) + errorlevel = execute(os_diffexe .. " " + .. normalize_path(tlgfile .. " " .. logfile .. " > " .. difffile)) if errorlevel == 0 then os.remove(difffile) end @@ -662,8 +658,8 @@ function runtest(name, engine, hide, ext, makepdf) -- Ensure lines are of a known length os_setenv .. " max_print_line=" .. maxprintline .. os_concat .. - realengine .. format .. " " - .. checkopts .. " " .. asciiopt .. lvtfile + realengine .. format .. " -jobname=" .. name .. " " + .. asciiopt .. " " .. checkopts .. " \"\\input " .. lvtfile .. "\" " .. (hide and (" > " .. os_null) or "") .. os_concat .. runtest_tasks(jobname(lvtfile)) diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-ctan.lua b/Master/texmf-dist/tex/latex/l3build/l3build-ctan.lua index ed29399a2d3..da2e9777df8 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-ctan.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-ctan.lua @@ -35,9 +35,10 @@ function copyctan() end else for _,filetype in pairs(files) do - for _,file in pairs(tree(source,filetype)) do - local path,file = splitpath(file) - local ctantarget = ctandir .. "/" .. ctanpkg .. "/" .. path + for file,_ in pairs(tree(source,filetype)) do + local path = splitpath(file) + local ctantarget = ctandir .. "/" .. ctanpkg .. "/" + .. source .. "/" .. path mkdir(ctantarget) cp(file,source,ctantarget) end diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-file-functions.lua b/Master/texmf-dist/tex/latex/l3build/l3build-file-functions.lua index 71311bf51c1..a8c24356353 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-file-functions.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build-file-functions.lua @@ -22,17 +22,31 @@ for those people who are interested. --]] +local pairs = pairs +local print = print + +local open = io.open + +local attributes = lfs.attributes +local currentdir = lfs.currentdir +local chdir = lfs.chdir +local lfs_dir = lfs.dir local execute = os.execute local getenv = os.getenv +local remove = os.remove local os_time = os.time local os_type = os.type +local luatex_revision = status.luatex_revision +local luatex_version = status.luatex_version + local match = string.match local sub = string.sub +local gmatch = string.gmatch local gsub = string.gsub - +local insert = table.insert -- Convert a file glob into a pattern for use by e.g. string.gub -- Based on https://github.com/davidm/lua-glob-pattern @@ -132,9 +146,9 @@ if os_type == "windows" then os_diffexe = getenv("diffexe") or "fc /n" os_grepexe = "findstr /r" os_newline = "\n" - if tonumber(status.luatex_version) < 100 or - (tonumber(status.luatex_version) == 100 - and tonumber(status.luatex_revision) < 4) then + if tonumber(luatex_version) < 100 or + (tonumber(luatex_version) == 100 + and tonumber(luatex_revision) < 4) then os_newline = "\r\n" end os_null = "nul" @@ -143,12 +157,24 @@ if os_type == "windows" then os_yes = "for /l %I in (1,1,200) do @echo y" end +-- Deal with the fact that Windows and Unix use different path separators +local function unix_to_win(path) + return gsub(path, "/", "\\") +end + +function normalize_path(path) + if os_type == "windows" then + return unix_to_win(path) + end + return path +end + -- Return an absolute path from a relative one function abspath(path) - local oldpwd = lfs.currentdir() - lfs.chdir(path) - local result = lfs.currentdir() - lfs.chdir(oldpwd) + local oldpwd = currentdir() + chdir(path) + local result = currentdir() + chdir(oldpwd) return gsub(result, "\\", "/") end @@ -167,7 +193,7 @@ function cp(glob, source, dest) for i,_ in pairs(tree(source, glob)) do local source = source .. "/" .. i if os_type == "windows" then - if lfs.attributes(source)["mode"] == "directory" then + if attributes(source)["mode"] == "directory" then errorlevel = execute( 'xcopy /y /e /i "' .. unix_to_win(source) .. '" "' .. unix_to_win(dest .. '/' .. i) .. '" > nul' @@ -204,7 +230,7 @@ function direxists(dir) end function fileexists(file) - local f = io.open(file, "r") + local f = open(file, "r") if f ~= nil then f:close() return true @@ -222,14 +248,14 @@ function filelist(path, glob) pattern = glob_to_pattern(glob) end if direxists(path) then - for entry in lfs.dir(path) do + for entry in lfs_dir(path) do if pattern then if match(entry, pattern) then - table.insert(files, entry) + insert(files, entry) end else if entry ~= "." and entry ~= ".." then - table.insert(files, entry) + insert(files, entry) end end end @@ -248,10 +274,10 @@ function tree(path, glob) return true end local function is_dir(file) - return lfs.attributes(file)["mode"] == "directory" + return attributes(file)["mode"] == "directory" end local dirs = {["."] = cropdots(path)} - for pattern, criterion in string.gmatch(cropdots(glob), "([^/]+)(/?)") do + for pattern, criterion in gmatch(cropdots(glob), "([^/]+)(/?)") do local criterion = criterion == "/" and is_dir or always_true function fill(path, dir, table) for _, file in ipairs(filelist(dir, pattern)) do @@ -341,7 +367,7 @@ end -- Remove file function rmfile(source, file) - os.remove(source .. "/" .. file) + remove(source .. "/" .. file) -- os.remove doesn't give a sensible errorlevel return 0 end @@ -362,16 +388,6 @@ function run(dir, cmd) return execute("cd " .. dir .. os_concat .. cmd) end --- Deal with the fact that Windows and Unix use different path separators -function unix_to_win(path) - if os_type == "windows" then - return gsub(path, "/", "\\") - else - return path - end -end - - -- Split a path into file and directory component function splitpath(file) local path, name = match(file, "^(.*)/([^/]*)$") diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/tex/latex/l3build/l3build.lua index 947079b6e9f..10447196710 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build.lua @@ -23,7 +23,7 @@ for those people who are interested. --]] -- Version information -release_date = "2018/01/27" +release_date = "2018/02/20" -- File operations are aided by the LuaFileSystem module local lfs = require("lfs") -- cgit v1.2.3