[latex3-commits] [git/LaTeX3-latex3-l3build] master: Move epoch normalisation (7229893)

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Mar 6 19:38:53 CET 2018


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

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

commit 7229893ffc75129b462274eda754c607641e576f
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Mar 6 07:22:07 2018 +0000

    Move epoch normalisation


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

7229893ffc75129b462274eda754c607641e576f
 l3build-arguments.lua |   21 ---------------------
 l3build-aux.lua       |   16 ++++++++++++++++
 l3build.lua           |   10 ++++++++++
 3 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/l3build-arguments.lua b/l3build-arguments.lua
index 261d9db..da78b6c 100644
--- a/l3build-arguments.lua
+++ b/l3build-arguments.lua
@@ -264,24 +264,3 @@ if options["engine"] and not options["force"] then
     end
   end
 end
-
--- Tidy up the epoch setting
--- Force an epoch if set at the command line
-if options["epoch"] then
-  epoch           = options["epoch"]
-  forcecheckepoch = true
-  forcedocepoch   = true
-end
--- If given as an ISO date, turn into an epoch number
-do
-  local y, m, d = string.match(epoch, "^(%d%d%d%d)-(%d%d)-(%d%d)$")
-  if y then
-    epoch =
-      os_time({year = y, month = m, day = d, hour = 0, sec = 0, isdst = nil}) -
-      os_time({year = 1970, month = 1, day = 1, hour = 0, sec = 0, isdst = nil})
-  elseif string.match(epoch, "^%d+$") then
-    epoch = tonumber(epoch)
-  else
-    epoch = 0
-  end
-end
diff --git a/l3build-aux.lua b/l3build-aux.lua
index db74664..bd46552 100644
--- a/l3build-aux.lua
+++ b/l3build-aux.lua
@@ -23,12 +23,28 @@ for those people who are interested.
 --]]
 
 local match = string.match
+
 local pairs = pairs
 local print = print
+
 --
 -- Auxiliary functions which are used by more than one main function
 --
 
+function normalise_epoch()
+  -- If given as an ISO date, turn into an epoch number
+  local y, m, d = match(epoch, "^(%d%d%d%d)-(%d%d)-(%d%d)$")
+  if y then
+    epoch =
+      os_time({year = y, month = m, day = d, hour = 0, sec = 0, isdst = nil}) -
+      os_time({year = 1970, month = 1, day = 1, hour = 0, sec = 0, isdst = nil})
+  elseif match(epoch, "^%d+$") then
+    epoch = tonumber(epoch)
+  else
+    epoch = 0
+  end
+end
+
 function setepoch()
   return
     os_setenv .. " SOURCE_DATE_EPOCH=" .. epoch
diff --git a/l3build.lua b/l3build.lua
index 845f51a..054043d 100644
--- a/l3build.lua
+++ b/l3build.lua
@@ -87,6 +87,16 @@ if match(arg[0], "l3build(%.lua)$") then
   end
 end
 
+-- Tidy up the epoch setting
+-- Force an epoch if set at the command line
+-- Must be done after loading variables, etc.
+if options["epoch"] then
+  epoch           = options["epoch"]
+  forcecheckepoch = true
+  forcedocepoch   = true
+end
+normalise_epoch()
+
 --
 -- Deal with multiple configs for tests
 --





More information about the latex3-commits mailing list