From db2e9e6df994386a71d9cca126b55e2676eedfc3 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 3 May 2016 00:09:40 +0200 Subject: [main,tool] reintroduce lost version check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The version check was removed by accident in commit 5ce60cc98a30. This isn’t normally a problem except when people start to run the Pretest version on ancient Luatex binaries … In any case, the check must be present. While we’re at it, make the error messages consistent between the tool and a live TeX run. This can’t cover the fact that there is no (direct) means of determining the Luatex version when not running in TeX mode, so the checks still aren’t equivalent. --- src/luaotfload-tool.lua | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'src/luaotfload-tool.lua') diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 376aa39..9ffdbe6 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -7,10 +7,11 @@ -- LICENSE: GPL v2.0 ----------------------------------------------------------------------- -luaotfload = luaotfload or { } -local version = "2.7" -luaotfload.version = version -luaotfload.self = "luaotfload-tool" +luaotfload = luaotfload or { } +local version = "2.7" +luaotfload.version = version +luaotfload.min_luatex_version = { 0, 95, 0 } --- i. e. 0.95.0 +luaotfload.self = "luaotfload-tool" --[[doc-- @@ -33,16 +34,6 @@ see the luaotfload documentation for more info. Report bugs to kpse.set_program_name "luatex" ---[[doc-- - - We test for Lua 5.1 by means of capability detection to see if - we’re running an outdated Luatex. If so, we bail. - - \url{http://lua-users.org/wiki/LuaVersionCompatibility} - ---doc]]-- - - local iowrite = io.write local kpsefind_file = kpse.find_file local mathfloor = math.floor @@ -64,11 +55,14 @@ if _G.getfenv ~= nil then -- 5.1 or LJ if _G.jit ~= nil then runtime = { "jit", jit.version } else + local minimum = luaotfload.min_luatex_version runtime = { "stock", _VERSION } - print "FATAL ERROR" - print "Luaotfload requires a Luatex version >=0.76." - print "Please update your TeX distribution!" - os.exit (-1) + texio.write_nl ("term and log", + string.format ("\tFATAL ERROR\n\z + \tLuaotfload requires a Luatex version >= %d.%d.%d.\n\z + \tPlease update your TeX distribution!\n\n", + (unpack or table.unpack) (minimum))) + error "version check failed" end else -- 5.2 runtime = { "stock", _VERSION } -- cgit v1.2.3 From 664b28e1a6e6ded4240f05b329f754f0144d3f71 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 3 May 2016 08:09:36 +0200 Subject: [tool] check for version info in stats table This could become the common check eventually. --- src/luaotfload-tool.lua | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'src/luaotfload-tool.lua') diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 9ffdbe6..547796e 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -50,13 +50,23 @@ local texiowrite = texio.write local tonumber = tonumber local type = type -local runtime -if _G.getfenv ~= nil then -- 5.1 or LJ - if _G.jit ~= nil then - runtime = { "jit", jit.version } - else - local minimum = luaotfload.min_luatex_version - runtime = { "stock", _VERSION } +do + local runtime = _G.jit and { "jit" , jit.version } + or { "stock", _VERSION } + local stats = status and status.list () + local minimum = luaotfload.min_luatex_version + local actual = { 0, 0, 0 } + if stats then + local major = stats.luatex_version / 100 + local minor = stats.luatex_version % 100 + local revision = stats.luatex_revision --[[ : string ]] + local revno = tonumber (revision) + actual = { major, minor, revno or 0 } + end + + if actual [1] < minimum [1] or actual [2] < minimum [2] + or actual [3] < minimum [3] + then texio.write_nl ("term and log", string.format ("\tFATAL ERROR\n\z \tLuaotfload requires a Luatex version >= %d.%d.%d.\n\z @@ -64,8 +74,8 @@ if _G.getfenv ~= nil then -- 5.1 or LJ (unpack or table.unpack) (minimum))) error "version check failed" end -else -- 5.2 - runtime = { "stock", _VERSION } + luaotfload.runtime = runtime + luaotfload.luatex_version = actual end local C, Ct, P, S = lpeg.C, lpeg.Ct, lpeg.P, lpeg.S @@ -330,15 +340,18 @@ local version_msg = function ( ) local out = function (...) texiowrite_nl (stringformat (...)) end local uname = os.uname () local meta = fonts.names.getmetadata () - local info = status.list () + + local runtime = luaotfload.runtime + local actual = luaotfload.luatex_version + local status = config.luaotfload.status + local notes = status and status.notes or { } + out (about, luaotfload.self) out ("%s version: %q", luaotfload.self, version) - out ("Revision: %q", config.luaotfload.status.notes.revision) + out ("Revision: %q", notes.revision) out ("Lua interpreter: %s; version %q", runtime[1], runtime[2]) --[[out ("Luatex SVN revision: %d", info.luatex_svn)]] --> SVN r5624 - out ("Luatex version: %.2f.%d", - info.luatex_version / 100, - info.luatex_revision) + out ("Luatex version: %d.%d", actual [1], actual [2]) out ("Platform: type=%s name=%s", os.type, os.name) local uname_vars = tablesortedkeys (uname) @@ -350,7 +363,7 @@ local version_msg = function ( ) out("No database metadata available.") else out ("Index: version=%q created=%q modified=%q", - config.luaotfload.status.notes.revision, + meta.version or "too old", meta.created or "ages ago", meta.modified or "ages ago") end -- cgit v1.2.3 From 0ba71246a7445204a457602806f9cc80c0cbe354 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 4 May 2016 21:49:06 +0200 Subject: [tool] include release tag in --version This info is indeed valuable on top of the commit hash, thanks to @jfbu who complained about its absence. --- src/luaotfload-tool.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/luaotfload-tool.lua') diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 547796e..35dc9b3 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -348,6 +348,9 @@ local version_msg = function ( ) out (about, luaotfload.self) out ("%s version: %q", luaotfload.self, version) + if notes.description then + out ("Luaotfload: %q", notes.description) + end out ("Revision: %q", notes.revision) out ("Lua interpreter: %s; version %q", runtime[1], runtime[2]) --[[out ("Luatex SVN revision: %d", info.luatex_svn)]] --> SVN r5624 -- cgit v1.2.3