texlive[66777] trunk: texfindpkg (5apr23)

commits+karl at tug.org commits+karl at tug.org
Wed Apr 5 22:09:08 CEST 2023


Revision: 66777
          http://tug.org/svn/texlive?view=revision&revision=66777
Author:   karl
Date:     2023-04-05 22:09:08 +0200 (Wed, 05 Apr 2023)
Log Message:
-----------
texfindpkg (5apr23)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/Makefile.am
    trunk/Build/source/texk/texlive/linked_scripts/Makefile.in
    trunk/Build/source/texk/texlive/linked_scripts/scripts.lst
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/libexec/ctan2tds
    trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc

Added Paths:
-----------
    trunk/Build/source/texk/texlive/linked_scripts/texfindpkg/
    trunk/Build/source/texk/texlive/linked_scripts/texfindpkg/texfindpkg.lua
    trunk/Master/bin/aarch64-linux/texfindpkg
    trunk/Master/bin/amd64-freebsd/texfindpkg
    trunk/Master/bin/amd64-netbsd/texfindpkg
    trunk/Master/bin/armhf-linux/texfindpkg
    trunk/Master/bin/i386-freebsd/texfindpkg
    trunk/Master/bin/i386-linux/texfindpkg
    trunk/Master/bin/i386-netbsd/texfindpkg
    trunk/Master/bin/i386-solaris/texfindpkg
    trunk/Master/bin/universal-darwin/texfindpkg
    trunk/Master/bin/windows/texfindpkg.exe
    trunk/Master/bin/x86_64-cygwin/texfindpkg
    trunk/Master/bin/x86_64-darwinlegacy/texfindpkg
    trunk/Master/bin/x86_64-linux/texfindpkg
    trunk/Master/bin/x86_64-linuxmusl/texfindpkg
    trunk/Master/bin/x86_64-solaris/texfindpkg
    trunk/Master/texmf-dist/doc/man/man1/texfindpkg.1
    trunk/Master/texmf-dist/doc/man/man1/texfindpkg.man1.pdf
    trunk/Master/texmf-dist/doc/support/texfindpkg/
    trunk/Master/texmf-dist/doc/support/texfindpkg/README.md
    trunk/Master/texmf-dist/scripts/texfindpkg/
    trunk/Master/texmf-dist/scripts/texfindpkg/texfindpkg.lua
    trunk/Master/texmf-dist/tex/latex/texfindpkg/
    trunk/Master/texmf-dist/tex/latex/texfindpkg/texfindpkg.json.gz
    trunk/Master/tlpkg/tlpsrc/texfindpkg.tlpsrc

Modified: trunk/Build/source/texk/texlive/linked_scripts/Makefile.am
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/Makefile.am	2023-04-05 20:03:20 UTC (rev 66776)
+++ trunk/Build/source/texk/texlive/linked_scripts/Makefile.am	2023-04-05 20:09:08 UTC (rev 66777)
@@ -221,6 +221,7 @@
 	texdef/texdef.pl \
 	texdiff/texdiff \
 	texdirflatten/texdirflatten \
+	texfindpkg/texfindpkg.lua \
 	texdoc/texdoc.tlu \
 	texfot/texfot.pl \
 	texlive/fmtutil-sys.sh \

Modified: trunk/Build/source/texk/texlive/linked_scripts/Makefile.in
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/Makefile.in	2023-04-05 20:03:20 UTC (rev 66776)
+++ trunk/Build/source/texk/texlive/linked_scripts/Makefile.in	2023-04-05 20:09:08 UTC (rev 66777)
@@ -437,6 +437,7 @@
 	texdef/texdef.pl \
 	texdiff/texdiff \
 	texdirflatten/texdirflatten \
+	texfindpkg/texfindpkg.lua \
 	texdoc/texdoc.tlu \
 	texfot/texfot.pl \
 	texlive/fmtutil-sys.sh \

Modified: trunk/Build/source/texk/texlive/linked_scripts/scripts.lst
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/scripts.lst	2023-04-05 20:03:20 UTC (rev 66776)
+++ trunk/Build/source/texk/texlive/linked_scripts/scripts.lst	2023-04-05 20:09:08 UTC (rev 66777)
@@ -163,6 +163,7 @@
 texdef/texdef.pl
 texdiff/texdiff
 texdirflatten/texdirflatten
+texfindpkg/texfindpkg.lua
 texdoc/texdoc.tlu
 texfot/texfot.pl
 texlive/fmtutil-sys.sh

