[latex3-commits] [git/LaTeX3-latex3-l3build] direct-copy: Add tdsdirs (806d08c)

Marcel Fabian Krüger tex at 2krueger.de
Thu Oct 7 18:33:10 CEST 2021


Repository : https://github.com/latex3/l3build
On branch  : direct-copy
Link       : https://github.com/latex3/l3build/commit/806d08c490eeb2fc58c03a4cd23b42e141231c3c

>---------------------------------------------------------------

commit 806d08c490eeb2fc58c03a4cd23b42e141231c3c
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Thu Oct 7 18:31:01 2021 +0200

    Add tdsdirs


>---------------------------------------------------------------

806d08c490eeb2fc58c03a4cd23b42e141231c3c
 l3build-install.lua   | 38 ++++++++++++++++++++++++++++++++++++++
 l3build-variables.lua |  1 +
 2 files changed, 39 insertions(+)

diff --git a/l3build-install.lua b/l3build-install.lua
index 21257aa..8c27df5 100644
--- a/l3build-install.lua
+++ b/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
 
@@ -103,6 +104,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
 
@@ -283,6 +301,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()
diff --git a/l3build-variables.lua b/l3build-variables.lua
index 9f2b25b..3b4f586 100644
--- a/l3build-variables.lua
+++ b/l3build-variables.lua
@@ -229,6 +229,7 @@ manifestfile = manifestfile or "MANIFEST.md"
 
 -- Non-standard installation locations
 tdslocations = tdslocations or { }
+tdsdirs = tdsdirs or {}
 
 -- Upload settings
 curlexe  = curlexe  or "curl"





More information about the latex3-commits mailing list.