[latex3-commits] [git/LaTeX3-latex3-l3build] master: simplify set_epoch_cmd usage (942619c)

LAURENS Jérôme jerome.laurens at u-bourgogne.fr
Sun Feb 21 10:56:19 CET 2021


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

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

commit 942619c31b95f27552ff6a20d9d939b14fb4664d
Author: LAURENS Jérôme <jerome.laurens at u-bourgogne.fr>
Date:   Sun Feb 21 10:56:19 2021 +0100

    simplify set_epoch_cmd usage


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

942619c31b95f27552ff6a20d9d939b14fb4664d
 l3build-aux.lua         | 7 +++++--
 l3build-check.lua       | 2 +-
 l3build-typesetting.lua | 6 +++---
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/l3build-aux.lua b/l3build-aux.lua
index c474554..477c20b 100644
--- a/l3build-aux.lua
+++ b/l3build-aux.lua
@@ -60,19 +60,22 @@ function normalise_epoch(epoch)
   end
 end
 
----CLI command to set the epoch, will be run while checking or typesetting
+---Returns the CLI command (ending with `os_concat`) to set the epoch
+---when forcecheckepoch is true, a void string otherwise.
+---Will be run while checking or typesetting
 --- at param epoch string
 --- at return string
 --- at see check, typesetting
 --- at usage private?
 function set_epoch_cmd(epoch)
-  return
+  return forcecheckepoch and (
     os_setenv .. " SOURCE_DATE_EPOCH=" .. epoch
       .. os_concat ..
     os_setenv .. " SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1"
       .. os_concat ..
     os_setenv .. " FORCE_SOURCE_DATE=1"
       .. os_concat
+  ) or ""
 end
 
 ---Returns the script name depending on the calling sequence.
diff --git a/l3build-check.lua b/l3build-check.lua
index 2b8e579..fb624e7 100644
--- a/l3build-check.lua
+++ b/l3build-check.lua
@@ -764,7 +764,7 @@ function runtest(name, engine, hide, ext, pdfmode, breakout)
       -- Allow for local texmf files
       os_setenv .. " TEXMFCNF=." .. os_pathsep
         .. os_concat ..
-      (forcecheckepoch and set_epoch_cmd(epoch) or "") ..
+      set_epoch_cmd(epoch) ..
       -- Ensure lines are of a known length
       os_setenv .. " max_print_line=" .. maxprintline
         .. os_concat ..
diff --git a/l3build-typesetting.lua b/l3build-typesetting.lua
index 7701f88..0ae25a9 100644
--- a/l3build-typesetting.lua
+++ b/l3build-typesetting.lua
@@ -38,11 +38,11 @@ local os_type = os.type
 function dvitopdf(name, dir, engine, hide)
   run(
     dir,
-    (forcecheckepoch and set_epoch_cmd(epoch) or "") ..
+    set_epoch_cmd(epoch) ..
     "dvips " .. name .. dviext
       .. (hide and (" > " .. os_null) or "")
       .. os_concat ..
-   "ps2pdf " .. ps2pdfopt .. name .. psext
+    "ps2pdf " .. ps2pdfopt .. name .. psext
       .. (hide and (" > " .. os_null) or "")
   )
 end
@@ -68,7 +68,7 @@ function runcmd(cmd,dir,vars)
   for _,var in pairs(vars) do
     env = env .. os_concat .. os_setenv .. " " .. var .. "=" .. envpaths
   end
-  return run(dir,(forcedocepoch and set_epoch_cmd(epoch) or "") .. env .. os_concat .. cmd)
+  return run(dir,set_epoch_cmd(epoch) .. env .. os_concat .. cmd)
 end
 
 function biber(name,dir)





More information about the latex3-commits mailing list.