diff options
Diffstat (limited to 'Master/texmf-dist/scripts')
4 files changed, 61 insertions, 104 deletions
diff --git a/Master/texmf-dist/scripts/l3build/l3build-check.lua b/Master/texmf-dist/scripts/l3build/l3build-check.lua index 556f326cd70..416bfb4c994 100644 --- a/Master/texmf-dist/scripts/l3build/l3build-check.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-check.lua @@ -98,7 +98,7 @@ end -- the 'business' part from the tests and removes system-dependent stuff local function normalize_log(content,engine,errlevels) local maxprintline = maxprintline - if engine == "luatex" or engine == "luajittex" then + if match(engine,"^lua") then maxprintline = maxprintline + 1 -- Deal with an out-by-one error end local function killcheck(line) @@ -553,7 +553,7 @@ function runcheck(name, hide) for _,engine in pairs(checkengines) do local enginename = engine -- Allow for luatex == luajittex for .tlg/.tpf purposes - if engine == "luajittex" then + if match(engine,"^lua") then engine = "luatex" end setup_check(name,engine) @@ -638,8 +638,7 @@ function compare_tlg(name, engine,cleanup) -- LuaTeX-specific .tlg file and the default engine is not LuaTeX if engine == "luatex" and not match(tlgfile, "%.luatex" .. "%" .. tlgext) - and stdengine ~= "luatex" - and stdengine ~= "luajittex" + and not match(stdengine,"^lua") then local lualogfile = logfile if cleanup then @@ -671,25 +670,20 @@ function runtest(name, engine, hide, ext, pdfmode, breakout) 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 realengine = engine local format = "" - if - match(checkformat, "tex$") and - not match(engine, checkformat) then - format = " -fmt=" .. gsub(engine, "(.*)tex$", "%1") .. checkformat - end - -- Special casing for e-LaTeX format - if - match(checkformat, "^latex$") and - match(engine, "^etex$") then - format = " -fmt=latex" - end - -- Special casing for (u)pTeX LaTeX formats - if - match(checkformat, "^latex$") and - match(engine, "^u?ptex$") then - realengine = "e" .. engine + if checkformat == "latex" then + -- Special case for e-LaTeX format + if engine == "etex" then + format = " -fmt=latex" + -- Use "...latex" formats for other engines + elseif not match(engine,"latex") then + format = " -fmt=" .. gsub(engine,"tex","latex") + end + -- Special case for (u)pTeX LaTeX + if match(engine,"^u?ptex$") then + realengine = "e" .. engine + end end -- Special casing for XeTeX engine local checkopts = checkopts @@ -703,7 +697,7 @@ function runtest(name, engine, hide, ext, pdfmode, breakout) if match(checkformat, "^context$") then format = "" function setup(file) return ' "' .. file .. '" ' end - if engine == "luatex" or engine == "luajittex" then + if match(engine,"^lua") then realengine = "context" elseif engine == "pdftex" then realengine = "texexec" diff --git a/Master/texmf-dist/scripts/l3build/l3build-file-functions.lua b/Master/texmf-dist/scripts/l3build/l3build-file-functions.lua index bc462d3ff33..bf5ce872b15 100644 --- a/Master/texmf-dist/scripts/l3build/l3build-file-functions.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-file-functions.lua @@ -33,6 +33,7 @@ local chdir = lfs.chdir local lfs_dir = lfs.dir local execute = os.execute +local exit = os.exit local getenv = os.getenv local remove = os.remove local os_time = os.time @@ -90,67 +91,6 @@ local function glob_to_pattern(glob) return match(char, "^%w$") and char or "%" .. char end - -- remove a leading "\" if one is present: - -- this can simple be discarded - local function unescape() - if char == "\\" then - i = i + 1 - char = sub(glob,i,i) - if char == "" then - pattern = "[^]" - return false - end - end - return true - end - - -- look for the body of a set: - -- char is already the first token - local function collect_set() - while true do - if char == "" then - pattern = "[^]" - return false - elseif char == "]" then - pattern = pattern .. "]" - break - else - if not unescape(char) then break end - local char_one = char - i = i + 1 - char = sub(glob,i,i) - if char == "" then - pattern = "[^]" - return false - elseif char == "-" then - i = i + 1 - char = sub(glob,i,i) - if char == "" then - pattern = "[^]" - return false - elseif char == "]" then - -- Not a range - pattern = pattern .. escape(char_one) .. "%-]" - return true - else - if not unescape(char) then break end - pattern = pattern .. escape(char_one) .. "-" .. escape(char) - end - elseif char == "]" then - -- Successfully done - pattern = pattern .. escape(char_one) .. "]" - return true - else - pattern = pattern .. escape(char_one) - i = i - 1 -- Back up one - end - end - i = i + 1 - char = sub(glob,i,i) - end - return true - end - -- Convert tokens. while true do i = i + 1 @@ -163,24 +103,9 @@ local function glob_to_pattern(glob) elseif char == "*" then pattern = pattern .. ".*" elseif char == "[" then - -- Search inside a charset - i = i + 1 - char = sub(glob,i,i) - if char == "" or char == "]" then -- Matches nothing - pattern = "[^]" - break - elseif char == "^" or char == "!" then - i = i + 1 - char = sub(glob,i,i) - if char ~= "]" then -- Matches anything so ignore - pattern = pattern .. "[^" - if not collect_set() then break end - end - else - pattern = pattern .. "[" - if not collect_set() then break end - end - elseif char == "\\" then -- Discarded + -- Ignored + print("[...] syntax not supported in globs!") + elseif char == "\\" then i = i + 1 char = sub(glob, i, i) if char == "" then @@ -206,6 +131,8 @@ os_setenv = "export" os_yes = "printf 'y\\n%.0s' {1..200}" os_ascii = "echo \"\"" +os_cmpexe = getenv("cmpexe") or "cmp" +os_cmpext = getenv("cmpext") or ".cmp" os_diffext = getenv("diffext") or ".diff" os_diffexe = getenv("diffexe") or "diff -c --strip-trailing-cr" os_grepexe = "grep" @@ -213,10 +140,13 @@ os_newline = "\n" if os_type == "windows" then os_ascii = "@echo." + os_cmpexe = getenv("cmpexe") or "fc /b" + os_cmpext = getenv("cmpext") or ".cmp" os_concat = "&" os_diffext = getenv("diffext") or ".fc" os_diffexe = getenv("diffexe") or "fc /n" os_grepexe = "findstr /r" + os_newline = "\n" if tonumber(luatex_version) < 100 or (tonumber(luatex_version) == 100 and tonumber(luatex_revision) < 4) then @@ -246,7 +176,26 @@ function abspath(path) chdir(path) local result = currentdir() chdir(oldpwd) - return gsub(result, "\\", "/") + return escapepath(gsub(result, "\\", "/")) +end + +function escapepath(path) + if os_type == "windows" then + local path,count = gsub(path,'"','') + if count % 2 ~= 0 then + print("Unbalanced quotes in path") + exit(0) + else + if match(path," ") then + return '"' .. path .. '"' + end + return path + end + else + path = gsub(path,"\\ ","[PATH-SPACE]") + path = gsub(path," ","\\ ") + return gsub(path,"[PATH-SPACE]","\\ ") + end end -- For cleaning out a directory, which also ensures that it exists diff --git a/Master/texmf-dist/scripts/l3build/l3build-install.lua b/Master/texmf-dist/scripts/l3build/l3build-install.lua index 12c59914916..f32dcd003fd 100644 --- a/Master/texmf-dist/scripts/l3build/l3build-install.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-install.lua @@ -36,7 +36,7 @@ local insert = table.insert local function gethome() set_program("latex") - return options["texmfhome"] or var_value("TEXMFHOME") + return abspath(options["texmfhome"] or var_value("TEXMFHOME")) end function uninstall() diff --git a/Master/texmf-dist/scripts/l3build/l3build.lua b/Master/texmf-dist/scripts/l3build/l3build.lua index cdf1dead187..bb5b27bfd80 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 = "2018-09-26" +release_date = "2018-10-25" -- File operations are aided by the LuaFileSystem module local lfs = require("lfs") @@ -95,6 +95,20 @@ end -- comes after any user versions build_require("variables") +-- Ensure that directories are 'space safe' +maindir = escapepath(maindir) +docfiledir = escapepath(docfiledir) +sourcefiledir = escapepath(sourcefiledir) +supportdir = escapepath(supportdir) +testfiledir = escapepath(testfiledir) +testsuppdir = escapepath(testsuppdir) +builddir = escapepath(builddir) +distribdir = escapepath(distribdir) +localdir = escapepath(localdir) +testdir = escapepath(testdir) +typesetdir = escapepath(typesetdir) +unpackdir = escapepath(unpackdir) + -- Tidy up the epoch setting -- Force an epoch if set at the command line -- Must be done after loading variables, etc. |