diff options
author | Karl Berry <karl@freefriends.org> | 2018-03-08 23:45:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-03-08 23:45:11 +0000 |
commit | 64ee185d962cd13195e329ab4ac8a9da6535b677 (patch) | |
tree | 652f96f04e1826a75ef1c3a38ab3d2a72ff9c067 /Master | |
parent | a502f321bf373ab83e239389e55d622e6c6980e2 (diff) |
l3build now cmdline script (9mar18)
git-svn-id: svn://tug.org/texlive/trunk@46894 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
49 files changed, 592 insertions, 526 deletions
diff --git a/Master/bin/aarch64-linux/l3build b/Master/bin/aarch64-linux/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/aarch64-linux/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/amd64-freebsd/l3build b/Master/bin/amd64-freebsd/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/amd64-freebsd/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/amd64-netbsd/l3build b/Master/bin/amd64-netbsd/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/amd64-netbsd/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/armel-linux/l3build b/Master/bin/armel-linux/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/armel-linux/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/armhf-linux/l3build b/Master/bin/armhf-linux/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/armhf-linux/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/i386-cygwin/l3build b/Master/bin/i386-cygwin/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/i386-cygwin/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/i386-darwin/l3build b/Master/bin/i386-darwin/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/i386-darwin/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/i386-freebsd/l3build b/Master/bin/i386-freebsd/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/i386-freebsd/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/i386-linux/l3build b/Master/bin/i386-linux/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/i386-linux/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/i386-linuxmusl/l3build b/Master/bin/i386-linuxmusl/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/i386-linuxmusl/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/i386-netbsd/l3build b/Master/bin/i386-netbsd/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/i386-netbsd/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/i386-solaris/l3build b/Master/bin/i386-solaris/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/i386-solaris/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/powerpc-darwin/l3build b/Master/bin/powerpc-darwin/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/powerpc-darwin/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/powerpc-linux/l3build b/Master/bin/powerpc-linux/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/powerpc-linux/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/sparc-solaris/l3build b/Master/bin/sparc-solaris/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/sparc-solaris/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/win32/l3build.exe b/Master/bin/win32/l3build.exe Binary files differnew file mode 100755 index 00000000000..5777d90a17a --- /dev/null +++ b/Master/bin/win32/l3build.exe diff --git a/Master/bin/x86_64-cygwin/l3build b/Master/bin/x86_64-cygwin/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/x86_64-cygwin/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/x86_64-darwin/l3build b/Master/bin/x86_64-darwin/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/x86_64-darwin/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/x86_64-darwinlegacy/l3build b/Master/bin/x86_64-darwinlegacy/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/x86_64-darwinlegacy/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/x86_64-linux/l3build b/Master/bin/x86_64-linux/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/x86_64-linux/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/x86_64-linuxmusl/l3build b/Master/bin/x86_64-linuxmusl/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/x86_64-linuxmusl/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/bin/x86_64-solaris/l3build b/Master/bin/x86_64-solaris/l3build new file mode 120000 index 00000000000..273aa633b27 --- /dev/null +++ b/Master/bin/x86_64-solaris/l3build @@ -0,0 +1 @@ +../../texmf-dist/scripts/l3build/l3build.lua
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/l3build/README.md b/Master/texmf-dist/doc/latex/l3build/README.md index e4730041927..31532ef0744 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/02/20 +Release 2018-03-08 Overview -------- diff --git a/Master/texmf-dist/doc/latex/l3build/l3build.pdf b/Master/texmf-dist/doc/latex/l3build/l3build.pdf Binary files differindex 125ee8d5ee7..76c34a227dc 100644 --- a/Master/texmf-dist/doc/latex/l3build/l3build.pdf +++ b/Master/texmf-dist/doc/latex/l3build/l3build.pdf diff --git a/Master/texmf-dist/doc/man/man1/l3build.1 b/Master/texmf-dist/doc/man/man1/l3build.1 new file mode 100644 index 00000000000..5154cf5e492 --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/l3build.1 @@ -0,0 +1,67 @@ +.TH l3build 1 "2018-03-08" +.SH NAME +l3build \- Checking and building packages +.SH SYNOPSIS +l3build <command> [<options>] [<names>] +.SH DESCRIPTION +The l3build system is a Lua script for building TeX packages, with particular +emphasis on regression testing. It is written in cross-platform Lua code, so +can be used by any modern TeX distribution with the texlua interpreter. A +package for building with l3build can be written in any TeX dialect; its +defaults are set up for LaTeX packages written in the DocStrip style. +.PP +The most commonly used l3build commands are: +.IP check +Run all automated tests +.IP clean +Clean out directory tree +.IP doc +Typesets all documentation files +.IP install +Installs files into the local texmf tree +.IP save +Saves test validation log +.IP tag +Update release tags in files +.IP uninstall +Uninstalls files from the local texmf tree +.IP unpack +Unpacks the source files into the build tree +.SH OPTIONS +Various options apply +.IP --config|-c +Sets the config(s) used for running tests +.IP --date +Sets the date to insert into sources +.IP --dry-run +Dry run for install +.IP --engine|-e +Sets the engine(s) to use for running test +.IP --epoch +Sets the epoch for tests and typesetting +.IP --first +Name of first test to run +.IP --force|-f +Force tests to run if engine is not set up +.IP --halt-on-error|-H +Stops running tests after the first failure +.IP --last +Name of last test to run +.IP --pdf|-p +Check/save PDF files +.IP --quiet|-q +Suppresses TeX output when unpacking +.IP --rerun +Skip setup: simply rerun tests +.IP --shuffle +Shuffle order of tests +.IP --texmfhome +Location of user texmf tree +.SH BUGS +.SH AUTHOR +The LaTeX3 Project (latex-team@latex-project.org) +.PP +Please log issues on the GitHub homepage: +https://github.com/latex3/l3build/issues. +.SH SEE ALSO +See l3build.pdf for more details. diff --git a/Master/texmf-dist/doc/man/man1/l3build.man1.pdf b/Master/texmf-dist/doc/man/man1/l3build.man1.pdf Binary files differnew file mode 100644 index 00000000000..c36d4ea2e95 --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/l3build.man1.pdf diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-arguments.lua b/Master/texmf-dist/scripts/l3build/l3build-arguments.lua index b1d5b44ac0a..499e2c4031e 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-arguments.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-arguments.lua @@ -25,6 +25,13 @@ for those people who are interested. local exit = os.exit local stderr = io.stderr +local find = string.find +local gmatch = string.gmatch +local match = string.match +local sub = string.sub + +local insert = table.insert + -- Parse command line options option_list = @@ -109,20 +116,14 @@ option_list = { desc = "Location of user texmf tree", type = "string" - }, - version = - { - desc = "Sets the version to insert into sources", - short = "v", - type = "string" - }, + } } -- This is done as a function (rather than do ... end) as it allows early -- termination (break) local function argparse() local result = { } - local files = { } + local names = { } local long_options = { } local short_options = { } -- Turn long/short options into two lookup tables @@ -140,21 +141,23 @@ local function argparse() result["target"] = "help" if a then -- No options are allowed in position 1, so filter those out - if not string.match(a, "^%-") then + if a == "--version" then + result["target"] = "version" + elseif not match(a, "^%-") then result["target"] = a end end - -- Stop here if help is required - if result["target"] == "help" then + -- Stop here if help or version is required + if result["target"] == "help" or result["target"] == "version" then return result end -- An auxiliary to grab all file names into a table local function remainder(num) - local files = { } + local names = { } for i = num, #arg do - table.insert(files, arg[i]) + insert(names, arg[i]) end - return files + return names end -- Examine all other arguments -- Use a while loop rather than for as this makes it easier @@ -164,7 +167,7 @@ local function argparse() local a = arg[i] -- Terminate search for options if a == "--" then - files = remainder(i + 1) + names = remainder(i + 1) break end -- Look for optionals @@ -172,22 +175,22 @@ local function argparse() local optarg local opts -- Look for and option and get it into a variable - if string.match(a, "^%-") then - if string.match(a, "^%-%-") then + if match(a, "^%-") then + if match(a, "^%-%-") then opts = long_options - local pos = string.find(a, "=", 1, true) + local pos = find(a, "=", 1, true) if pos then - opt = string.sub(a, 3, pos - 1) - optarg = string.sub(a, pos + 1) + opt = sub(a, 3, pos - 1) + optarg = sub(a, pos + 1) else - opt = string.sub(a, 3) + opt = sub(a, 3) end else opts = short_options - opt = string.sub(a, 2, 2) + opt = sub(a, 2, 2) -- Only set optarg if it is there if #a > 2 then - optarg = string.sub(a, 3) + optarg = sub(a, 3) end end -- Now check that the option is valid and sort out the argument @@ -197,7 +200,7 @@ local function argparse() -- Tidy up arguments if option_list[optname]["type"] == "boolean" then if optarg then - local opt = "-" .. (string.match(a, "^%-%-") and "-" or "") .. opt + local opt = "-" .. (match(a, "^%-%-") and "-" or "") .. opt stderr:write("Value not allowed for option " .. opt .."\n") return {"help"} end @@ -221,8 +224,8 @@ local function argparse() result[optname] = optarg else local opts = result[optname] or { } - for hit in string.gmatch(optarg, "([^,%s]+)") do - table.insert(opts, hit) + for hit in gmatch(optarg, "([^,%s]+)") do + insert(opts, hit) end result[optname] = opts end @@ -232,12 +235,12 @@ local function argparse() i = i + 1 end if not opt then - files = remainder(i) + names = remainder(i) break end end - if next(files) then - result["files"] = files + if next(names) then + result["names"] = names end return result end @@ -245,42 +248,23 @@ end options = argparse() -- Sanity check -if options["engine"] and not options["force"] then - -- Make a lookup table - local t = { } - for _, engine in pairs(checkengines) do - t[engine] = true - end - for _, engine in pairs(options["engine"]) do - if not t[engine] then - print("\n! Error: Engine \"" .. engine .. "\" not set up for testing!") - print("\n Valid values are:") - for _, engine in ipairs(checkengines) do - print(" - " .. engine) +function check_engines() + if options["engine"] and not options["force"] then + -- Make a lookup table + local t = { } + for _, engine in pairs(checkengines) do + t[engine] = true + end + for _, engine in pairs(options["engine"]) do + if not t[engine] then + print("\n! Error: Engine \"" .. engine .. "\" not set up for testing!") + print("\n Valid values are:") + for _, engine in ipairs(checkengines) do + print(" - " .. engine) + end + print("") + exit(1) end - print("") - exit(1) end end end - --- Tidy up the epoch setting --- Force an epoch if set at the command line -if options["epoch"] then - epoch = options["epoch"] - forcecheckepoch = true - forcedocepoch = true -end --- If given as an ISO date, turn into an epoch number -do - local y, m, d = string.match(epoch, "^(%d%d%d%d)-(%d%d)-(%d%d)$") - if y then - epoch = - os_time({year = y, month = m, day = d, hour = 0, sec = 0, isdst = nil}) - - os_time({year = 1970, month = 1, day = 1, hour = 0, sec = 0, isdst = nil}) - elseif string.match(epoch, "^%d+$") then - epoch = tonumber(epoch) - else - epoch = 0 - end -end diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-aux.lua b/Master/texmf-dist/scripts/l3build/l3build-aux.lua index 102f9ba83be..773a17a40e1 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-aux.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-aux.lua @@ -22,10 +22,29 @@ for those people who are interested. --]] +local match = string.match + +local pairs = pairs +local print = print + -- -- Auxiliary functions which are used by more than one main function -- +function normalise_epoch() + -- If given as an ISO date, turn into an epoch number + local y, m, d = match(epoch, "^(%d%d%d%d)-(%d%d)-(%d%d)$") + if y then + epoch = + os_time({year = y, month = m, day = d, hour = 0, sec = 0, isdst = nil}) - + os_time({year = 1970, month = 1, day = 1, hour = 0, sec = 0, isdst = nil}) + elseif match(epoch, "^%d+$") then + epoch = tonumber(epoch) + else + epoch = 0 + end +end + function setepoch() return os_setenv .. " SOURCE_DATE_EPOCH=" .. epoch @@ -36,13 +55,21 @@ function setepoch() .. os_concat end +local function getscriptname() + if match(arg[0], "l3build(%.lua)$") then + return "l3build.lua" + else + return "build.lua" + end +end + -- Do some subtarget for all modules in a bundle function call(dirs, target, opts) -- Turn the option table into a string local opts = opts or options local s = "" for k,v in pairs(opts) do - if k ~= "files" and k ~= "target" then -- Special cases + if k ~= "names" and k ~= "target" then -- Special cases local t = option_list[k] or { } local arg = "" if t["type"] == "string" then @@ -60,16 +87,20 @@ function call(dirs, target, opts) s = s .. " --" .. k .. arg end end - if opts["files"] then - for _,v in pairs(opts["files"]) do + if opts["names"] then + for _,v in pairs(opts["names"]) do s = s .. " " .. v end end + local scriptname = getscriptname() for _,i in ipairs(dirs) do + local text = " for module " .. i + if i == "." then + text = " with configuration " .. opts["config"][1] + end print( "Running script " .. scriptname .. " with target \"" .. target - .. "\" for module " - .. i + .. "\"" .. text ) local errorlevel = run( i, @@ -87,7 +118,7 @@ function depinstall(deps) local errorlevel for _,i in ipairs(deps) do print("Installing dependency: " .. i) - errorlevel = run(i, "texlua " .. scriptname .. " unpack -q") + errorlevel = run(i, "texlua " .. getscriptname() .. " unpack -q") if errorlevel ~= 0 then return errorlevel end diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-check.lua b/Master/texmf-dist/scripts/l3build/l3build-check.lua index 66319cc62bf..2239fe97a76 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-check.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-check.lua @@ -30,6 +30,8 @@ local output = io.output local rnd = math.random +local luatex_version = status.luatex_version + local len = string.len local char = string.char local format = string.format @@ -142,10 +144,16 @@ local function formatlog(logfile, newfile, engine, errlevels) return "", (lastline or "") .. line end -- TeX90/XeTeX knows only the smaller set of dimension units - line = gsub( - line, - "cm, mm, dd, cc, bp, or sp", "cm, mm, dd, cc, nd, nc, bp, or sp" - ) + line = gsub(line, + "cm, mm, dd, cc, bp, or sp", + "cm, mm, dd, cc, nd, nc, bp, or sp") + -- On the other hand, (u)pTeX has some new units! + line = gsub(line, + "em, ex, zw, zh, in, pt, pc,", + "em, ex, in, pt, pc,") + line = gsub(line, + "cm, mm, dd, cc, bp, H, Q, or sp;", + "cm, mm, dd, cc, nd, nc, bp, or sp;") -- Normalise a case where fixing a TeX bug changes the message text line = gsub(line, "\\csname\\endcsname ", "\\csname\\endcsname") -- Zap "on line <num>" and replace with "on line ..." @@ -189,7 +197,11 @@ local function formatlog(logfile, newfile, engine, errlevels) -- Remove 'normal' direction information on boxes with (u)pTeX line = gsub(line, ",? yoko direction,?", "") line = gsub(line, ",? yoko%(math%) direction,?", "") - -- Remove the \special line that in DVI mode keeps PDFs comparable + -- Remove '\displace 0.0' lines in (u)pTeX + if match(line,"^%.*\\displace 0%.0$") then + return "" + end + -- Remove the \special line that in DVI mode keeps PDFs comparable if match(line, "^%.*\\special%{pdf: docinfo << /Creator") then return "" end @@ -257,7 +269,7 @@ local function formatlog(logfile, newfile, engine, errlevels) end -- Additional normalization for LuaTeX -local function formatlualog(logfile, newfile) +local function formatlualog(logfile, newfile, luatex) local function normalize(line, lastline, dropping) -- Find \discretionary or \whatsit lines: -- These may come back later @@ -317,6 +329,25 @@ local function formatlualog(logfile, newfile) -- The first time a new font is used, it shows up -- as being cached line = gsub(line, "(save cache:", "(load cache:") + -- LuaTeX from v1.07 logs kerns differently ... + -- This block only applies to the output of LuaTeX itself, + -- hence needing a flag to skip the case of the reference log + if luatex and + tonumber(luatex_version) >= 107 and + match(line, "^%.*\\kern") then + -- Re-insert the space in explicit kerns + if match(line, "kern%-?%d+%.%d+ *$") then + line = gsub(line, "kern", "kern ") + elseif match(line, "%(accent%)$") then + line = gsub(line, "kern", "kern ") + line = gsub(line, "%(accent%)$", "(for accent)") + elseif match(line, "%(italic%)$") then + line = gsub(line, "kern", "kern ") + line = gsub(line, " %(italic%)$", "") + else + line = gsub(line, " %(font%)$", "") + end + end -- Changes in PDF specials line = gsub(line, "\\pdfliteral origin", "\\pdfliteral") -- A function to handle the box prefix part @@ -326,6 +357,7 @@ local function formatlualog(logfile, newfile) -- 'Recover' some discretionary data if match(lastline, "^%.+\\discretionary %(penalty 50%)$") and match(line, boxprefix(lastline) .. "%.= ") then + line = gsub(line," %(font%)$","") return gsub(line, "%.= ", ""),"" end -- Where the last line was a discretionary, looks for the @@ -573,8 +605,8 @@ function compare_tlg(name, engine) and stdengine ~= "luajittex" then local luatlgfile = testdir .. "/" .. name .. ".luatex" .. tlgext - formatlualog(tlgfile, luatlgfile) - formatlualog(logfile, logfile) + formatlualog(tlgfile, luatlgfile, false) + formatlualog(logfile, logfile, true) -- This allows code sharing below: we only need the .tlg name in one place tlgfile = luatlgfile end @@ -672,7 +704,7 @@ function runtest(name, engine, hide, ext, makepdf) -- Store secondary files for this engine for _,filetype in pairs(auxfiles) do for _,file in pairs(filelist(testdir, filetype)) do - if match(file,"^" .. name) then + if match(file,"^" .. name .. ".[^.]+$") then local ext = match(file, "%.[^.]+$") if ext ~= lvtext and ext ~= tlgext and diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-clean.lua b/Master/texmf-dist/scripts/l3build/l3build-clean.lua index 3fd8396c9ce..3fd8396c9ce 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-clean.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-clean.lua diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-ctan.lua b/Master/texmf-dist/scripts/l3build/l3build-ctan.lua index da2e9777df8..875f50dc4fa 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-ctan.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-ctan.lua @@ -23,6 +23,7 @@ for those people who are interested. --]] local gsub = string.gsub +local match = string.match local insert = table.insert -- Copy files to the main CTAN release directory @@ -45,7 +46,8 @@ function copyctan() end end end - for _,tab in pairs({bibfiles,demofiles,docfiles,pdffiles,typesetlist}) do + for _,tab in pairs( + {bibfiles,demofiles,docfiles,pdffiles,scriptmanfiles,typesetlist}) do copyfiles(tab,docfiledir) end copyfiles(sourcefiles,sourcefiledir) @@ -98,6 +100,16 @@ function copytds() install(unpackdir, "bibtex/bst", {bstfiles}, true) install(sourcefiledir, "source", {sourcelist}) install(unpackdir, "tex", {installfiles}) + install(unpackdir, "scripts", {scriptfiles}, true) + -- Any script man files need special handling + for _,glob in pairs(scriptmanfiles) do + for file,_ in pairs(tree(docfiledir,glob)) do + -- Man files should have a single-digit extension: the type + local installdir = tdsdir .. "/doc/man/man" .. match(file,".$") + mkdir(installdir) + cp(file,docfiledir,installdir) + end + end end -- Standard versions of the main targets for building modules @@ -222,7 +234,8 @@ function bundlectan() end typesetlist = excludelist(typesetfiles, {sourcefiles}, docfiledir) sourcelist = excludelist( - sourcefiles, {bstfiles, installfiles, makeindexfiles}, sourcefiledir + sourcefiles, {bstfiles, installfiles, makeindexfiles, scriptfiles}, + sourcefiledir ) copyctan() copytds() diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-file-functions.lua b/Master/texmf-dist/scripts/l3build/l3build-file-functions.lua index a8c24356353..a8c24356353 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-file-functions.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-file-functions.lua diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-help.lua b/Master/texmf-dist/scripts/l3build/l3build-help.lua index 7226cfa896c..770022f254d 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-help.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-help.lua @@ -46,7 +46,7 @@ function help() if module ~= "" and testfiledir ~= "" then print(" save Saves test validation log") end - print(" setversion Update version information in sources") + print(" tag Update release tags in files") print(" uninstall Uninstalls files from the local texmf tree") print(" unpack Unpacks the source files into the build tree") print("") diff --git a/Master/texmf-dist/scripts/l3build/l3build-install.lua b/Master/texmf-dist/scripts/l3build/l3build-install.lua new file mode 100644 index 00000000000..c18677e4271 --- /dev/null +++ b/Master/texmf-dist/scripts/l3build/l3build-install.lua @@ -0,0 +1,98 @@ +--[[ + +File l3build-install.lua Copyright (C) 2018 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 +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "l3build bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +----------------------------------------------------------------------- + +The development version of the bundle can be found at + + https://github.com/latex3/l3build + +for those people who are interested. + +--]] + +local pairs = pairs +local print = print + +local set_program = kpse.set_program_name +local var_value = kpse.var_value + +local function gethome() + set_program("latex") + return options["texmfhome"] or var_value("TEXMFHOME") +end + +function uninstall() + local function uninstall_files(target) + local installdir = gethome() .. target + if options["dry-run"] then + print("\n" .. "Installation root: " .. installdir) + local files = filelist(installdir) + -- Deal with an empty directory + if next(files) then + print("\n" .. "Files for removal:") + for _,file in pairs(filelist(installdir)) do + print("- " .. file) + end + else + print("No files present") + end + return 0 + else + return rmdir(installdir) + end + end + return uninstall_files("/tex/" .. moduledir) + + uninstall_files("/scripts/" .. module) +end + + +-- Locally install files: only deals with those extracted, not docs etc. +function install() + local function install_files(files,target) + if not next(files) then + return 0 + end + local installdir = gethome() .. target + if options["dry-run"] then + print("\n" .. "Installation root: " .. installdir + .. "\n" .. "Installation files:" + ) + for _,filetype in pairs(files) do + for _,file in pairs(filelist(unpackdir,filetype)) do + print("- " .. file) + end + end + return 0 + else + errorlevel = cleandir(installdir) + if errorlevel ~= 0 then + return errorlevel + end + for _,filetype in pairs(files) do + errorlevel = cp(filetype, unpackdir, installdir) + if errorlevel ~= 0 then + return errorlevel + end + end + end + return 0 + end + local errorlevel = unpack() + if errorlevel ~= 0 then + return errorlevel + end + return install_files(installfiles, "/tex/" .. moduledir) + + install_files(scriptfiles, "/scripts/" .. module) +end diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-manifest-setup.lua b/Master/texmf-dist/scripts/l3build/l3build-manifest-setup.lua index fb46eb1d369..fb46eb1d369 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-manifest-setup.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-manifest-setup.lua diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-manifest.lua b/Master/texmf-dist/scripts/l3build/l3build-manifest.lua index 3b899d55fd8..3b899d55fd8 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-manifest.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-manifest.lua diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-stdmain.lua b/Master/texmf-dist/scripts/l3build/l3build-stdmain.lua index 200afa99329..7dac27aa983 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-stdmain.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-stdmain.lua @@ -46,7 +46,7 @@ end -- The overall main function -- -function stdmain(target, files) +function stdmain(target, names) local errorlevel -- If the module name is empty, the script is running in a bundle: -- apart from ctan all of the targets are then just mappings @@ -66,18 +66,22 @@ function stdmain(target, files) errorlevel = ctan() elseif target == "install" then errorlevel = call(modules, "install") - elseif target == "setversion" then - errorlevel = call(modules, "setversion") - -- Deal with any files in the bundle dir itself - if errorlevel == 0 then - errorlevel = setversion() + elseif target == "tag" then + if options["names"] and #options["names"] == 1 then + errorlevel = call(modules,"tag") + -- Deal with any files in the bundle dir itself + if errorlevel == 0 then + errorlevel = tag(options["names"][1]) + end + else + print("Tag name required") + help() + exit(1) end elseif target == "uninstall" then errorlevel = call(modules, "uninstall") elseif target == "unpack" then errorlevel = call(modules, "bundleunpack") - elseif target == "version" then - version() else help() end @@ -90,9 +94,9 @@ function stdmain(target, files) elseif target == "bundlectan" then errorlevel = bundlectan() elseif target == "doc" then - errorlevel = doc(files) + errorlevel = doc(names) elseif target == "check" then - errorlevel = check(files) + errorlevel = check(names) elseif target == "clean" then errorlevel = clean() elseif target == "ctan" then @@ -102,19 +106,23 @@ function stdmain(target, files) elseif target == "manifest" then errorlevel = manifest() elseif target == "save" then - if next(files) then - errorlevel = save(files) + if next(names) then + errorlevel = save(names) + else + help() + end + elseif target == "tag" then + if options["names"] and #options["names"] == 1 then + errorlevel = tag(options["names"][1]) else + print("Tag name required") help() + exit(1) end - elseif target == "setversion" then - errorlevel = setversion() elseif target == "uninstall" then errorlevel = uninstall() elseif target == "unpack" then errorlevel = unpack() - elseif target == "version" then - version() else help() end diff --git a/Master/texmf-dist/scripts/l3build/l3build-tagging.lua b/Master/texmf-dist/scripts/l3build/l3build-tagging.lua new file mode 100644 index 00000000000..9a6f8cf5014 --- /dev/null +++ b/Master/texmf-dist/scripts/l3build/l3build-tagging.lua @@ -0,0 +1,80 @@ +--[[ + +File l3build-tagging.lua Copyright (C) 2018 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 +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "l3build bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +----------------------------------------------------------------------- + +The development version of the bundle can be found at + + https://github.com/latex3/l3build + +for those people who are interested. + +--]] + +local pairs = pairs +local open = io.open +local os_date = os.date +local match = string.match +local gsub = string.gsub + +function update_tag(filename,content,tagname,tagdate) + return content +end + +function tag_hook(tagname,tagdate) + return 0 +end + +local function update_file_tag(file,tagname,tagdate) + local filename = basename(file) + print("Tagging ".. filename) + local f = assert(open(file,"rb")) + local content = f:read("*all") + f:close() + -- Deal with Unix/Windows line endings + content = gsub(content .. (match(content,"\n$") and "" or "\n"), + "\r\n", "\n") + local updated_content = update_tag(filename,content,tagname,tagdate) + if content == updated_content then + return 0 + else + local path = dirname(file) + ren(path,filename,filename .. ".bak") + local f = assert(open(file,"w")) + -- Convert line ends back if required during write + -- Watch for the second return value! + f:write((gsub(updated_content,"\n",os_newline))) + f:close() + rm(path,filename .. ".bak") + end + return 0 +end + +function tag(tagname) + local tagdate = options["date"] or os_date("%Y-%m-%d") + local dirs = remove_duplicates({currentdir, sourcefiledir, docfiledir}) + local errorlevel = 0 + for _,dir in pairs(dirs) do + for _,filetype in pairs(tagfiles) do + for file,_ in pairs(tree(dir,filetype)) do + errorlevel = update_file_tag(dir .. "/" .. file,tagname,tagdate) + if errorlevel ~= 0 then + return errorlevel + end + end + end + end + return tag_hook(tagname,tagdate) +end + diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-typesetting.lua b/Master/texmf-dist/scripts/l3build/l3build-typesetting.lua index 229745dafc6..229745dafc6 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-typesetting.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-typesetting.lua diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-unpack.lua b/Master/texmf-dist/scripts/l3build/l3build-unpack.lua index 9779502c2fc..9779502c2fc 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-unpack.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-unpack.lua diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-variables.lua b/Master/texmf-dist/scripts/l3build/l3build-variables.lua index d531be2dca8..5d4e3265c2a 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build-variables.lua +++ b/Master/texmf-dist/scripts/l3build/l3build-variables.lua @@ -35,29 +35,6 @@ end module = module or "" bundle = bundle or "" --- Sanity check -if module == "" and bundle == "" then - if string.match(arg[0], "l3build%.lua$") then - print( - "\n" .. - "l3build: A testing and building system for LaTeX\n\n" .. - "Release " .. release_date - ) - if arg[1] and not string.match(arg[1], "version") then - print( - "\n" - .. "Error: Call l3build using a configuration file, not directly.\n" - ) - end - else - print( - "\n" - .. "Error: Specify either bundle or module in configuration script.\n" - ) - end - exit(1) -end - -- Directory structure for the build system -- Use Unix-style path separators currentdir = "." @@ -107,7 +84,10 @@ docfiles = docfiles or { } excludefiles = excludefiles or {"*~"} installfiles = installfiles or {"*.sty","*.cls"} makeindexfiles = makeindexfiles or {"*.ist"} +scriptfiles = scriptfiles or { } +scriptmanfiles = scriptmanfiles or { } sourcefiles = sourcefiles or {"*.dtx", "*.ins"} +tagfiles = tagfiles or {"*.dtx"} textfiles = textfiles or {"*.md", "*.txt"} typesetdemofiles = typesetdemofiles or { } typesetfiles = typesetfiles or {"*.dtx"} @@ -115,7 +95,6 @@ typesetsuppfiles = typesetsuppfiles or { } typesetsourcefiles = typesetsourcefiles or { } unpackfiles = unpackfiles or {"*.ins"} unpacksuppfiles = unpacksuppfiles or { } -versionfiles = versionfiles or {"*.dtx"} -- Roots which should be unpacked to support unpacking/testing/typesetting checkdeps = checkdeps or { } @@ -138,8 +117,7 @@ checkformat = checkformat or "latex" stdengine = stdengine or "pdftex" -- Configs for testing -stdconfig = stdconfig or string.gsub(arg[0], "%.lua$", "") -checkconfigs = checkconfigs or {stdconfig} +checkconfigs = checkconfigs or {"build"} -- Enable access to trees outside of the repo -- As these may be set false, a more elaborate test than normal is needed @@ -170,7 +148,7 @@ if forcecheckepoch == nil then forcecheckepoch = true end if forcedocepoch == nil then - forcedocepoch = true + forcedocepoch = false end -- Other required settings @@ -182,7 +160,6 @@ if flatten == nil then end maxprintline = maxprintline or 79 packtdszip = packtdszip or false -scriptname = scriptname or "build.lua" typesetcmds = typesetcmds or "" typesetruns = typesetruns or 2 versionform = versionform or "" @@ -199,4 +176,4 @@ psext = psext or ".ps" tlgext = tlgext or ".tlg" -- Manifest options -manifestfile = "MANIFEST.md" +manifestfile = manifestfile or "MANIFEST.md" diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/scripts/l3build/l3build.lua index 10447196710..cb8a6d674cb 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build.lua +++ b/Master/texmf-dist/scripts/l3build/l3build.lua @@ -23,7 +23,7 @@ for those people who are interested. --]] -- Version information -release_date = "2018/02/20" +release_date = "2018-03-08" -- File operations are aided by the LuaFileSystem module local lfs = require("lfs") @@ -32,6 +32,8 @@ local lfs = require("lfs") local assert = assert local ipairs = ipairs +local lookup = kpse.lookup +local match = string.match local next = next local print = print local select = select @@ -39,15 +41,25 @@ local tonumber = tonumber local exit = os.exit -- l3build setup and functions - kpse.set_program_name("kpsewhich") -build_kpse_path = string.match(kpse.lookup("l3build.lua"),"(.*[/])") +build_kpse_path = string.match(lookup("l3build.lua"),"(.*[/])") local function build_require(s) - require( kpse.lookup("l3build-"..s..".lua", { path = build_kpse_path } ) ) + require(lookup("l3build-"..s..".lua", { path = build_kpse_path } ) ) end -build_require("variables") +-- Minimal code to do basic checks build_require("arguments") +build_require("help") + +-- Filter out special cases early +if options["target"] == "help" then + help() + exit(0) +elseif options["target"] == "version" then + version() + exit(0) +end + build_require("file-functions") build_require("typesetting") build_require("aux") @@ -58,15 +70,52 @@ build_require("install") build_require("unpack") build_require("manifest") build_require("manifest-setup") -build_require("setversion") -build_require("help") +build_require("tagging") build_require("stdmain") -- Allow main function to be disabled 'higher up' main = main or stdmain +-- Load configuration file if running as a script +if match(arg[0], "l3build(%.lua)$") then + -- Look for some configuration details + if fileexists("build.lua") then + dofile("build.lua") + else + print("Error: Cannot find configuration build.lua") + exit(1) + end +end + +-- Load standard settings for variables: +-- comes after any user versions +build_require("variables") + +-- Tidy up the epoch setting +-- Force an epoch if set at the command line +-- Must be done after loading variables, etc. +if options["epoch"] then + epoch = options["epoch"] + forcecheckepoch = true + forcedocepoch = true +end +normalise_epoch() + +-- Sanity check +check_engines() + +-- -- Deal with multiple configs for tests -checkconfigs = options["config"] or checkconfigs +-- + +-- When we have specific files to deal with, only use explicit configs +-- (or just the std one) +if options["names"] then + checkconfigs = options["config"] or {stdconfig} +else + checkconfigs = options["config"] or checkconfigs +end + if options["target"] == "check" then if #checkconfigs > 1 then local errorlevel = 0 @@ -81,7 +130,7 @@ if options["target"] == "check" then end end if #checkconfigs == 1 and - checkconfigs[1] ~= stdconfig and + checkconfigs[1] ~= "build" and (options["target"] == "check" or options["target"] == "save") then local config = "./" .. checkconfigs[1] .. ".lua" if fileexists(config) then @@ -93,4 +142,4 @@ if #checkconfigs == 1 and end -- Call the main function -main(options["target"], options["files"]) +main(options["target"], options["names"]) diff --git a/Master/texmf-dist/source/latex/l3build/build.lua b/Master/texmf-dist/source/latex/l3build/build.lua deleted file mode 100644 index 0a6bc7ceb55..00000000000 --- a/Master/texmf-dist/source/latex/l3build/build.lua +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env texlua - --- Build script for LaTeX3 "l3build" files - --- Identify the bundle and module -module = "l3build" -bundle = "" - --- Non-standard settings -checkconfigs = {"build", "config-plain"} -checkdeps = { } -checkengines = {"pdftex", "xetex", "luatex", "ptex", "uptex"} -cleanfiles = {"*.pdf", "*.tex", "*.zip"} -installfiles = {"l3build*.lua", "regression-test.tex"} -packtdszip = true -sourcefiles = {"*.dtx", "*.lua", "*.ins"} -typesetcmds = "\\AtBeginDocument{\\DisableImplementation}" -unpackdeps = { } -versionfiles = {"*.dtx", "*.md", "*.lua"} - --- Detail how to set the version automatically -function setversion_update_line(line, date, version) - local date = string.gsub(date, "%-", "/") - -- .dtx file - if string.match(line, "^%% \\date{Released %d%d%d%d/%d%d/%d%d}$") then - line = string.gsub(line, "%d%d%d%d/%d%d/%d%d", date) - end - -- Markdown files - if string.match( - line, "^Release %d%d%d%d/%d%d/%d%d$" - ) then - line = "Release " .. date - end - -- l3build.lua - if string.match(line, "^release_date = \"%d%d%d%d/%d%d/%d%d\"$") then - line = "release_date = \"" .. date .. "\"" - end - return line -end - --- Load l3build itself: truly self-contained so no kpsewhich() here -dofile("./l3build.lua") diff --git a/Master/texmf-dist/source/latex/l3build/config-plain.lua b/Master/texmf-dist/source/latex/l3build/config-plain.lua deleted file mode 100644 index b59b2c110ce..00000000000 --- a/Master/texmf-dist/source/latex/l3build/config-plain.lua +++ /dev/null @@ -1,2 +0,0 @@ -checkformat = "tex" -testfiledir = "testfiles-plain"
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/l3build/l3build.dtx b/Master/texmf-dist/source/latex/l3build/l3build.dtx index 9b875e562a4..0dab5b0055e 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.dtx +++ b/Master/texmf-dist/source/latex/l3build/l3build.dtx @@ -1,6 +1,6 @@ % \iffalse % -% File l3build.dtx (C) Copyright 2014-2017 The LaTeX3 Project +% File l3build.dtx (C) Copyright 2014-2018 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 @@ -85,9 +85,12 @@ \luavarset{demofiles} {\{\}}{Files which show how to use a module} \luavarset{docfiles} {\{\}}{Files which are part of the documentation but should not be typeset} \luavarset{excludefiles} {\{"*\string~"\}}{Files to ignore entirely (default for Emacs backup files)} -\luavarset{installfiles} {\{"*.sty","*.cls"\}}{Files to install to the \TeX{} tree and similar task} +\luavarset{installfiles} {\{"*.sty","*.cls"\}}{Files to install to the \texttt{text} area of the \texttt{texmf} tree} \luavarset{makeindexfiles} {\{"*.ist"\}}{MakeIndex files to be included in a TDS-style zip} +\luavarset{scriptfiles} {\{ \}}{Files to install to the \texttt{scripts} area of the \texttt{texmf} tree} +\luavarset{scriptmanfiles} {\{ \}}{Files to install to the \texttt{doc/man} area of the \texttt{texmf} tree} \luavarset{sourcefiles} {\{"*.dtx", "*.ins"\}}{Files to copy for unpacking} +\luavarset{tagfiles} {\{"*.dtx"\}}{Files for automatic tagging} \luavarset{textfiles} {\{"*.md", "*.txt"\}}{Plain text files to send to CTAN as-is} \luavarset{typesetdemofiles} {\{\}}{Files to typeset before the documentation for inclusion in main documentation files} \luavarset{typesetfiles} {\{"*.dtx"\}}{Files to typeset for documentation} @@ -95,7 +98,6 @@ \luavarset{typesetsourcefiles}{\{\}}{Files to copy to unpacking when typesetting.} \luavarset{unpackfiles} {\{"*.ins"\}}{Files to run to perform unpacking.} \luavarset{unpacksuppfiles} {\{\}}{Files needed to support unpacking when \enquote{sandboxed}} -\luavarset{versionfiles} {\{"*.dtx"\}}{Files for automatic version editing} \luavarseparator \luavarset{bakext}{".bak"}{Extension of backup files} \luavarset{dviext}{".dvi"}{Extension of DVI files} @@ -115,7 +117,6 @@ \luavarset{checkformat} {"latex"} {Format to use for tests} \luavarseparator \luavarset{checkconfigs}{\{\}}{Configurations to use for tests} -\luavarset{stdconfig} {\meta{Main script}}{Standard test configuration} \luavarseparator \luavarset{typesetexe}{"pdflatex"}{Executable for compiling \texttt{doc(s)}} \luavarset{unpackexe} {"tex"} {Executable for running \texttt{unpack}} @@ -150,10 +151,8 @@ \luavarset{flatten} {true} {Switch to flatten any source structure when sending to CTAN} \luavarset{maxprintline}{79} {Length of line to use in log files} \luavarset{packtdszip} {false} {Switch to build a TDS-style zip file for CTAN} -\luavarset{scriptname} {"build.lua"} {Name of script used in dependencies} \luavarset{typesetcmds} {""} {Instructions to be passed to \TeX{} when doing typesetting.} \luavarset{typsetcycles}{3} {Number of cycles of typesetting to carry out.} -\luavarset{versionform} {""} {Nature of version strings for auto-replacement.} \luavarset{recordstatus}{false} {Switch to include error level from test runs in \texttt{.tlg} files} \luavarset{manifestfile} {"MANIFEST.md"} {Filename to use for the manifest file.} } @@ -217,7 +216,7 @@ % }^^A % } % -% \date{Released 2018/02/20} +% \date{Released 2018-03-08} % % \maketitle % \tableofcontents @@ -234,7 +233,7 @@ % % Test files are written as standalone \TeX{} documents using the |regression-test.tex| setup file; documentation on writing these tests is discussed in Section~\ref{sec:writing-tests}. % -% The |l3build.lua| script is not designed to be executed directly; each package will define its own |build.lua| script as a driver file which both sets variables (such as the name of the package) and then calls the main |l3build.lua| script internally. +% Each package will define its own |build.lua| configuration file which both sets variables (such as the name of the package) and may also provide custom functions. % % \pagebreak[2] % A standard package layout might look something like the following: @@ -305,37 +304,35 @@ % \item doc \meta{name(s)} % \item install % \item save \meta{name(s)} -% \item setversion +% \item tag % \item unpack % \end{itemize} % These commands are described below. % % As well as these commands, the system recognises the options % \begin{itemize} -% \item \texttt{--config} (\texttt{-c}) Configuration(s) to use for testing -% \item \texttt{--date} Date to use when setting version +% \item |--config| (|-c|) Configuration(s) to use for testing +% \item |--date| Date to use when tagging % data -% \item \texttt{--dry-run} Runs the \texttt{install} target but does not copy +% \item |--dry-run| Runs the \texttt{install} target but does not copy % any files: simply lists those that would be installed -% \item \texttt{--engine} (\texttt{-e}) Sets the engine to use for +% \item |--engine| (|-e|) Sets the engine to use for % testing -% \item \texttt{--epoch} Sets the epoch for typesetting and testing -% \item \texttt{--first} Name of the first test to run -% \item \texttt{--force} (\texttt{-f}) Force checks to run even if sanity -% checks fail, \emph{e.g.}~when \texttt{--engine} is not given in +% \item |--epoch| Sets the epoch for typesetting and testing +% \item |--first| Name of the first test to run +% \item |--force| (|-f|) Force checks to run even if sanity +% checks fail, \emph{e.g.}~when |--engine| is not given in % \luavar{checkengines} -% \item \texttt{--halt-on-error} (\texttt{-H}) Specifies that checks +% \item |--halt-on-error| (|-H|) Specifies that checks % should stop as soon as possible, rather than running all requested % tests; the difference file is printed in the terminal directly in the case of failure -% \item \texttt{--last} Name of the last test to run -% \item \texttt{--pdf} (\texttt{-p}) Test PDF file against a reference +% \item |--last| Name of the last test to run +% \item |--pdf| (|-p|) Test PDF file against a reference % version rather than using a log comparison -% \item \texttt{--quiet} (\texttt{-q}) Suppresses output from unpacking -% \item \texttt{--rerun} Run tests without unpacking/set up -% \item \texttt{--shuffle} Shuffle the order in whichs tests run -% \item \texttt{--texmfhome} Sets the location of the user tree for installing -% \item \texttt{--version} (\texttt{-v}) Version string to use when setting -% version data +% \item |--quiet| (|-q|) Suppresses output from unpacking +% \item |--rerun| Run tests without unpacking/set up +% \item |--shuffle| Shuffle the order in whichs tests run +% \item |--texmfhome| Sets the location of the user tree for installing % \end{itemize} % % \begin{buildcmd}{check} @@ -378,10 +375,10 @@ % \begin{buildcmd}{check \meta{name(s)}} % Checks only the test \texttt{\meta{name(s)}.lvt}. % All engines specified by \var{checkengines} are tested unless the command -% line option \texttt{--engine} (or \texttt{-e}) has been given to limit +% line option |--engine| (or |-e|) has been given to limit % testing to a single engine. Normally testing is preceded by unpacking % source files and copying the result plus any additional support to the -% test directory: this may be skipped using the \texttt{-s} option. +% test directory: this may be skipped using the |-s| option. % \end{buildcmd} % % \begin{buildcmd}{check -p} @@ -488,7 +485,7 @@ % This command saves the output of the test to a |.tlg| file. % This file is then used in all subsequent checks against the \texttt{\meta{name}.lvt} test. % -% If the \texttt{--engine} (or \texttt{-e}) is specified (one of |pdftex|, |xetex|, or |luatex|), the saved output is stored in \texttt{\meta{name}.\meta{engine}.tlg}. This is necessary if running the test through a different engine produces a different output. +% If the |--engine| (or |-e|) is specified (one of |pdftex|, |xetex|, or |luatex|), the saved output is stored in \texttt{\meta{name}.\meta{engine}.tlg}. This is necessary if running the test through a different engine produces a different output. % A normalisation process is performed when checking to avoid common differences such as register allocation; full details are listed in section~\ref{sec:norm}. % % If the \var{recordstatus} variable is set \var{true}, additional information @@ -528,15 +525,14 @@ % Improvements to this process are planned for the future. % \end{buildcmd} % -% \begin{buildcmd}{setversion} -% Modifies the content of files specified by |versionfiles| to allow -% automatic updating of the file date and version. The latter are -% specified using the |-d| and |-v| command line options and if not -% given will default to the current date in ISO format (YYYY-MM-DD) and |-1|, -% respectively. As detailed below, the standard set up has no search pattern -% defined for this target and so no action will be taken \emph{unless} -% a version type for substitution is set up (using \var{versionform} or -% by defining a custom function). +% \begin{buildcmd}{tag} +% Modifies the content of files specified by |tagfiles| to allow +% automatic updating of the release tag and date. The tag is given as a +% command line option, whilst the optional date should be passed using +% |--date| (|-d|); if not given, the date will default to the current date in +% ISO format (YYYY-MM-DD). As detailed below, the standard set up has no search +% pattern defined for this target and so no action will be taken \emph{unless} +% tag substitution is set up. % \end{buildcmd} % % \begin{buildcmd}{unpack} @@ -560,9 +556,7 @@ % % \begin{figure}[!b] % \begin{lstlisting}[frame=single,language={[5.2]Lua},gobble = 6] -% #!/usr/bin/env texlua -% -% -- Build script for breqn +% -- Build configuration for breqn % % module = "breqn" % @@ -570,11 +564,8 @@ % excludefiles = {"*/breqn-abbr-test.pdf", % "*/eqbreaks.pdf"} % unpackopts = "-interaction=batchmode" -% -% kpse.set_program_name("kpsewhich") -% dofile(kpse.lookup("l3build.lua")) % \end{lstlisting} -% \caption{The build script for the \pkg{breqn} package.} +% \caption{The build configuration for the \pkg{breqn} package.} % \label{fig:breqn} % \end{figure} % @@ -584,8 +575,6 @@ % % \begin{figure}[p] % \begin{lstlisting}[frame=single,language={[5.2]Lua},gobble = 6] -% #!/usr/bin/env texlua -% % -- Build script for LaTeX3 "l3packages" files % % -- Identify the bundle: there is no module as this is the "driver" @@ -596,8 +585,8 @@ % % -- Load the common build code: this is the one place that a path % -- needs to be hard-coded -% dofile (maindir .. "/l3build/l3build-config.lua") -% dofile (maindir .. "/l3build/l3build.lua") +% dofile(maindir .. "/l3build/l3build-config.lua") +% dofile(maindir .. "/l3build/l3build.lua") % \end{lstlisting} % \caption{The build script for the \pkg{l3packages} bundle.} % \label{fig:bundle} @@ -605,8 +594,6 @@ % % \begin{figure}[p] % \begin{lstlisting}[frame=single,language={[5.2]Lua},gobble = 6] -% #!/usr/bin/env texlua -% % -- Build script for LaTeX3 "xparse" files % % -- Identify the bundle and module: @@ -619,32 +606,26 @@ % % -- Load the common build code: this is the one place that a path % -- needs to be hard-coded -% dofile (maindir .. "/l3build/l3build-config.lua") -% dofile (maindir .. "/l3build/l3build.lua") +% dofile(maindir .. "/l3build/l3build-config.lua") +% dofile(maindir .. "/l3build/l3build.lua") % \end{lstlisting} % \caption{The build script for the \pkg{xparse} module.} % \label{fig:module} % \end{figure} % -% \begin{figure}[p] -% \begin{lstlisting}[frame=single,gobble = 6] -% @echo off -% texlua build.lua %* -% \end{lstlisting} -% \caption{Windows batch file wrapper for running the build process.} -% \label{fig:batch} -% \end{figure} -% -% Under a Unix-like platform, you may wish to run `|chmod +x build.lua|' on these files, which allows a simpler command line use. Instead of writing\\ -% \hspace*{2\parindent}|texlua build.lua check|\\ for example, you would simply write\\ -% \hspace*{2\parindent}|./build.lua check|\\ -% instead. (Or even omit the |./| depending on your path settings.) -% Windows users can achieve a similar effect by creating a file |build.bat| as show in Figure~\ref{fig:batch}. -% % \subsection{Variables} % % This section lists all variables defined in the |l3build.lua| script that are available for customisation. % +% \subsection{Interaction between tests} +% +% Tests are run in a single directory, so whilst they are may be isolated from +% the system \TeX{} tree they do share files. This may be significant if +% installation-type files are generated during a test, for example by a +% |filecontents| environment in \LaTeX{}. Typically, you should set up your +% tests such that they do not use the same names for such files: this may lead +% to variable outcomes depending on the order in which tests are run. +% % \luavartypeset % % \subsection{Multiple sets of tests} @@ -683,10 +664,6 @@ % be used. This works in the same way as |--engine|: it takes a comma list of % configurations to apply, overriding \var{checkconfigs}. % -% Note that the setting \var{stdconfig} is used to determine the \emph{vanilla} -% configuration: this will typically be the name of the main script (usually -% |build| for a standard |build.lua| file). -% % \subsection{Dependencies} % % If you have multiple packages that are developed separately but still interact in some way, it's often desirable to integrate them when performing regression tests. @@ -760,7 +737,8 @@ % \item Removal of |./| at start of file names. % \item Standardisation of the list of units known to \TeX{} (\pdfTeX{} % and \LuaTeX{} add a small number of additional units which are not -% known to \TeX90 or \XeTeX{}). +% known to \TeX90 or \XeTeX{}, (u)p\TeX{} adds some additoonal non-standard +% ones) % \item Standardisation of \verb*|\csname\endcsname | to |\csname\endcsname| % (the former is formally correct, but the latter was produced for many % years due to a \TeX{} bug). @@ -771,6 +749,8 @@ % \texttt{\cs{\meta{type}}\meta{...}} % \item Conversion of box numbers in |\show| lines % \texttt{>~\cs{box}\meta{number}=} to \texttt{>~\cs{box}...=} +% \item Removal of some (u)p\TeX{} data where it is equivalent to +% \pdfTeX{} (|yoko direction|, |\displace 0.0|) % \end{itemize} % % \LuaTeX{} makes several additional changes to the log file. As normalising @@ -1044,7 +1024,7 @@ % % \subsection{Epoch setting} % -% To produce predictable output when suing dates, the test system offers the +% To produce predictable output when using dates, the test system offers the % ability to set the epoch to a known value. The \luavar{epoch} variable may % be given as a raw value (a simple integer) or as a date in ISO format. % The two flags \luavar{forcecheckepoch} and \luavar{forcedocepoch} then @@ -1116,58 +1096,50 @@ % % \section{Release-focussed features} % -% \subsection{Automatic version modification} +% \subsection{Automatic tagging} % -% As detailed above, the |setversion| target will automatically edit -% source files to modify date and version. This behaviour is governed by -% variable \var{versionform}. As standard, no automatic replacement -% takes place, but setting \var{versionform} will allow this to happen, -% with options +% As detailed above, the |tag| target will automatically edit +% source files to modify date and release tag. As standard, no automatic +% replacement takes place, but setting up a |updae_tag()| function +% will allow this to happen. This takes four arguments: % \begin{itemize} -% \item |ProvidesPackage| --- Searches for lines using the \LaTeXe{} -% \cs{ProvidesPackage}, \cs{ProvidesClass} and \cs{ProvidesFile} -% identifiers (as a whole line). -% \item |ProvidesExplPackage| --- Searches for lines using the \pkg{expl3} -% \cs{ProvidesExplPackage}, \cs{ProvidesExplClass} and -% \cs{ProvidesExplFile} identifiers (at the start of a line). -% \item |filename| --- Searches for lines using |\def\filename|, -% |\def\filedate|, \dots, formulation. -% \item |ExplFileDate| --- Searches for lines using |\def\ExplFileDate|, -% \dots, formulation. +% \item The file name +% \item The full content of the file +% \item The tag name +% \item The tag date % \end{itemize} -% -% For more complex cases, the programmer may directly define the -% Lua function |setversion_update_line()|, which takes as arguments the line of the -% source, the supplied date and the supplied version. It should return a -% (possibly unmodified) line and may use one, both or neither of the -% date and version to update the line. Typically, |setversion_update_line| should -% match to the exact pattern used by the programmer in the source files. -% For example, for code using macros for the date and version -% a suitable function might read as shown in Figure~\ref{fig:update-line}. +% and should return the (modified) contents for writing to disk. +% For example, the function used by |l3build| itself is +% shown in Figure~\ref{fig:update-tag}. % \begin{figure} % \begin{lstlisting}[frame=single,language={[5.2]Lua},gobble = 6] -% function setversion_update_line(line, date, version) -% -- No real regex so do it one type at a time -% for _,i in pairs({"Class", "File", "Package"}) do -% if string.match( -% line, -% "^\\Provides" .. i .. "{[a-zA-Z0-9%-]+}%[[^%]]*%]$" -% ) then -% line = string.gsub(line, "%[%d%d%d%d/%d%d/%d%d", "[" -% .. string.gsub(date, "%-", "/") -% line = string.gsub( -% line, "(%[%d%d%d%d/%d%d/%d%d) [^ ]*", "%1 " .. version -% ) -% break -% end +% -- Detail how to set the version automatically +% function update_tag(file,content,tagname,tagdate) +% if string.match(file, "%.dtx$") then +% return string.gsub(content, +% "\n%% \\date{Released %d%d%d%d/%d%d/%d%d}\n", +% "\n%% \\date{Released " .. tagname .. "}\n") +% elseif string.match(file, "%.md$") then +% return string.gsub(content, +% "\nRelease %d%d%d%d/%d%d/%d%d\n", +% "\nRelease " .. tagname .. "\n") +% elseif string.match(file, "%.lua$") then +% return string.gsub(content, +% '\nrelease_date = "%d%d%d%d/%d%d/%d%d"\n', +% '\nrelease_date = "' .. tagname .. '"\n') % end -% return line +% return contents % end % \end{lstlisting} -% \caption{Example \texttt{setversion_update_line} function.} -% \label{fig:update-line} +% \caption{Example \texttt{update_tag} function.} +% \label{fig:update-tag} % \end{figure} % +% To allow more complex tasks to take place, a hook |tag_hook()| is also +% available. It will receive the tag name and date as arguments, and +% may be used to carry out arbitrary tasks during tagging (for example, +% setting a version control tag for an entire repository). +% % \subsection{Typesetting documentation} % % As part of the overall build process, \pkg{l3build} will create PDF @@ -1252,10 +1224,10 @@ % \midrule % \var{date} & String \\ % \var{engine} & Table \\ -% \var{files} & Table \\ % \var{force} & Boolean \\ % \var{halt} & Boolean \\ % \var{help} & Boolean \\ +% \var{names} & Table \\ % \var{pdf} & Boolean \\ % \var{quiet} & Boolean \\ % \var{rerun} & Boolean \\ diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-install.lua b/Master/texmf-dist/tex/latex/l3build/l3build-install.lua deleted file mode 100644 index 5fea175d377..00000000000 --- a/Master/texmf-dist/tex/latex/l3build/l3build-install.lua +++ /dev/null @@ -1,86 +0,0 @@ ---[[ - -File l3build-install.lua Copyright (C) 2018 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 -license or (at your option) any later version. The latest version -of this license is in the file - - http://www.latex-project.org/lppl.txt - -This file is part of the "l3build bundle" (The Work in LPPL) -and all files in that bundle must be distributed together. - ------------------------------------------------------------------------ - -The development version of the bundle can be found at - - https://github.com/latex3/l3build - -for those people who are interested. - ---]] - -local pairs = pairs -local print = print - -local set_program = kpse.set_program_name -local var_value = kpse.var_value - -local function gethome() - set_program("latex") - return options["texmfhome"] or var_value("TEXMFHOME") -end - -function uninstall() - local installdir = gethome() .. "/tex/" .. moduledir - if options["dry-run"] then - print("\n" .. "Installation root: " .. installdir) - local files = filelist(installdir) - -- Deal with an empty directory - if next(files) then - print("\n" .. "Files for removal:") - for _,file in pairs(filelist(installdir)) do - print("- " .. file) - end - else - print("No files present") - end - return 0 - else - return rmdir(installdir) - end -end - --- Locally install files: only deals with those extracted, not docs etc. -function install() - local errorlevel = unpack() - if errorlevel ~= 0 then - return errorlevel - end - local installdir = gethome() .. "/tex/" .. moduledir - if options["dry-run"] then - print("\n" .. "Installation root: " .. installdir - .. "\n" .. "Installation files:" - ) - for _,filetype in pairs(installfiles) do - for _,file in pairs(filelist(unpackdir,filetype)) do - print("- " .. file) - end - end - return 0 - else - errorlevel = cleandir(installdir) - if errorlevel ~= 0 then - return errorlevel - end - for _,filetype in pairs(installfiles) do - errorlevel = cp(filetype, unpackdir, installdir) - if errorlevel ~= 0 then - return errorlevel - end - end - end - return 0 -end diff --git a/Master/texmf-dist/tex/latex/l3build/l3build-setversion.lua b/Master/texmf-dist/tex/latex/l3build/l3build-setversion.lua deleted file mode 100644 index 178bb29489a..00000000000 --- a/Master/texmf-dist/tex/latex/l3build/l3build-setversion.lua +++ /dev/null @@ -1,140 +0,0 @@ ---[[ - -File l3build-setversion.lua Copyright (C) 2018 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 -license or (at your option) any later version. The latest version -of this license is in the file - - http://www.latex-project.org/lppl.txt - -This file is part of the "l3build bundle" (The Work in LPPL) -and all files in that bundle must be distributed together. - ------------------------------------------------------------------------ - -The development version of the bundle can be found at - - https://github.com/latex3/l3build - -for those people who are interested. - ---]] - - ---[[ - L3BUILD SETVERSION - ================== ---]] - -local gsub = string.gsub -local match = string.match - --- Provide some standard search-and-replace functions -if versionform ~= "" and not setversion_update_line then - if versionform == "ProvidesPackage" then - function setversion_update_line(line, date, version) - -- No real regex so do it one type at a time - for _,i in pairs({"Class", "File", "Package"}) do - if match( - line, - "^\\Provides" .. i .. "{[a-zA-Z0-9%-%.]+}%[[^%]]*%]$" - ) then - line = gsub(line, "%[%d%d%d%d/%d%d/%d%d", "[" - .. gsub(date, "%-", "/")) - line = gsub( - line, "(%[%d%d%d%d/%d%d/%d%d) [^ ]*", "%1 " .. version - ) - break - end - end - return line - end - elseif versionform == "ProvidesExplPackage" then - function setversion_update_line(line, date, version) - -- No real regex so do it one type at a time - for _,i in pairs({"Class", "File", "Package"}) do - if match( - line, - "^\\ProvidesExpl" .. i .. " *{[a-zA-Z0-9%-%.]+}" - ) then - line = gsub( - line, - "{%d%d%d%d/%d%d/%d%d}( *){[^}]*}", - "{" .. gsub(date, "%-", "/") .. "}%1{" .. version .. "}" - ) - break - end - end - return line - end - elseif versionform == "filename" then - function setversion_update_line(line, date, version) - if match(line, "^\\def\\filedate{%d%d%d%d/%d%d/%d%d}$") then - line = "\\def\\filedate{" .. gsub(date, "%-", "/") .. "}" - end - if match(line, "^\\def\\fileversion{[^}]+}$") then - line = "\\def\\fileversion{" .. version .. "}" - end - return line - end - elseif versionform == "ExplFileDate" then - function setversion_update_line(line, date, version) - if match(line, "^\\def\\ExplFileDate{%d%d%d%d/%d%d/%d%d}$") then - line = "\\def\\ExplFileDate{" .. gsub(date, "%-", "/") .. "}" - end - if match(line, "^\\def\\ExplFileVersion{[^}]+}$") then - line = "\\def\\ExplFileVersion{" .. version .. "}" - end - return line - end - end -end - --- Used to actually carry out search-and-replace -setversion_update_line = setversion_update_line or function(line, date, version) - return line -end - -function setversion() - local function rewrite(dir, file, date, version) - local changed = false - local result = "" - for line in io.lines(dir .. "/" .. file) do - local newline = setversion_update_line(line, date, version) - if newline ~= line then - line = newline - changed = true - end - result = result .. line .. os_newline - end - if changed then - -- Avoid adding/removing end-of-file newline - local f = io.open(dir .. "/" .. file, "rb") - local content = f:read("*all") - f:close() - if not match(content, os_newline .. "$") then - gsub(result, os_newline .. "$", "") - end - -- Write the new file - ren(dir, file, file .. bakext) - local f = io.open(dir .. "/" .. file, "w") - io.output(f) - io.write(result) - f:close() - rmfile(dir, file .. bakext) - end - end - local date = options["date"] or os.date("%Y-%m-%d") - local version = options["version"] or -1 - for _,dir in pairs(remove_duplicates({currentdir, sourcefiledir, docfiledir})) do - for _,i in pairs(versionfiles) do - for file,_ in pairs(tree(dir, i)) do - rewrite(dir, file, date, version) - end - end - end - return 0 -end - diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 47da4da45c6..3b5b5e6a3c7 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1361,6 +1361,7 @@ chomp ($Build = `cd $Master/../Build/source && pwd`); 'koma-script' => '&POSTkoma_script', #'&POST_rmsymlink', 'kotex-oblivoir' => '&POSTkotex_oblivoir', 'kotex-utf' => '&POSTkotex_utf', + 'l3build' => '&POST_do_man', 'latex2e-help-texinfo' => '&POSTlatex2e_help_texinfo', 'lhcyr' => '&POSTlhcyr', 'lilyglyphs' => '&POSTlilyglyphs', @@ -2864,7 +2865,8 @@ $standardttf = '\.ttf|\.TTC'; 'glossaries' => 'makeglossaries$|makeglossaries-lite\.lua', 'installfont' => 'installfont-tl', 'jfmutil' => '\.pl', - 'kotex-utils' => '\.pl', + 'kotex-utils' => '\.pl$', + 'l3build' => 'l3build\.lua$', 'latex-git-log' => 'latex-git-log$', 'latex-papersize' => '\.py$', 'latex2man' => 'latex2man$', @@ -2962,6 +2964,7 @@ $standardttf = '\.ttf|\.TTC'; 'findhyph' => 'findhyph.1', 'fontools' => '\.1$', 'glossaries' => '\.1$', + 'l3build' => '\.1$', 'latex-git-log' => '\.1$', 'latex2man' => '\.1$', 'latexdiff' => '\.1$', diff --git a/Master/tlpkg/tlpsrc/l3build.tlpsrc b/Master/tlpkg/tlpsrc/l3build.tlpsrc index e69de29bb2d..dca338c719c 100644 --- a/Master/tlpkg/tlpsrc/l3build.tlpsrc +++ b/Master/tlpkg/tlpsrc/l3build.tlpsrc @@ -0,0 +1 @@ +binpattern f bin/${ARCH}/${PKGNAME} |