[latex3-commits] [git/LaTeX3-latex3-l3build] master: New flattentds variable (4e4fd36)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Sep 30 09:25:21 CEST 2019


Repository : https://github.com/latex3/l3build
On branch  : master
Link       : https://github.com/latex3/l3build/commit/4e4fd36267be5c3866b62ec276890a53c8678afa

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

commit 4e4fd36267be5c3866b62ec276890a53c8678afa
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Sep 30 08:24:59 2019 +0100

    New flattentds variable
    
    Goes with fix to #100, really, but is 'new' not 'fixed'.


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

4e4fd36267be5c3866b62ec276890a53c8678afa
 CHANGELOG.md          |  1 +
 l3build-install.lua   | 10 +++++++---
 l3build-variables.lua |  3 +++
 l3build.dtx           |  4 +++-
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 908c23b..b772856 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ this project uses date-based 'snapshot' version identifiers.
 
 ### Added
 
+- New `flattentds` variable for controlling complex TDS structures
 - Additional notes on `texmfdir`
 
 ### Fixed
diff --git a/l3build-install.lua b/l3build-install.lua
index bbe3225..77338b6 100644
--- a/l3build-install.lua
+++ b/l3build-install.lua
@@ -123,11 +123,13 @@ function install_files(target,full,dry_run)
         for file,_ in pairs(tree(source,glob)) do
           -- Just want the name
           local path,filename = splitpath(file)
+          local sourcepath = "/"
           if path == "." then
             sourcepaths[filename] = source
           else
             path = gsub(path,"^%.","")
             sourcepaths[filename] = source .. path
+            if not flattentds then sourcepath = path .. "/" end
           end
           local matched = false
           for _,location in ipairs(tdslocations) do
@@ -135,14 +137,14 @@ function install_files(target,full,dry_run)
             local pattern = glob_to_pattern(glob)
             if match(filename,pattern) then
               insert(paths,path)
-              insert(filenames,path .. "/" .. filename)
+              insert(filenames,path .. sourcepath .. filename)
               matched = true
               break
             end
           end
           if not matched then
             insert(paths,dir)
-            insert(filenames,dir .. "/" .. filename)
+            insert(filenames,dir .. sourcepath .. filename)
           end
         end
       end
@@ -162,7 +164,9 @@ function install_files(target,full,dry_run)
           print("- " .. file)
         else
           local path,file = splitpath(file)
-          errorlevel = cp(file,source,target .. "/" .. path)
+          local installpath = target .. "/" .. path
+          mkdir(installpath)
+          errorlevel = cp(file,sourcepaths[file],installpath)
           if errorlevel ~= 0 then return errorlevel end
         end
       end
diff --git a/l3build-variables.lua b/l3build-variables.lua
index 11186c0..06cfdd3 100644
--- a/l3build-variables.lua
+++ b/l3build-variables.lua
@@ -177,6 +177,9 @@ epoch        = epoch        or 1463734800
 if flatten == nil then
   flatten = true
 end
+if flattentds == nil then
+  flattentds = true
+end
 maxprintline = maxprintline or 79
 packtdszip   = packtdszip   or false
 typesetcmds  = typesetcmds  or ""
diff --git a/l3build.dtx b/l3build.dtx
index e02af5b..2beb315 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -147,6 +147,7 @@
 \luavarset{ctanzip}{ctanpkg ... "-ctan"}{Name of the zip file (without extension) created for upload to CTAN}
 \luavarset{epoch}       {1463734800}  {Epoch (Unix date) to set for test runs}
 \luavarset{flatten}     {true}        {Switch to flatten any source structure when sending to CTAN}
+\luavarset{flattentds}  {true}        {Switch to flatten any source structure when creating a TDS structure}
 \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{typesetcmds} {""}          {Instructions to be passed to \TeX{} when doing typesetting}
@@ -774,7 +775,8 @@
 % be useful in these cases: this enables recursive searching in the appropriate
 % tree locations. With the standard settings, this structure will be removed
 % when creating a CTAN release: the variable \var{flatten} may be
-% used to control this behavior.
+% used to control this behavior. The \var{flattentds} setting controls
+% the same concept for TDS creation.
 %
 % A series of example layouts and matching |build.lua| files are available from
 % \url{https://github.com/latex3/l3build/tree/master/examples}.





More information about the latex3-commits mailing list