summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3build/l3build-install.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-12-10 03:01:42 +0000
committerNorbert Preining <norbert@preining.info>2021-12-10 03:01:42 +0000
commite8ddf481fa0d453faba1a05623b2d4cba9b6404e (patch)
treedb96e35cfa187f7ab90ec266a63b577db8a5095d /macros/latex/contrib/l3build/l3build-install.lua
parent48aad54f9d8faf7776248c653b2a7da9bb2ffa95 (diff)
CTAN sync 202112100301
Diffstat (limited to 'macros/latex/contrib/l3build/l3build-install.lua')
-rw-r--r--macros/latex/contrib/l3build/l3build-install.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/macros/latex/contrib/l3build/l3build-install.lua b/macros/latex/contrib/l3build/l3build-install.lua
index 78fe2d4b2f..6a28463e65 100644
--- a/macros/latex/contrib/l3build/l3build-install.lua
+++ b/macros/latex/contrib/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()