Skip to content

Commit

Permalink
dep_install→unpack_deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaurens committed Jul 4, 2024
1 parent 11829b2 commit b9e012e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
26 changes: 22 additions & 4 deletions l3build-aux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,17 @@ function call(modules, target, opts)
end

---Unpack the given dependencies.
---A dependency is the path of a directory relative to the main one.
---@param deps table regular array of dependencies.
---A dependency is the path of another l3build package
---relative to the main one, or absolute?
---@param deps table ordered array of dependencies.
---@return number 0 on a successful completion, a non 0 error code otherwise.
---@see stdmain, check, unpack, typesetting
---@usage Private?
function dep_install(deps)
--TODO: Remove this function from the global scope
function unpack_deps(deps)
local error_level
for _, dep in ipairs(deps) do
print("Installing dependency: " .. dep)
print("Unpacking dependency: " .. dep)
error_level = run(dep, "texlua " .. get_script_name() .. " unpack -q")
if error_level ~= 0 then
return error_level
Expand All @@ -170,6 +172,22 @@ function dep_install(deps)
return 0
end

-- Just in case someone ever used this function.
---@param deps table same as unpack_deps
---@return number same as unpack_deps
dep_install = function(deps)
local next_dep_install = dep_install
-- only on the first call
if options["debug"] or not options["quiet"] then
--TODO: defer this message to the end of the parent run
print("DEPRECATED: dep_install will be removed in forthcoming release.")
next_dep_install = unpack_deps
end
local error_level = unpack_deps(deps)
dep_install = next_dep_install
return error_level
end

-- Construct a localtexmf including any tdsdirs
-- Needed for checking and typesetting, hence global
function localtexmf()
Expand Down
2 changes: 1 addition & 1 deletion l3build-check.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function checkinit()
cleandir(testdir)
cleandir(resultdir)
end
dep_install(checkdeps)
unpack_deps(checkdeps)
-- Copy dependencies to the test directory itself: this makes the paths
-- a lot easier to manage, and is important for dealing with the log and
-- with file input/output tests
Expand Down
2 changes: 1 addition & 1 deletion l3build-stdmain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ target_list =
bundleunpack =
{
func = bundleunpack,
pre = function() return(dep_install(unpackdeps)) end
pre = function() return(unpack_deps(unpackdeps)) end
},
-- Public targets
check =
Expand Down
2 changes: 1 addition & 1 deletion l3build-typesetting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ end

local function docinit()
-- Set up
dep_install(typesetdeps)
unpack_deps(typesetdeps)
unpack({sourcefiles, typesetsourcefiles}, {sourcefiledir, docfiledir})
cleandir(typesetdir)
for _,file in pairs(typesetfiles) do
Expand Down
2 changes: 1 addition & 1 deletion l3build-unpack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ for those people who are interested.
-- Unpack the package files using an 'isolated' system: this requires
-- a copy of the 'basic' DocStrip program, which is used then removed
function unpack(sources, sourcedirs)
local errorlevel = dep_install(unpackdeps)
local errorlevel = unpack_deps(unpackdeps)
if errorlevel ~= 0 then
return errorlevel
end
Expand Down

0 comments on commit b9e012e

Please sign in to comment.