diff options
author | Norbert Preining <norbert@preining.info> | 2023-04-06 13:21:15 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-04-07 12:52:51 +0900 |
commit | a0719a65a46db59d07274a935e6961e386240bd4 (patch) | |
tree | 44f99c17b6611a3c4c18439fb63f0873b1c79bbb /Master/texmf-dist | |
parent | f306fa9f0c418b92952d1ed6fedab293e0c2bdfd (diff) |
Adjust paper size configuration for ConTeXt
- ship a file texmf-dist/tex/context/texlive/cont-sys.mkxl
that invalidates the cache based on changes to the ls-R files
- remove mtxrun/context calls from tlmgr.pl
- adjust TLPaper.pm to use context-papersize.tex
Code provided by Max Chernoff
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 11 | ||||
-rw-r--r-- | Master/texmf-dist/tex/context/texlive/cont-sys.mkxl | 46 |
2 files changed, 46 insertions, 11 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index bf7f498b6da..d0d4456bce1 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -892,17 +892,6 @@ sub handle_execute_actions { if ($::files_changed) { $errors += do_cmd_and_check("mktexlsr"); - # see comments in install-tl about lmtx. - my $lmtx = "$bindir/luametatex"; - if (defined($localtlpdb->get_package('context')) - && (-x "$lmtx" || -x "$lmtx.exe") - && TeXLive::TLUtils::system_ok("$lmtx --version") - ) { - $errors += do_cmd_and_check("mtxrun --generate"); - $errors += do_cmd_and_check("context --luatex --generate"); - } else { - debug("skipped ConTeXt cache regeneration\n"); - } $::files_changed = 0; } diff --git a/Master/texmf-dist/tex/context/texlive/cont-sys.mkxl b/Master/texmf-dist/tex/context/texlive/cont-sys.mkxl new file mode 100644 index 00000000000..73c619f41d6 --- /dev/null +++ b/Master/texmf-dist/tex/context/texlive/cont-sys.mkxl @@ -0,0 +1,46 @@ +% Update the ConTeXt filename cache if the system ls-R files are modified +\startluacode + local addsuffix = file.addsuffix + local attributes = lfs.attributes + local difftime = os.difftime + local file_join = file.join + local getfirstreadablefile = caches.getfirstreadablefile + local gethashes = resolvers.gethashes + local hashed = caches.hashed + local ipairs = ipairs + local pcall = pcall + local resolve = resolvers.resolve + local time = os.time + local totime = utilities.parsers.totime + + local stale = false + for _, tree in ipairs(gethashes()) do + local lsR_path = file_join(resolve(tree.name), "ls-R") + local lsR_time = attributes(lsR_path, "modification") + + local hash = hashed(tree.name) + local path = getfirstreadablefile(addsuffix(hash, "lua"), "trees") + + local state, blob = pcall(loadfile, path) + local hash_time + + if blob then + local data = blob() + if data then + hash_time = time(totime(data.date .. " " .. data.time)) + end + end + + if lsR_time and hash_time and difftime(lsR_time, hash_time) > 0 then + stale = true + end + end + + if stale then + resolvers.renewcache() + resolvers.load() + end +\stopluacode + +% Set the default paper size +\readsysfile{context-papersize.tex}{}{} |