Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.

Commit 5692c06

Browse files
committed
remove old dep. manifest function
1 parent 95b7689 commit 5692c06

File tree

1 file changed

+0
-100
lines changed

1 file changed

+0
-100
lines changed

dist/depends.lua

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -767,103 +767,3 @@ function update_dependency_manifest(pkg, installed, to_install, dep_manifest)
767767

768768
return dep_manifest
769769
end
770-
771-
-- Returns manifest with information about dependencies of given module
772-
-- table 'dep_manifest' contains infromation about relevant modules and will be returned
773-
-- table 'dep_cache' contains all information collected so far and is used like a cache
774-
function dependency_manifest(module, dep_manifest, dep_cache)
775-
dep_manifest = dep_manifest or {}
776-
dep_cache = dep_cache or {}
777-
assert(type(module) == "string", "depends.dependency_manifest: Argument 'module' is not a string.")
778-
assert(type(dep_cache) == "table", "depends.dependency_manifest: Argument 'dep_cache' is not a table.")
779-
assert(type(dep_manifest) == "table", "depends.dependency_manifest: Argument 'dep_manifest' is not a table.")
780-
781-
local dep_manifest = utils.deepcopy(dep_manifest)
782-
local dep_cache = utils.deepcopy(dep_cache)
783-
local name, constraint = split_name_constraint(module)
784-
local name_ver = name .. (constraint and "-" .. constraint or "")
785-
786-
-- if info about the module is in cache and cache not disabled, use it
787-
if constraint and dep_cache[name_ver] and cfg.dep_cache then
788-
dep_manifest[name_ver] = dep_cache[name_ver]
789-
else
790-
local manifest, err = mf.get_manifest()
791-
if not manifest then return nil, "Error when getting manifest: " .. err end
792-
793-
-- find out available versions of package
794-
local versions, err = package.retrieve_versions(name, manifest, not cfg.debug)
795-
if not versions then return nil, err end
796-
797-
for _, version in pairs(versions) do
798-
table.insert(manifest, version)
799-
end
800-
801-
-- find the module's package
802-
local candidates = find_packages(name_ver, manifest)
803-
if #candidates == 0 then return nil, "Package '" .. name_ver .. "' not found." end
804-
805-
candidates = sort_by_versions(candidates)
806-
name_ver = candidates[1].name .. "-" .. candidates[1].version
807-
808-
-- if info about the module isn't in cache or cache disabled, download it
809-
if dep_cache[name_ver] and cfg.dep_cache then
810-
dep_manifest[name_ver] = dep_cache[name_ver]
811-
else
812-
-- download the dependency info
813-
local download_dir = sys.abs_path(sys.make_path(cfg.root_dir, cfg.temp_dir))
814-
local downloaded_pkg, err = package.fetch_pkg(candidates[1], download_dir, not cfg.debug)
815-
if not downloaded_pkg then return nil, err end
816-
817-
local distinfo = sys.make_path(downloaded_pkg.download_dir, "dist.info")
818-
local dist_info, err = mf.load_distinfo(distinfo)
819-
if not dist_info then return nil, "Error when loading dist.info file '" .. distinfo .. "': " .. err end
820-
821-
-- add information about this package to the cache
822-
if not dep_manifest[name_ver] then dep_manifest[name_ver] = {} end
823-
dep_manifest[name_ver].name = dist_info.name
824-
dep_manifest[name_ver].version = dist_info.version
825-
dep_manifest[name_ver].path = candidates[1].path
826-
dep_manifest[name_ver].depends = dist_info.depends
827-
828-
-- add also to cache
829-
dep_cache[name_ver] = dep_manifest[name_ver]
830-
end
831-
end
832-
833-
-- resolve dependencies
834-
if dep_manifest[name_ver].depends then
835-
836-
if not dep_manifest[name_ver].satisfied_by then
837-
dep_manifest[name_ver].satisfied_by = {}
838-
end
839-
840-
-- collect all OS specific dependencies of pkg
841-
for k, dep in pairs(dep_manifest[name_ver].depends) do
842-
if type(dep) == "table" then
843-
if k == cfg.arch then
844-
for _, os_specific_depend in pairs(dep) do
845-
table.insert(dep_manifest[name_ver].depends, os_specific_depend)
846-
end
847-
end
848-
end
849-
end
850-
851-
-- get dependency information of this module's dependencies
852-
for _, dep in ipairs(dep_manifest[name_ver].depends) do
853-
if type(dep) ~= "table" then
854-
local satisfying = dep_manifest[name_ver].satisfied_by[dep]
855-
if satisfying then dep = satisfying end
856-
857-
dep_manifest, dep_cache_or_err, satisfying = dependency_manifest(dep, dep_manifest, dep_cache)
858-
if not dep_manifest then return nil, dep_cache_or_err end
859-
dep_cache = dep_cache_or_err
860-
861-
-- add 'satisfied-by' info
862-
dep_manifest[name_ver].satisfied_by[dep] = satisfying
863-
dep_cache[name_ver].satisfied_by[dep] = satisfying
864-
end
865-
end
866-
end
867-
868-
return dep_manifest, dep_cache, name_ver
869-
end

0 commit comments

Comments
 (0)