Added: trunk/Build/source/texk/texlive/linked_scripts/texfindpkg/texfindpkg.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texfindpkg/texfindpkg.lua	                        (rev 0)
+++ trunk/Build/source/texk/texlive/linked_scripts/texfindpkg/texfindpkg.lua	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1,522 @@
+#!/usr/bin/env texlua
+
+-- Description: Install TeX packages and their dependencies
+-- Copyright: 2023 (c) Jianrui Lyu <tolvjr at 163.com>
+-- Repository: https://github.com/lvjr/texfindpkg
+-- License: GNU General Public License v3.0
+
+local tfpversion = "2023D"
+local tfpdate = "2023-04-05"
+
+------------------------------------------------------------
+--> \section{Some variables and functions}
+------------------------------------------------------------
+
+local lfs = require("lfs")
+local insert = table.insert
+local match = string.match
+
+local lookup = kpse.lookup
+kpse.set_program_name("kpsewhich")
+
+require(lookup("lualibs.lua"))
+local json = utilities.json -- for json.tostring and json.tolua
+local gzip = gzip           -- for gzip.compress and gzip.decompress
+
+local function tfpPrint(msg)
+  print("[tfp] " .. msg)
+end
+
+local showdbg = false
+
+local function dbgPrint(msg)
+  if showdbg then print("[debug] " .. msg) end
+end
+
+local function valueExists(tab, val)
+  for _, v in ipairs(tab) do
+    if v == val then return true end
+  end
+  return false
+end
+
+local function getFiles(path, pattern)
+  local files = { }
+  for entry in lfs.dir(path) do
+    if match(entry, pattern) then
+     insert(files, entry)
+    end
+  end
+  return files
+end
+
+local function fileRead(input)
+  local f = io.open(input, "rb")
+  local text
+  if f then -- file exists and is readable
+    text = f:read("*all")
+    f:close()
+    --print(#text)
+    return text
+  end
+  -- return nil if file doesn't exists or isn't readable
+end
+
+local function fileWrite(text, output)
+  -- using "wb" keeps unix eol characters
+  f = io.open(output, "wb")
+  f:write(text)
+  f:close()
+end
+
+local function testDistribution()
+  -- texlive returns "texmf-dist/web2c/updmap.cfg"
+  -- miktex returns nil although there is "texmfs/install/miktex/config/updmap.cfg"
+  local d = lookup("updmap.cfg")
+  if d then
+    return "texlive"
+  else
+    return "miktex"
+  end
+end
+
+------------------------------------------------------------
+--> \section{Handle TeX Live package database}
+------------------------------------------------------------
+
+local tlpkgtext
+
+local function tlReadPackageDB()
+  local tlroot = kpse.var_value("TEXMFROOT")
+  if tlroot then
+    tlroot = tlroot .. "/tlpkg"
+  else
+    tfpPrint("error in finding texmf root!")
+  end
+  local list = getFiles(tlroot, "^texlive%.tlpdb%.main")
+  if #list > 0 then
+    tlpkgtext = fileRead(tlroot .. "/" .. list[1])
+    if not tlpkgtext then
+      tfpPrint("error in reading texlive package database!")
+    end
+  else
+    -- no texlive.tlpdb.main file in a fresh TeX live
+    tfpPrint("error in finding texlive package database!")
+    tfpPrint("please run 'tlmgr update --self' first.")
+  end
+end
+
+local tlpkgdata = {}
+
+local function tlExtractFiles(name, desc)
+  -- ignore binary packages
+  -- also ignore latex-dev packages
+  if name:find("%.") or name:find("^latex%-[%a]-%-dev") then
+    --print(name)
+    return
+  end
+  -- ignore package files in doc folder
+  desc = desc:match("\nrunfiles .+") or ""
+  for base, ext in desc:gmatch("/([%a%d%-]+)%.([%a%d]+)\n") do
+    if ext == "sty" or ext == "cls" then
+      dbgPrint(name, base .. "." .. ext)
+      tlpkgdata[base .. "." .. ext] = name
+    end
+  end
+end
+
+local function tlParsePackageDB()
+  tlpkgtext:gsub("name (.-)\n(.-)\n\n", tlExtractFiles)
+end
+
+------------------------------------------------------------
+--> \section{Handle MiKTeX package database}
+------------------------------------------------------------
+
+local mtpkgtext
+
+local function mtReadPackageDB()
+  local mtvar = kpse.var_value("TEXMFVAR")
+  if mtvar then
+    mtpdb = mtvar .. "/miktex/cache/packages/miktex-zzdb3-2.9/package-manifests.ini"
+  else
+    tfpPrint("error in finding texmf root!")
+  end
+  mtpkgtext = fileRead(mtpdb)
+  if not mtpkgtext then
+    tfpPrint("error in reading miktex package database!")
+  end
+end
+
+local mtpkgdata = {}
+
+local function mtExtractFiles(name, desc)
+  -- ignore package files in source or doc folders
+  -- also ignore latex-dev packages
+  if name:find("_") or name:find("^latex%-[%a]-%-dev") then
+    --print(name)
+    return
+  end
+  for base, ext in desc:gmatch("/([%a%d%-]+)%.([%a%d]+)\r?\n") do
+    if ext == "sty" or ext == "cls" then
+      dbgPrint(name, base .. "." .. ext)
+      mtpkgdata[base .. "." .. ext] = name
+    end
+  end
+end
+
+local function mtParsePackageDB()
+  -- package-manifests.ini might use different eol characters
+  mtpkgtext:gsub("%[(.-)%]\r?\n(.-)\r?\n\r?\n", mtExtractFiles)
+end
+
+------------------------------------------------------------
+--> \section{Compare TeX Live and MiKTeX packages}
+------------------------------------------------------------
+
+local tlpkgname = "download/texlive.tlpdb"
+local mtpkgname = "download/package-manifests.ini"
+
+local function compareDistributions()
+  tlpkgtext = fileRead(tlpkgname)
+  if tlpkgtext then
+    tlParsePackageDB()
+  else
+    tfpPrint("error in reading texlive package database!")
+  end
+  mtpkgtext = fileRead(mtpkgname)
+  if mtpkgtext then
+    mtParsePackageDB()
+  else
+    tfpPrint("error in reading miktex package database!")
+  end
+  local tlmissing, mkmissing = {}, {}
+  for k, vt in pairs(tlpkgdata) do
+    local vm = mtpkgdata[k] -- or "[none]"
+    if vm then
+      mtpkgdata[k] = nil -- remove it
+      if vm ~= vt then
+        print("texlive->" .. vt, "miktex->" .. vm, k)
+      end
+    else
+      insert(mkmissing, {vt, k})
+    end
+  end
+  for k, v in pairs(mtpkgdata) do
+    print("texlive doesn't include " .. v .. " -> " .. k)
+  end
+  for _, v in ipairs(mkmissing) do
+    print("miktex doesn't include " .. v[1] .. " -> " .. v[2])
+  end
+end
+
+------------------------------------------------------------
+--> \section{Generate json file from cwl files}
+------------------------------------------------------------
+
+local function insertNewValue(tbl, val)
+  if not valueExists(tbl, val) then
+    insert(tbl, val)
+  end
+end
+
+local function extractFileData(cwl)
+  -- the cwl files have different eol characters
+  local deps = {}
+  for d in cwl:gmatch("\n#include:(.-)[\r\n]") do
+    --dbgPrint(d)
+    n = d:match("^class-(.+)$")
+    if n then
+      insertNewValue(deps, n .. ".cls")
+    else
+      insertNewValue(deps, d .. ".sty")
+    end
+  end
+  local envs = {}
+  for b, e in cwl:gmatch("\n\\begin{(.-)}.-\n\\end{(.-)}") do
+    if b == e then
+      --dbgPrint("{" .. e .. "}")
+      insert(envs, e)
+    end
+  end
+  local cmds = {}
+  for c in cwl:gmatch("\n\\(%a+)") do
+    if c ~= "begin" and c ~= "end" then
+      --dbgPrint("\\" .. c)
+      if not valueExists(cmds, c) then
+        insert(cmds, c)
+      end
+    end
+  end
+  --return {deps, envs, cmds}
+  return {deps = deps, envs = envs, cmds = cmds}
+end
+
+local function writeJson(cwldata)
+  tfpPrint("writing json database to file...")
+  local tbl1 = {}
+  for k, v in pairs(cwldata) do
+    table.insert(tbl1, {k, v})
+  end
+  table.sort(tbl1, function(a, b)
+    if a[1] < b[1] then return true end
+  end)
+  local tbl2 = {}
+  for _, v in ipairs(tbl1) do
+    local item = '"' .. v[1] .. '":' .. json.tostring(v[2])
+    table.insert(tbl2, item)
+  end
+  local text = "{\n" .. table.concat(tbl2, "\n,\n") .. "\n}"
+  fileWrite(text, "texfindpkg.json")
+  fileWrite(gzip.compress(text), "texfindpkg.json.gz")
+end
+
+local cwlpath = "completion"
+
+local function generateJsonData()
+  local list = getFiles(cwlpath, "%.cwl$")
+  local fname
+  local cwldata = {}
+  for _, v in ipairs(list) do
+    local a, b = match(v, "^([^%-]-)%-(.+)%.cwl")
+    if a == "class" then
+      fname = b .. ".cls"
+    else
+      b = match(v, "^(.+)%.cwl")
+      fname = b .. ".sty"
+    end
+    --print(fname)
+    local cwl = fileRead(cwlpath .. "/" .. v)
+    --print(cwl)
+    if cwl then
+      local item = extractFileData(cwl)
+      dbgPrint(item)
+      cwldata[fname] = item
+    else
+      tfpPrint("error in reading " .. v)
+    end
+  end
+  writeJson(cwldata)
+end
+
+------------------------------------------------------------
+--> \section{Install packages in current TeX distribution}
+------------------------------------------------------------
+
+local dist -- name of current tex distribution
+
+local function initPackageDB()
+  dist = testDistribution()
+  tfpPrint("you are using " .. dist)
+  if dist == "texlive" then
+    tlReadPackageDB()
+    tlParsePackageDB()
+  else
+    mtReadPackageDB()
+    mtParsePackageDB()
+  end
+end
+
+local function findOnePackage(fname)
+  if dist == "texlive" then
+    return tlpkgdata[fname]
+  else
+    return mtpkgdata[fname]
+  end
+end
+
+local function tfpExecute(c)
+  if os.type == "windows" then
+    os.execute(c)
+  else
+    os.execute('sudo env "PATH=$PATH" ' .. c)
+  end
+end
+
+local function installSomePackages(list)
+  if not list then return end
+  if dist == "texlive" then
+    local p = table.concat(list, " ")
+    tfpPrint("installing package " .. p)
+    tfpExecute("tlmgr install " .. p)
+  else
+    for _, p in ipairs(list) do
+      tfpPrint("installing package " .. p)
+      tfpExecute("miktex packages install " .. p)
+    end
+  end
+end
+
+local function listSomePackages(list)
+  if not list then return end
+  local p = table.concat(list, " ")
+  tfpPrint("please install " .. dist .. " package " .. p)
+end
+
+------------------------------------------------------------
+--> \section{Find dependencies of package files}
+------------------------------------------------------------
+
+local tfptext = ""  -- the json text
+local tfpdata = {}  -- the lua object
+local fnlist = {}  -- file name list
+
+local function initDependencyDB()
+  local ziptext = fileRead(lookup("texfindpkg.json.gz"))
+  tfptext = gzip.decompress(ziptext)
+  if tfptext then
+    --print(tfptext)
+    tfpdata = json.tolua(tfptext)
+  else
+    tfpPrint("error in reading texfindpkg.json.gz!")
+  end
+end
+
+local function findDependencies(fname)
+  --print(fname)
+  if valueExists(fnlist, fname) then return end
+  local item = tfpdata[fname]
+  if not item then
+    tfpPrint("no dependency info for " .. fname)
+    return
+  end
+  tfpPrint("finding dependencies for " .. fname)
+  table.insert(fnlist, fname)
+  local deps = item.deps
+  if deps then
+    for _, dname in ipairs(deps) do
+      findDependencies(dname)
+    end
+  end
+end
+
+local function queryByFileName(fname)
+  fnlist = {} -- reset the list
+  findDependencies(fname)
+  if #fnlist == 0 then
+    tfpPrint("could not find any package with file " .. fname)
+    return
+  end
+  local pkglist = {}
+  for _, fn in ipairs(fnlist) do
+    local pkg = findOnePackage(fn)
+    --print(fn, pkg)
+    if pkg then
+      table.insert(pkglist, pkg)
+    end
+  end
+  if not pkglist then
+    tfpPrint("error in finding package in " .. dist)
+    return
+  end
+  return pkglist
+end
+
+local function getFileNameFromCmdEnvName(cmdenv, name)
+  --print(name)
+  for line in tfptext:gmatch("(.-)\n[,}]") do
+    if line:find('"' .. name .. '"') then
+      --print(line)
+      local fname, fspec = line:match('"(.-)":(.+)')
+      --print(fname, fspec)
+      local item = json.tolua(fspec)
+      if valueExists(item[cmdenv], name) then
+        tfpPrint("found package file " .. fname)
+        return fname
+      end
+    end
+  end
+end
+
+local function queryByCommandName(cname)
+  --print(cname)
+  local fname = getFileNameFromCmdEnvName("cmds", cname)
+  if fname then
+    return queryByFileName(fname)
+  else
+    tfpPrint("could not find any package with command \\" .. cname)
+  end
+end
+
+local function queryByEnvironmentName(ename)
+  --print(ename)
+  local fname = getFileNameFromCmdEnvName("envs", ename)
+  if fname then
+    return queryByFileName(fname)
+  else
+    tfpPrint("could not find any package with environment {" .. ename .. "}")
+  end
+end
+
+local function query(name)
+  local h = name:sub(1,1)
+  if h == "\\" then
+    local b = name:sub(2)
+    return queryByCommandName(b)
+  elseif h == "{" then
+    if name:sub(-1) == "}" then
+      local b = name:sub(2,-2)
+      return queryByEnvironmentName(b)
+    else
+      tfpPrint("invalid input " .. name)
+    end
+  else
+    return queryByFileName(name)
+  end
+end
+
+local function install(name)
+  local list = query(name)
+  installSomePackages(list)
+end
+
+------------------------------------------------------------
+--> \section{Respond to user input}
+------------------------------------------------------------
+
+local helptext = [[
+usage: texfindpkg <action> [<options>] [<name>]
+
+Valid actions are:
+   install      Install some package and its dependencies
+   query        Query dependencies for some package
+
+Valid options are:
+   --help       Print this message and exit
+   --version    Print version information and exit
+]]
+
+local function main()
+  if arg[1] == nil then
+    print(helptext)
+  elseif arg[1] == "--help" then
+    print(helptext)
+  elseif arg[1] == "--version" then
+    print("TeXFindPkg Version " .. tfpversion .. " (" .. tfpdate .. ")\n")
+  elseif arg[1] == "install" then
+    if arg[2] then
+      initPackageDB()
+      initDependencyDB()
+      install(arg[2])
+    else
+      tfpPrint("missing the name of file/cmd/env!")
+    end
+  elseif arg[1] == "query" then
+    if arg[2] then
+      initPackageDB()
+      initDependencyDB()
+      local list = query(arg[2])
+      listSomePackages(list)
+    else
+      tfpPrint("missing the name of file/cmd/env!")
+    end
+  elseif arg[1] == "generate" then
+    generateJsonData()
+  elseif arg[1] == "compare" then
+    compareDistributions()
+  else
+    tfpPrint("unknown option " .. arg[1])
+  end
+end
+
+main()


Property changes on: trunk/Build/source/texk/texlive/linked_scripts/texfindpkg/texfindpkg.lua
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/aarch64-linux/texfindpkg
===================================================================
--- trunk/Master/bin/aarch64-linux/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/aarch64-linux/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/aarch64-linux/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/amd64-freebsd/texfindpkg
===================================================================
--- trunk/Master/bin/amd64-freebsd/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/amd64-freebsd/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/amd64-freebsd/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/amd64-netbsd/texfindpkg
===================================================================
--- trunk/Master/bin/amd64-netbsd/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/amd64-netbsd/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/amd64-netbsd/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/armhf-linux/texfindpkg
===================================================================
--- trunk/Master/bin/armhf-linux/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/armhf-linux/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/armhf-linux/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-freebsd/texfindpkg
===================================================================
--- trunk/Master/bin/i386-freebsd/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/i386-freebsd/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-freebsd/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-linux/texfindpkg
===================================================================
--- trunk/Master/bin/i386-linux/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/i386-linux/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-linux/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-netbsd/texfindpkg
===================================================================
--- trunk/Master/bin/i386-netbsd/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/i386-netbsd/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-netbsd/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/i386-solaris/texfindpkg
===================================================================
--- trunk/Master/bin/i386-solaris/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/i386-solaris/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/i386-solaris/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/universal-darwin/texfindpkg
===================================================================
--- trunk/Master/bin/universal-darwin/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/universal-darwin/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/universal-darwin/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/windows/texfindpkg.exe
===================================================================
(Binary files differ)

Index: trunk/Master/bin/windows/texfindpkg.exe
===================================================================
--- trunk/Master/bin/windows/texfindpkg.exe	2023-04-05 20:03:20 UTC (rev 66776)
+++ trunk/Master/bin/windows/texfindpkg.exe	2023-04-05 20:09:08 UTC (rev 66777)

Property changes on: trunk/Master/bin/windows/texfindpkg.exe
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/bin/x86_64-cygwin/texfindpkg
===================================================================
--- trunk/Master/bin/x86_64-cygwin/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/x86_64-cygwin/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-cygwin/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-darwinlegacy/texfindpkg
===================================================================
--- trunk/Master/bin/x86_64-darwinlegacy/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/x86_64-darwinlegacy/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-darwinlegacy/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-linux/texfindpkg
===================================================================
--- trunk/Master/bin/x86_64-linux/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/x86_64-linux/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-linux/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-linuxmusl/texfindpkg
===================================================================
--- trunk/Master/bin/x86_64-linuxmusl/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/x86_64-linuxmusl/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-linuxmusl/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/bin/x86_64-solaris/texfindpkg
===================================================================
--- trunk/Master/bin/x86_64-solaris/texfindpkg	                        (rev 0)
+++ trunk/Master/bin/x86_64-solaris/texfindpkg	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+link ../../texmf-dist/scripts/texfindpkg/texfindpkg.lua
\ No newline at end of file


Property changes on: trunk/Master/bin/x86_64-solaris/texfindpkg
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/man/man1/texfindpkg.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/texfindpkg.1	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/man/man1/texfindpkg.1	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1,26 @@
+.TH texfindpkg 1 "2023-04-05" "2023D"
+.SH NAME
+TexFindPkg \- Install TeX packages and their dependencies
+.SH SYNOPSIS
+texfindpkg <action> [<options>] [<name>]
+.SH DESCRIPTION
+TeXFindPkg makes it easy to install TeX packages and their dependencies
+by file names, command names or environment names.
+.PP
+The most commonly used TeXFindPkg actions are:
+.IP install
+Install some package and its dependencies
+.IP query
+Query dependencies for some package
+.SH OPTIONS
+Various options apply
+.IP --help
+Print a help message and exit
+.IP --version
+Print version information and exit
+.SH BUGS
+.SH AUTHOR
+Jianrui Lyu <tolvjr at 163.com>
+.PP
+Please log issues on the GitHub homepage:
+https://github.com/lvjr/texfindpkg/issues.


Property changes on: trunk/Master/texmf-dist/doc/man/man1/texfindpkg.1
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/man/man1/texfindpkg.man1.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/man/man1/texfindpkg.man1.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/texfindpkg.man1.pdf	2023-04-05 20:03:20 UTC (rev 66776)
+++ trunk/Master/texmf-dist/doc/man/man1/texfindpkg.man1.pdf	2023-04-05 20:09:08 UTC (rev 66777)

Property changes on: trunk/Master/texmf-dist/doc/man/man1/texfindpkg.man1.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/support/texfindpkg/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/texfindpkg/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/support/texfindpkg/README.md	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1,58 @@
+# TeXFindPkg tool for installing TeX packages
+
+```
+Description: Install TeX packages and their dependencies
+Copyright: 2023 (c) Jianrui Lyu <tolvjr at 163.com>
+Repository: https://github.com/lvjr/texfindpkg
+License: GNU General Public License v3.0
+```
+
+## Introduction
+
+TeXFindPkg makes it easy to install TeX packages and their dependencies by file names, command names or environment names.
+
+- To install a package by its file name you can run `texfindpkg install array.sty`;
+- To install a package by some command name you can run `texfindpkg install \fakeverb`;
+- To install a package by some environment name you can run `texfindpkg install {frame}`.
+
+TeXFindPkg supports both TeXLive and MiKTeX distributions. At present it focuses mainly on LaTeX packages,
+but may extend to ConTeXt packages if anyone would like to contribute.
+
+## Installation
+
+Your TeX distribution should have created a binary file `texfindpkg` when you install this package.
+If not, you could create a symbolic link from `/usr/local/bin/texfindpkg` to `texfindpkg.lua` on Linux or MacOS,
+or create a batch file `texfindpkg.bat` in binary folder of the TeX distribution with these lines on Windows:
+
+```
+ at echo off
+texlua path\to\texfindpkg.lua %*
+```
+
+## Usage
+
+```
+texfindpkg <action> [<options>] [<name>]
+```
+
+where `<action>` could be `install` or `query`, and `<name>` could be file name, command name or environment name.
+For example:
+
+```
+texfindpkg install array.sty
+texfindpkg install \fakeverb
+texfindpkg install {frame}
+texfindpkg query array.sty
+texfindpkg query \fakeverb
+texfindpkg query {frame}
+```
+
+## Building
+
+TeXFindPkg uses completion files of TeXstudio editor which are in `completion` folder of TeXstudio [repository](https://github.com/texstudio-org/texstudio).
+
+After putting `completion` folder into current folder, you can run `texlua texfindpkg.lua generate` to generate `texfindpkg.json` and `texfindpkg.json.gz` files.
+
+## Contributing
+
+Any updates of dependencies, commands or environments for packages should be contributed directly to TeXstudio project.


Property changes on: trunk/Master/texmf-dist/doc/support/texfindpkg/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/scripts/texfindpkg/texfindpkg.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/texfindpkg/texfindpkg.lua	                        (rev 0)
+++ trunk/Master/texmf-dist/scripts/texfindpkg/texfindpkg.lua	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1,522 @@
+#!/usr/bin/env texlua
+
+-- Description: Install TeX packages and their dependencies
+-- Copyright: 2023 (c) Jianrui Lyu <tolvjr at 163.com>
+-- Repository: https://github.com/lvjr/texfindpkg
+-- License: GNU General Public License v3.0
+
+local tfpversion = "2023D"
+local tfpdate = "2023-04-05"
+
+------------------------------------------------------------
+--> \section{Some variables and functions}
+------------------------------------------------------------
+
+local lfs = require("lfs")
+local insert = table.insert
+local match = string.match
+
+local lookup = kpse.lookup
+kpse.set_program_name("kpsewhich")
+
+require(lookup("lualibs.lua"))
+local json = utilities.json -- for json.tostring and json.tolua
+local gzip = gzip           -- for gzip.compress and gzip.decompress
+
+local function tfpPrint(msg)
+  print("[tfp] " .. msg)
+end
+
+local showdbg = false
+
+local function dbgPrint(msg)
+  if showdbg then print("[debug] " .. msg) end
+end
+
+local function valueExists(tab, val)
+  for _, v in ipairs(tab) do
+    if v == val then return true end
+  end
+  return false
+end
+
+local function getFiles(path, pattern)
+  local files = { }
+  for entry in lfs.dir(path) do
+    if match(entry, pattern) then
+     insert(files, entry)
+    end
+  end
+  return files
+end
+
+local function fileRead(input)
+  local f = io.open(input, "rb")
+  local text
+  if f then -- file exists and is readable
+    text = f:read("*all")
+    f:close()
+    --print(#text)
+    return text
+  end
+  -- return nil if file doesn't exists or isn't readable
+end
+
+local function fileWrite(text, output)
+  -- using "wb" keeps unix eol characters
+  f = io.open(output, "wb")
+  f:write(text)
+  f:close()
+end
+
+local function testDistribution()
+  -- texlive returns "texmf-dist/web2c/updmap.cfg"
+  -- miktex returns nil although there is "texmfs/install/miktex/config/updmap.cfg"
+  local d = lookup("updmap.cfg")
+  if d then
+    return "texlive"
+  else
+    return "miktex"
+  end
+end
+
+------------------------------------------------------------
+--> \section{Handle TeX Live package database}
+------------------------------------------------------------
+
+local tlpkgtext
+
+local function tlReadPackageDB()
+  local tlroot = kpse.var_value("TEXMFROOT")
+  if tlroot then
+    tlroot = tlroot .. "/tlpkg"
+  else
+    tfpPrint("error in finding texmf root!")
+  end
+  local list = getFiles(tlroot, "^texlive%.tlpdb%.main")
+  if #list > 0 then
+    tlpkgtext = fileRead(tlroot .. "/" .. list[1])
+    if not tlpkgtext then
+      tfpPrint("error in reading texlive package database!")
+    end
+  else
+    -- no texlive.tlpdb.main file in a fresh TeX live
+    tfpPrint("error in finding texlive package database!")
+    tfpPrint("please run 'tlmgr update --self' first.")
+  end
+end
+
+local tlpkgdata = {}
+
+local function tlExtractFiles(name, desc)
+  -- ignore binary packages
+  -- also ignore latex-dev packages
+  if name:find("%.") or name:find("^latex%-[%a]-%-dev") then
+    --print(name)
+    return
+  end
+  -- ignore package files in doc folder
+  desc = desc:match("\nrunfiles .+") or ""
+  for base, ext in desc:gmatch("/([%a%d%-]+)%.([%a%d]+)\n") do
+    if ext == "sty" or ext == "cls" then
+      dbgPrint(name, base .. "." .. ext)
+      tlpkgdata[base .. "." .. ext] = name
+    end
+  end
+end
+
+local function tlParsePackageDB()
+  tlpkgtext:gsub("name (.-)\n(.-)\n\n", tlExtractFiles)
+end
+
+------------------------------------------------------------
+--> \section{Handle MiKTeX package database}
+------------------------------------------------------------
+
+local mtpkgtext
+
+local function mtReadPackageDB()
+  local mtvar = kpse.var_value("TEXMFVAR")
+  if mtvar then
+    mtpdb = mtvar .. "/miktex/cache/packages/miktex-zzdb3-2.9/package-manifests.ini"
+  else
+    tfpPrint("error in finding texmf root!")
+  end
+  mtpkgtext = fileRead(mtpdb)
+  if not mtpkgtext then
+    tfpPrint("error in reading miktex package database!")
+  end
+end
+
+local mtpkgdata = {}
+
+local function mtExtractFiles(name, desc)
+  -- ignore package files in source or doc folders
+  -- also ignore latex-dev packages
+  if name:find("_") or name:find("^latex%-[%a]-%-dev") then
+    --print(name)
+    return
+  end
+  for base, ext in desc:gmatch("/([%a%d%-]+)%.([%a%d]+)\r?\n") do
+    if ext == "sty" or ext == "cls" then
+      dbgPrint(name, base .. "." .. ext)
+      mtpkgdata[base .. "." .. ext] = name
+    end
+  end
+end
+
+local function mtParsePackageDB()
+  -- package-manifests.ini might use different eol characters
+  mtpkgtext:gsub("%[(.-)%]\r?\n(.-)\r?\n\r?\n", mtExtractFiles)
+end
+
+------------------------------------------------------------
+--> \section{Compare TeX Live and MiKTeX packages}
+------------------------------------------------------------
+
+local tlpkgname = "download/texlive.tlpdb"
+local mtpkgname = "download/package-manifests.ini"
+
+local function compareDistributions()
+  tlpkgtext = fileRead(tlpkgname)
+  if tlpkgtext then
+    tlParsePackageDB()
+  else
+    tfpPrint("error in reading texlive package database!")
+  end
+  mtpkgtext = fileRead(mtpkgname)
+  if mtpkgtext then
+    mtParsePackageDB()
+  else
+    tfpPrint("error in reading miktex package database!")
+  end
+  local tlmissing, mkmissing = {}, {}
+  for k, vt in pairs(tlpkgdata) do
+    local vm = mtpkgdata[k] -- or "[none]"
+    if vm then
+      mtpkgdata[k] = nil -- remove it
+      if vm ~= vt then
+        print("texlive->" .. vt, "miktex->" .. vm, k)
+      end
+    else
+      insert(mkmissing, {vt, k})
+    end
+  end
+  for k, v in pairs(mtpkgdata) do
+    print("texlive doesn't include " .. v .. " -> " .. k)
+  end
+  for _, v in ipairs(mkmissing) do
+    print("miktex doesn't include " .. v[1] .. " -> " .. v[2])
+  end
+end
+
+------------------------------------------------------------
+--> \section{Generate json file from cwl files}
+------------------------------------------------------------
+
+local function insertNewValue(tbl, val)
+  if not valueExists(tbl, val) then
+    insert(tbl, val)
+  end
+end
+
+local function extractFileData(cwl)
+  -- the cwl files have different eol characters
+  local deps = {}
+  for d in cwl:gmatch("\n#include:(.-)[\r\n]") do
+    --dbgPrint(d)
+    n = d:match("^class-(.+)$")
+    if n then
+      insertNewValue(deps, n .. ".cls")
+    else
+      insertNewValue(deps, d .. ".sty")
+    end
+  end
+  local envs = {}
+  for b, e in cwl:gmatch("\n\\begin{(.-)}.-\n\\end{(.-)}") do
+    if b == e then
+      --dbgPrint("{" .. e .. "}")
+      insert(envs, e)
+    end
+  end
+  local cmds = {}
+  for c in cwl:gmatch("\n\\(%a+)") do
+    if c ~= "begin" and c ~= "end" then
+      --dbgPrint("\\" .. c)
+      if not valueExists(cmds, c) then
+        insert(cmds, c)
+      end
+    end
+  end
+  --return {deps, envs, cmds}
+  return {deps = deps, envs = envs, cmds = cmds}
+end
+
+local function writeJson(cwldata)
+  tfpPrint("writing json database to file...")
+  local tbl1 = {}
+  for k, v in pairs(cwldata) do
+    table.insert(tbl1, {k, v})
+  end
+  table.sort(tbl1, function(a, b)
+    if a[1] < b[1] then return true end
+  end)
+  local tbl2 = {}
+  for _, v in ipairs(tbl1) do
+    local item = '"' .. v[1] .. '":' .. json.tostring(v[2])
+    table.insert(tbl2, item)
+  end
+  local text = "{\n" .. table.concat(tbl2, "\n,\n") .. "\n}"
+  fileWrite(text, "texfindpkg.json")
+  fileWrite(gzip.compress(text), "texfindpkg.json.gz")
+end
+
+local cwlpath = "completion"
+
+local function generateJsonData()
+  local list = getFiles(cwlpath, "%.cwl$")
+  local fname
+  local cwldata = {}
+  for _, v in ipairs(list) do
+    local a, b = match(v, "^([^%-]-)%-(.+)%.cwl")
+    if a == "class" then
+      fname = b .. ".cls"
+    else
+      b = match(v, "^(.+)%.cwl")
+      fname = b .. ".sty"
+    end
+    --print(fname)
+    local cwl = fileRead(cwlpath .. "/" .. v)
+    --print(cwl)
+    if cwl then
+      local item = extractFileData(cwl)
+      dbgPrint(item)
+      cwldata[fname] = item
+    else
+      tfpPrint("error in reading " .. v)
+    end
+  end
+  writeJson(cwldata)
+end
+
+------------------------------------------------------------
+--> \section{Install packages in current TeX distribution}
+------------------------------------------------------------
+
+local dist -- name of current tex distribution
+
+local function initPackageDB()
+  dist = testDistribution()
+  tfpPrint("you are using " .. dist)
+  if dist == "texlive" then
+    tlReadPackageDB()
+    tlParsePackageDB()
+  else
+    mtReadPackageDB()
+    mtParsePackageDB()
+  end
+end
+
+local function findOnePackage(fname)
+  if dist == "texlive" then
+    return tlpkgdata[fname]
+  else
+    return mtpkgdata[fname]
+  end
+end
+
+local function tfpExecute(c)
+  if os.type == "windows" then
+    os.execute(c)
+  else
+    os.execute('sudo env "PATH=$PATH" ' .. c)
+  end
+end
+
+local function installSomePackages(list)
+  if not list then return end
+  if dist == "texlive" then
+    local p = table.concat(list, " ")
+    tfpPrint("installing package " .. p)
+    tfpExecute("tlmgr install " .. p)
+  else
+    for _, p in ipairs(list) do
+      tfpPrint("installing package " .. p)
+      tfpExecute("miktex packages install " .. p)
+    end
+  end
+end
+
+local function listSomePackages(list)
+  if not list then return end
+  local p = table.concat(list, " ")
+  tfpPrint("please install " .. dist .. " package " .. p)
+end
+
+------------------------------------------------------------
+--> \section{Find dependencies of package files}
+------------------------------------------------------------
+
+local tfptext = ""  -- the json text
+local tfpdata = {}  -- the lua object
+local fnlist = {}  -- file name list
+
+local function initDependencyDB()
+  local ziptext = fileRead(lookup("texfindpkg.json.gz"))
+  tfptext = gzip.decompress(ziptext)
+  if tfptext then
+    --print(tfptext)
+    tfpdata = json.tolua(tfptext)
+  else
+    tfpPrint("error in reading texfindpkg.json.gz!")
+  end
+end
+
+local function findDependencies(fname)
+  --print(fname)
+  if valueExists(fnlist, fname) then return end
+  local item = tfpdata[fname]
+  if not item then
+    tfpPrint("no dependency info for " .. fname)
+    return
+  end
+  tfpPrint("finding dependencies for " .. fname)
+  table.insert(fnlist, fname)
+  local deps = item.deps
+  if deps then
+    for _, dname in ipairs(deps) do
+      findDependencies(dname)
+    end
+  end
+end
+
+local function queryByFileName(fname)
+  fnlist = {} -- reset the list
+  findDependencies(fname)
+  if #fnlist == 0 then
+    tfpPrint("could not find any package with file " .. fname)
+    return
+  end
+  local pkglist = {}
+  for _, fn in ipairs(fnlist) do
+    local pkg = findOnePackage(fn)
+    --print(fn, pkg)
+    if pkg then
+      table.insert(pkglist, pkg)
+    end
+  end
+  if not pkglist then
+    tfpPrint("error in finding package in " .. dist)
+    return
+  end
+  return pkglist
+end
+
+local function getFileNameFromCmdEnvName(cmdenv, name)
+  --print(name)
+  for line in tfptext:gmatch("(.-)\n[,}]") do
+    if line:find('"' .. name .. '"') then
+      --print(line)
+      local fname, fspec = line:match('"(.-)":(.+)')
+      --print(fname, fspec)
+      local item = json.tolua(fspec)
+      if valueExists(item[cmdenv], name) then
+        tfpPrint("found package file " .. fname)
+        return fname
+      end
+    end
+  end
+end
+
+local function queryByCommandName(cname)
+  --print(cname)
+  local fname = getFileNameFromCmdEnvName("cmds", cname)
+  if fname then
+    return queryByFileName(fname)
+  else
+    tfpPrint("could not find any package with command \\" .. cname)
+  end
+end
+
+local function queryByEnvironmentName(ename)
+  --print(ename)
+  local fname = getFileNameFromCmdEnvName("envs", ename)
+  if fname then
+    return queryByFileName(fname)
+  else
+    tfpPrint("could not find any package with environment {" .. ename .. "}")
+  end
+end
+
+local function query(name)
+  local h = name:sub(1,1)
+  if h == "\\" then
+    local b = name:sub(2)
+    return queryByCommandName(b)
+  elseif h == "{" then
+    if name:sub(-1) == "}" then
+      local b = name:sub(2,-2)
+      return queryByEnvironmentName(b)
+    else
+      tfpPrint("invalid input " .. name)
+    end
+  else
+    return queryByFileName(name)
+  end
+end
+
+local function install(name)
+  local list = query(name)
+  installSomePackages(list)
+end
+
+------------------------------------------------------------
+--> \section{Respond to user input}
+------------------------------------------------------------
+
+local helptext = [[
+usage: texfindpkg <action> [<options>] [<name>]
+
+Valid actions are:
+   install      Install some package and its dependencies
+   query        Query dependencies for some package
+
+Valid options are:
+   --help       Print this message and exit
+   --version    Print version information and exit
+]]
+
+local function main()
+  if arg[1] == nil then
+    print(helptext)
+  elseif arg[1] == "--help" then
+    print(helptext)
+  elseif arg[1] == "--version" then
+    print("TeXFindPkg Version " .. tfpversion .. " (" .. tfpdate .. ")\n")
+  elseif arg[1] == "install" then
+    if arg[2] then
+      initPackageDB()
+      initDependencyDB()
+      install(arg[2])
+    else
+      tfpPrint("missing the name of file/cmd/env!")
+    end
+  elseif arg[1] == "query" then
+    if arg[2] then
+      initPackageDB()
+      initDependencyDB()
+      local list = query(arg[2])
+      listSomePackages(list)
+    else
+      tfpPrint("missing the name of file/cmd/env!")
+    end
+  elseif arg[1] == "generate" then
+    generateJsonData()
+  elseif arg[1] == "compare" then
+    compareDistributions()
+  else
+    tfpPrint("unknown option " .. arg[1])
+  end
+end
+
+main()


Property changes on: trunk/Master/texmf-dist/scripts/texfindpkg/texfindpkg.lua
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/texfindpkg/texfindpkg.json.gz
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/tex/latex/texfindpkg/texfindpkg.json.gz
===================================================================
--- trunk/Master/texmf-dist/tex/latex/texfindpkg/texfindpkg.json.gz	2023-04-05 20:03:20 UTC (rev 66776)
+++ trunk/Master/texmf-dist/tex/latex/texfindpkg/texfindpkg.json.gz	2023-04-05 20:09:08 UTC (rev 66777)

Property changes on: trunk/Master/texmf-dist/tex/latex/texfindpkg/texfindpkg.json.gz
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2023-04-05 20:03:20 UTC (rev 66776)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2023-04-05 20:09:08 UTC (rev 66777)
@@ -327,7 +327,7 @@
     fifinddo-info fifo-stack
     fig4latex figbas figbib figchild figflow figput figsize
     filecontents filecontentsdef filedate filehook fileinfo filemod
-    findhyph findpkg fink finstrut fira firamath firamath-otf
+    findhyph fink finstrut fira firamath firamath-otf
     first-latex-doc firstaid fistrum fitbox fithesis
     fix2col fixcmex fixdif fixfoot fixjfm fixlatvian
     fixltxhyph fixmath fixme fixmetodonotes fixpdfmag fiziko
@@ -795,7 +795,7 @@
     tex-refs tex-virtual-academy-pl tex-vpat
     tex4ebook texaccents texapi texbytopic texcount
     texdate texdef texdiff texdimens texdirflatten texdoc texdraw
-    texfot texinfo texilikechaps texilikecover
+    texfindpkg texfot texinfo texilikechaps texilikecover
     texliveonfly texloganalyser texlogfilter texlogos texlogsieve
     texmate texments texnegar
     texonly texosquery texplate texpower texproposal texshade texsurgery

Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2023-04-05 20:03:20 UTC (rev 66776)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2023-04-05 20:09:08 UTC (rev 66777)
@@ -2092,7 +2092,6 @@
  'fancytooltips',       'fancytipmark\..*|' . $standardtex,
  'fewerfloatpages',	'\.sty$',	# not l3doc-TUB.cls
  'figflow',     '\.tex',
- 'findpkg',	'\.json.gz|' . $standardtex,
  'fjodor',      'fjodor\.sty',          # not srbook-mem.sty
  'flashmovie',  '\.swf|' . $standardtex,
  'fltpoint',    '\.sty|\.tex',
@@ -2413,6 +2412,7 @@
  'texdimens',	'texdimens\.tex$|' . $standardtex,
  'texdoc',	'NULL',		# not texdoc-doc.cls
  'texdraw',     'tex$|' . $standardtex,
+ 'texfindpkg',	'\.json.gz$',
  'texosquery',  '\.tex$|' . $standardtex,
  'texproposal', 'NULL',
  'texsis',      '\.txs|TXS.*tex|texsis.tex',
@@ -3699,6 +3699,7 @@
  'texdiff'              => 'texdiff$',
  'texdirflatten'        => 'texdirflatten$',
  'texdoc',		=> 'texdoc\.tlu$',
+ 'texfindpkg'		=> 'texfindpkg\.lua$',
  'texfot'               => 'texfot\.pl$',
  'texliveonfly'         => '\.py$',
  'texloganalyser'       => 'texloganalyser$',
@@ -3789,6 +3790,7 @@
  'texdiff'              => 'texdiff.1',
  'texdirflatten'        => 'texdirflatten.1',
  'texdoc'               => '\.1$',
+ 'texfindpkg'		=> '\.1$',
  'texfot'               => '\.1$',
  'texlogfilter'		=> '\.1$',
  'texlogsieve'		=> '\.1$',

Modified: trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc	2023-04-05 20:03:20 UTC (rev 66776)
+++ trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc	2023-04-05 20:09:08 UTC (rev 66777)
@@ -23,7 +23,6 @@
 depend emoji
 depend emojicite
 depend enigma
-depend findpkg
 depend innerscript
 depend interpreter
 depend kanaparser
@@ -98,6 +97,7 @@
 depend spacekern
 depend spelling
 depend stricttex
+depend texfindpkg
 depend truthtable
 depend tsvtemplate
 depend typewriter

Added: trunk/Master/tlpkg/tlpsrc/texfindpkg.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/texfindpkg.tlpsrc	                        (rev 0)
+++ trunk/Master/tlpkg/tlpsrc/texfindpkg.tlpsrc	2023-04-05 20:09:08 UTC (rev 66777)
@@ -0,0 +1 @@
+binpattern f bin/${ARCH}/${PKGNAME}



More information about the tex-live-commits mailing list.