[latex3-commits] [git/l3build] master: New "flatten" variable (cdd57a7)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Jan 18 08:48:13 CET 2018


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

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

commit cdd57a70eed07a4046284841c97a7adf3e135c6d
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Thu Jan 18 07:48:13 2018 +0000

    New "flatten" variable
    
    For e.g. beamer.


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

cdd57a70eed07a4046284841c97a7adf3e135c6d
 l3build-ctan.lua      |   41 ++++++++++++++++++-----------------------
 l3build-variables.lua |    3 +++
 l3build.dtx           |    5 ++++-
 3 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/l3build-ctan.lua b/l3build-ctan.lua
index 42933f5..ed29399 100644
--- a/l3build-ctan.lua
+++ b/l3build-ctan.lua
@@ -27,32 +27,27 @@ local insert           = table.insert
 
 -- Copy files to the main CTAN release directory
 function copyctan()
-  local ctantarget = ctanpkg
-  if docfiledir ~= currentdir then
-    ctantarget = ctanpkg .. "/" .. gsub(docfiledir, "^%.*/", "")
-  end
-  mkdir(ctandir .. "/" .. ctantarget)
-  for _,filetype in pairs(
-      {
-        bibfiles,
-        demofiles,
-        docfiles,
-        pdffiles,
-        typesetlist
-      }
-    ) do
-    for _,file in pairs(filetype) do
-      cp(file, docfiledir, ctandir .. "/" .. ctantarget)
+  mkdir(ctandir .. "/" .. ctanpkg)
+  local function copyfiles(files,source)
+    if source == currentdir or flatten then
+      for _,filetype in pairs(files) do
+        cp(filetype,source,ctandir .. "/" .. ctanpkg)
+      end
+    else
+      for _,filetype in pairs(files) do
+        for _,file in pairs(tree(source,filetype)) do
+          local path,file = splitpath(file)
+          local ctantarget = ctandir .. "/" .. ctanpkg .. "/" .. path
+          mkdir(ctantarget)
+          cp(file,source,ctantarget)
+        end
+      end
     end
   end
-  ctantarget = ctanpkg
-  if sourcefiledir ~= currentdir then
-    ctantarget = ctanpkg .. "/" .. gsub(sourcefiledir, "^%.*/", "")
-  end
-  mkdir(ctandir .. "/" .. ctantarget)
-  for _,file in pairs(sourcefiles) do
-    cp(file, sourcefiledir, ctandir .. "/" .. ctantarget)
+  for _,tab in pairs({bibfiles,demofiles,docfiles,pdffiles,typesetlist}) do
+    copyfiles(tab,docfiledir)
   end
+  copyfiles(sourcefiles,sourcefiledir)
   for _,file in pairs(textfiles) do
     cp(file, currentdir, ctandir .. "/" .. ctanpkg)
   end
diff --git a/l3build-variables.lua b/l3build-variables.lua
index 7115d1f..cab92af 100644
--- a/l3build-variables.lua
+++ b/l3build-variables.lua
@@ -177,6 +177,9 @@ end
 asciiengines = asciiengines or {"pdftex"}
 checkruns    = checkruns    or 1
 epoch        = epoch        or 1463734800
+if flatten == nil then
+  flatten = true
+end  
 maxprintline = maxprintline or 79
 packtdszip   = packtdszip   or false
 scriptname   = scriptname   or "build.lua"
diff --git a/l3build.dtx b/l3build.dtx
index 6ca1656..ee7c2a0 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -147,6 +147,7 @@
 \luavarset{asciiengines}{\{"pdftex"\}}{Engines which should log as sure ASCII}
 \luavarset{checkruns}   {1}           {Number of runs to complete for a test before comparing the log}
 \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{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}
@@ -728,7 +729,9 @@
 % files in other locations using the \var{sourcefiledir} and \var{docfiledir}
 % variables. For pre-built trees, the glob syntax \texttt{**/*.\meta{ext}} may
 % be useful in these cases: this enables recursive searching in the appropriate
-% tree locations.
+% 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.
 %
 % 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