summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/data-res.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/data-res.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/data-res.lua106
1 files changed, 55 insertions, 51 deletions
diff --git a/Master/texmf-dist/tex/context/base/data-res.lua b/Master/texmf-dist/tex/context/base/data-res.lua
index 74ec53f0daa..532b6261f19 100644
--- a/Master/texmf-dist/tex/context/base/data-res.lua
+++ b/Master/texmf-dist/tex/context/base/data-res.lua
@@ -36,6 +36,7 @@ local allocate = utilities.storage.allocate
local settings_to_array = utilities.parsers.settings_to_array
local setmetatableindex = table.setmetatableindex
local luasuffixes = utilities.lua.suffixes
+local getcurrentdir = lfs.currentdir
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local trace_detail = false trackers.register("resolvers.details", function(v) trace_detail = v end)
@@ -67,7 +68,7 @@ resolvers.luacnfstate = "unknown"
--
-- resolvers.luacnfspec = '{$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}'
--
--- but instead use:
+-- but instead (for instance) use:
--
-- resolvers.luacnfspec = 'selfautoparent:{/texmf{-local,}{,/web2c}}'
--
@@ -77,16 +78,28 @@ resolvers.luacnfstate = "unknown"
--
-- texlive:
--
+-- selfautoloc:
+-- selfautoloc:/share/texmf-local/web2c
+-- selfautoloc:/share/texmf-dist/web2c
+-- selfautoloc:/share/texmf/web2c
+-- selfautoloc:/texmf-local/web2c
+-- selfautoloc:/texmf-dist/web2c
+-- selfautoloc:/texmf/web2c
-- selfautodir:
+-- selfautodir:/share/texmf-local/web2c
+-- selfautodir:/share/texmf-dist/web2c
+-- selfautodir:/share/texmf/web2c
+-- selfautodir:/texmf-local/web2c
+-- selfautodir:/texmf-dist/web2c
+-- selfautodir:/texmf/web2c
+-- selfautoparent:/../texmf-local/web2c
-- selfautoparent:
--- selfautodir:share/texmf-local/web2c
--- selfautodir:share/texmf/web2c
--- selfautodir:texmf-local/web2c
--- selfautodir:texmf/web2c
--- selfautoparent:share/texmf-local/web2c
--- selfautoparent:share/texmf/web2c
--- selfautoparent:texmf-local/web2c
--- selfautoparent:texmf/web2c
+-- selfautoparent:/share/texmf-local/web2c
+-- selfautoparent:/share/texmf-dist/web2c
+-- selfautoparent:/share/texmf/web2c
+-- selfautoparent:/texmf-local/web2c
+-- selfautoparent:/texmf-dist/web2c
+-- selfautoparent:/texmf/web2c
--
-- minimals:
--
@@ -95,40 +108,25 @@ resolvers.luacnfstate = "unknown"
-- selfautoparent:texmf-context/web2c
-- selfautoparent:texmf/web2c
--- -- Till 2013 we had this:
---
--- if environment.default_texmfcnf then
--- -- unfortunately we now have quite some overkill in the spec (not so nice on a network)
--- resolvers.luacnfspec = environment.default_texmfcnf
--- else
--- resolvers.luacnfspec = "selfautoparent:texmf{-local,-context,-dist,}/web2c"
--- -- resolvers.luacnfspec = "{selfautoloc:,selfautodir:,selfautoparent:}{,/texmf{-local,-dist,}/web2c}"
--- end
---
--- resolvers.luacnfspec = 'home:texmf/web2c;' .. resolvers.luacnfspec
---
--- -- which (as we want users to use the web2c path) be can be simplified to this:
---
--- if environment and environment.ownpath and string.find(environment.ownpath,"[\\/]texlive[\\/]") then
--- resolvers.luacnfspec = 'selfautodir:/texmf-local/web2c,selfautoparent:/texmf-local/web2c,selfautoparent:/texmf/web2c'
--- else
--- resolvers.luacnfspec = 'selfautoparent:/texmf-local/web2c,selfautoparent:/texmf/web2c'
--- end
---
--- -- But I gave up on that after the change to texmf-dist (why-oh-why), so we stick to:
-
-resolvers.luacnfspec = {
- "home:texmf/web2c",
- "selfautoparent:/texmf-local/web2c",
- "selfautoparent:/texmf-context/web2c",
- "selfautoparent:/texmf-dist/web2c",
- "selfautoparent:/texmf/web2c",
-}
-
--- not yet table, some reporters expect strings
-
-if type(resolvers.luacnfspec) == "table" then
- resolvers.luacnfspec = concat(resolvers.luacnfspec,";")
+-- This is a real mess: you don't want to know what creepy paths end up in the default
+-- configuration spec, for instance nested texmf- paths. I'd rather get away from it and
+-- specify a proper search sequence but alas ... it is not permitted in texlive and there
+-- is no way to check if we run a minimals as texmf-context is not in that spec. It's a
+-- compiled-in permutation of historics with the selfautoloc, selfautodir, selfautoparent
+-- resulting in weird combinations. So, when we eventually check the 30 something paths
+-- we also report weird ones, with weird being: (1) duplicate /texmf or (2) no /web2c in
+-- the names.
+
+if environment.default_texmfcnf then
+ resolvers.luacnfspec = "home:texmf/web2c;" .. environment.default_texmfcnf -- texlive + home: for taco etc
+else
+ resolvers.luacnfspec = concat ( {
+ "home:texmf/web2c",
+ "selfautoparent:/texmf-local/web2c",
+ "selfautoparent:/texmf-context/web2c",
+ "selfautoparent:/texmf-dist/web2c",
+ "selfautoparent:/texmf/web2c",
+ }, ";")
end
local unset_variable = "unset"
@@ -348,7 +346,6 @@ local function identify_configuration_files()
if cnfspec == "" then
cnfspec = resolvers.luacnfspec
resolvers.luacnfstate = "default"
--- resolvers.setenv("TEXMFCNF",cnfspec) -- for running texexec etc
else
resolvers.luacnfstate = "environment"
end
@@ -356,15 +353,20 @@ local function identify_configuration_files()
local cnfpaths = expandedpathfromlist(resolvers.splitpath(cnfspec))
local luacnfname = resolvers.luacnfname
for i=1,#cnfpaths do
- local filename = collapsepath(filejoin(cnfpaths[i],luacnfname))
- local realname = resolvers.resolve(filename)
+ local filepath = cnfpaths[i]
+ local filename = collapsepath(filejoin(filepath,luacnfname))
+ local realname = resolvers.resolve(filename) -- can still have "//" ... needs checking
+ -- todo: environment.skipweirdcnfpaths directive
+ if trace_locating then
+ local fullpath = gsub(resolvers.resolve(collapsepath(filepath)),"//","/")
+ local weirdpath = find(fullpath,"/texmf.+/texmf") or not find(fullpath,"/web2c")
+ report_resolving("looking for %a on %s path %a from specification %a",luacnfname,weirdpath and "weird" or "given",fullpath,filepath)
+ end
if lfs.isfile(realname) then
- specification[#specification+1] = filename
+ specification[#specification+1] = filename -- unresolved as we use it in matching, relocatable
if trace_locating then
report_resolving("found configuration file %a",realname)
end
- elseif trace_locating then
- report_resolving("unknown configuration file %a",realname)
end
end
if trace_locating then
@@ -1305,7 +1307,10 @@ end
collect_instance_files = function(filename,askedformat,allresults) -- uses nested
askedformat = askedformat or ""
- filename = collapsepath(filename)
+ filename = collapsepath(filename,".")
+
+ filename = gsub(filename,"^%./",getcurrentdir().."/") -- we will merge dir.expandname and collapse some day
+
if allresults then
-- no need for caching, only used for tracing
local filetype, wantedfiles = find_analyze(filename,askedformat)
@@ -1383,7 +1388,6 @@ end
-- -- -- end of main file search routing -- -- --
-
local function findfiles(filename,filetype,allresults)
local result, status = collect_instance_files(filename,filetype or "",allresults)
if not result or #result == 0 then