summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/l3build/l3build-ctan.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-08-28 20:36:53 +0000
committerKarl Berry <karl@freefriends.org>2021-08-28 20:36:53 +0000
commit36898810305246554a1e0e8a046879cb7c9e6db3 (patch)
tree7ca67e99234c74c5b48eea2cb29813b5b374e3bf /Master/texmf-dist/scripts/l3build/l3build-ctan.lua
parenta89cabb9a47555bb218f126342a0a986236b2a02 (diff)
l3build (28aug21)
git-svn-id: svn://tug.org/texlive/trunk@60344 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/l3build/l3build-ctan.lua')
-rw-r--r--Master/texmf-dist/scripts/l3build/l3build-ctan.lua50
1 files changed, 27 insertions, 23 deletions
diff --git a/Master/texmf-dist/scripts/l3build/l3build-ctan.lua b/Master/texmf-dist/scripts/l3build/l3build-ctan.lua
index fd1491dd584..e5b3b7e8f84 100644
--- a/Master/texmf-dist/scripts/l3build/l3build-ctan.lua
+++ b/Master/texmf-dist/scripts/l3build/l3build-ctan.lua
@@ -25,9 +25,12 @@ for those people who are interested.
local pairs = pairs
local print = print
+local attributes = lfs.attributes
local lower = string.lower
local match = string.match
+local newzip = require"l3build-zip"
+
-- Copy files to the main CTAN release directory
function copyctan()
mkdir(ctandir .. "/" .. ctanpkg)
@@ -68,33 +71,33 @@ end
function ctan()
-- Always run tests for all engines
options["engine"] = nil
- local function dirzip(dir, name)
- local zipname = name .. ".zip"
- local function tab_to_str(table)
- local string = ""
- for _,i in ipairs(table) do
- string = string .. " " .. "\"" .. i .. "\""
+ local function dirzip(dir, zipname)
+ zipname = zipname .. ".zip"
+ local zip = newzip(dir .. '/' .. zipname)
+ local function tab_to_check(table)
+ local patterns = {}
+ for n,i in ipairs(table) do
+ patterns[n] = glob_to_pattern(i)
+ end
+ return function(name)
+ for n, patt in ipairs(patterns) do
+ if name:match"([^/]*)$":match(patt) then return true end
+ end
+ return false
end
- return string
end
-- Convert the tables of files to quoted strings
- local binfiles = tab_to_str(binaryfiles)
- local exclude = tab_to_str(excludefiles)
+ local binfile = tab_to_check(binaryfiles)
+ local exclude = tab_to_check(excludefiles)
+ local exefile = tab_to_check(exefiles)
-- First, zip up all of the text files
- run(
- dir,
- zipexe .. " " .. zipopts .. " -ll ".. zipname .. " " .. "."
- .. (
- (binfiles or exclude) and (" -x" .. binfiles .. " " .. exclude)
- or ""
- )
- )
- -- Then add the binary ones
- run(
- dir,
- zipexe .. " " .. zipopts .. " -g ".. zipname .. " " .. ". -i" ..
- binfiles .. (exclude and (" -x" .. exclude) or "")
- )
+ for _, p in ipairs(tree(dir, "**")) do
+ local src = p.src:sub(3) -- Strip ./
+ if not (attributes(p.cwd, "mode") == "directory" or exclude(src) or src == zipname) then
+ zip:add(p.cwd, src, binfile(src), exefile(src))
+ end
+ end
+ return zip:close()
end
local errorlevel
local standalone = false
@@ -146,6 +149,7 @@ function ctan()
dirzip(tdsdir, ctanpkg .. ".tds")
if packtdszip then
cp(ctanpkg .. ".tds.zip", tdsdir, ctandir)
+ cp(ctanpkg .. ".tds.zip", tdsdir, currentdir)
end
dirzip(ctandir, ctanzip)
cp(ctanzip .. ".zip", ctandir, currentdir)