From a5164d10bd1205a645e13080d69cdb1a2cc3a155 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 14 May 2014 23:08:40 +0200 Subject: [db,tool,diagnose] eliminat static config hack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Good riddance. We’re now fully migrated to the new, dynamic configuration subsystem with respect to cache paths. --- src/luaotfload-database.lua | 57 ++++++------------------------------------ src/luaotfload-diagnostics.lua | 2 -- src/luaotfload-tool.lua | 9 +++---- 3 files changed, 11 insertions(+), 57 deletions(-) diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index d903941..5d89aab 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -133,8 +133,6 @@ names.version = 2.51 names.data = nil --- contains the loaded database names.lookups = nil --- contains the lookup cache -names.path = { index = { }, lookups = { } } - --- string -> (string * string) local make_luanames = function (path) return filereplacesuffix(path, "lua"), @@ -156,50 +154,9 @@ local set_location_precedence = function (precedence) end --[[doc-- - We use the functions in the cache.* namespace that come with the - fontloader (see luat-basics-gen). it’s safe to use for the most part - since most checks and directory creations are already done. It - uses TEXMFCACHE or TEXMFVAR as starting points. - - There is one quirk, though: ``getwritablepath()`` will always - assume that files in subdirectories of the cache tree are writable. - It gives no feedback at all if it fails to open a file in write - mode. This may cause trouble when the index or lookup cache were - created by different user. ---doc]]-- ---- XXX this belongs into the initialization file! -local initialize_env = function () - local paths = config.luaotfload.paths - local prefix = getwritablepath (paths.names_dir, "") - if not prefix then - luaotfload.error - ("Impossible to find a suitable writeable cache...") - else - prefix = lpegmatch (stripslashes, prefix) - report ("log", 0, "db", - "Root cache directory is %s.", prefix) - end + Auxiliary functions - local lookup_path = names.path.lookups - local index = names.path.index - local lookups_file = filejoin (prefix, paths.lookups_file) - local index_file = filejoin (prefix, paths.index_file) - lookup_path.lua, lookup_path.luc = make_luanames (lookups_file) - index.lua, index.luc = make_luanames (index_file) - if not caches then - caches = { } - local dummy_function = function () end - log = { report = dummy_function, - report_status = dummy_function, - report_status_start = dummy_function, - report_status_stop = dummy_function, } - end -end - - ---[[doc-- -Auxiliary functions --doc]]-- --- fontnames contain all kinds of garbage; as a precaution we @@ -522,7 +479,7 @@ local fuzzy_limit = 1 --- display closest only --- bool? -> dbobj load_names = function (dry_run) local starttime = osgettimeofday () - local foundname, data = load_lua_file (names.path.index.lua) + local foundname, data = load_lua_file (config.luaotfload.paths.index_path_lua) if data then report ("both", 2, "db", @@ -569,7 +526,7 @@ end --- unit -> unit load_lookups = function ( ) - local foundname, data = load_lua_file(names.path.lookups.lua) + local foundname, data = load_lua_file(config.luaotfload.paths.lookup_path_lua) if data then report("both", 3, "cache", "Lookup cache loaded from %s.", foundname) @@ -3250,8 +3207,8 @@ end --- unit -> bool save_lookups = function ( ) - local path = names.path.lookups - local luaname, lucname = path.lua, path.luc + local paths = config.luaotfload.paths + local luaname, lucname = paths.lookup_path_lua, paths.lookup_path_luc if fileiswritable (luaname) and fileiswritable (lucname) then tabletofile (luaname, lookup_cache, true) osremove (lucname) @@ -3285,8 +3242,8 @@ save_names = function (currentnames) elseif currentnames.meta and currentnames.meta["local"] then return false, "table contains local entries" end - local path = names.path.index - local luaname, lucname = path.lua, path.luc + local paths = config.luaotfload.paths + local luaname, lucname = paths.index_path_lua, paths.index_path_luc if fileiswritable (luaname) and fileiswritable (lucname) then osremove (lucname) local gzname = luaname .. ".gz" diff --git a/src/luaotfload-diagnostics.lua b/src/luaotfload-diagnostics.lua index 1293122..d9b13f5 100644 --- a/src/luaotfload-diagnostics.lua +++ b/src/luaotfload-diagnostics.lua @@ -240,8 +240,6 @@ local check_conformance = function (spec, permissions, errcnt) return errcnt end -local path = names.path - local desired_permissions local init_desired_permissions = function () inspect(config.luaotfload.paths) diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index d2b6800..fe6057c 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -250,10 +250,10 @@ Enter 'luaotfload-tool --help' for a larger list of options. local help_msg = function (version) local template = help_messages[version] - local pathdata = names.path - local names_plain = pathdata.index.lua + local paths = config.luaotfload.paths + local names_plain = paths.index_path_lua local names_gzip = names_plain .. ".gz" - local names_bin = pathdata.index.luc + local names_bin = paths.index_path_luc iowrite(stringformat(template, luaotfload.self, @@ -274,7 +274,7 @@ local version_msg = function ( ) local uname = os.uname () out (about, luaotfload.self) out ("%s version %q", luaotfload.self, version) - out ("revision %q", luaotfloadstatus.notes.revision) + out ("revision %q", config.luaotfload.status.notes.revision) out ("database version %q", names.version) out ("Lua interpreter: %s; version %q", runtime[1], runtime[2]) out ("Luatex SVN revision %d", status.luatex_svn) @@ -766,7 +766,6 @@ actions.config = function (job) if not config.actions.reconfigure () then return false, false end - names.initialize_env () return true, true end -- cgit v1.2.3