summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-05 20:12:49 +0800
committerruki <[email protected]>2023-03-05 20:13:41 +0800
commit70f1a5ff1850f8138759500295702eb2541c227b (patch)
tree2addc24579fc82db1d8f6e668da813668db7c506
parent15de8acc90a9fafc3a1e6dad0af1a81a68052769 (diff)
improve package.load_from_repository
-rw-r--r--xmake/core/package/package.lua5
-rw-r--r--xmake/core/sandbox/modules/import/core/package/package.lua4
-rw-r--r--xmake/modules/package/manager/xmake/search_package.lua2
-rw-r--r--xmake/modules/private/action/require/impl/package.lua2
-rw-r--r--xmake/modules/private/xrepo/quick_search/cache.lua2
5 files changed, 8 insertions, 7 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index c0b60d289..95c609951 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -2445,7 +2445,7 @@ function package.load_from_project(packagename, project)
end
-- load the package from the package directory or package description file
-function package.load_from_repository(packagename, repo, packagedir, opt)
+function package.load_from_repository(packagename, packagedir, opt)
-- get it directly from cache first
opt = opt or {}
@@ -2454,7 +2454,8 @@ function package.load_from_repository(packagename, repo, packagedir, opt)
return instance
end
- -- load repository first for checking the xmake minimal version
+ -- load repository first for checking the xmake minimal version (deprecated)
+ local repo = opt.repo
if repo then
repo:load()
end
diff --git a/xmake/core/sandbox/modules/import/core/package/package.lua b/xmake/core/sandbox/modules/import/core/package/package.lua
index 906033fde..527ae5b64 100644
--- a/xmake/core/sandbox/modules/import/core/package/package.lua
+++ b/xmake/core/sandbox/modules/import/core/package/package.lua
@@ -52,8 +52,8 @@ function sandbox_core_package_package.load_from_system(packagename)
end
-- load the package from repositories
-function sandbox_core_package_package.load_from_repository(packagename, repo, packagedir, opt)
- local instance, errors = package.load_from_repository(packagename, repo, packagedir, opt)
+function sandbox_core_package_package.load_from_repository(packagename, packagedir, opt)
+ local instance, errors = package.load_from_repository(packagename, packagedir, opt)
if not instance then
raise(errors)
end
diff --git a/xmake/modules/package/manager/xmake/search_package.lua b/xmake/modules/package/manager/xmake/search_package.lua
index cfd384ac6..a299ce992 100644
--- a/xmake/modules/package/manager/xmake/search_package.lua
+++ b/xmake/modules/package/manager/xmake/search_package.lua
@@ -32,7 +32,7 @@ function main(name, opt)
opt = opt or {}
local results = {}
for _, packageinfo in ipairs(repository.searchdirs(name)) do
- local package = core_package.load_from_repository(packageinfo.name, packageinfo.repo, packageinfo.packagedir)
+ local package = core_package.load_from_repository(packageinfo.name, packageinfo.packagedir, {repo = packageinfo.repo})
if package then
local repo = package:repo()
local version
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 4fce86820..621c95c33 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -214,7 +214,7 @@ function _load_package_from_repository(packagename, opt)
opt = opt or {}
local packagedir, repo = repository.packagedir(packagename, opt)
if packagedir then
- return core_package.load_from_repository(packagename, repo, packagedir, {plat = opt.plat, arch = opt.arch})
+ return core_package.load_from_repository(packagename, packagedir, {plat = opt.plat, arch = opt.arch, repo = repo})
end
end
diff --git a/xmake/modules/private/xrepo/quick_search/cache.lua b/xmake/modules/private/xrepo/quick_search/cache.lua
index 2d13a676a..e14074d24 100644
--- a/xmake/modules/private/xrepo/quick_search/cache.lua
+++ b/xmake/modules/private/xrepo/quick_search/cache.lua
@@ -56,7 +56,7 @@ end
-- update the cache file
function update()
for _, packageinfo in ipairs(_list_package_dirs()) do
- local package = core_package.load_from_repository(packageinfo.name, packageinfo.repo, packageinfo.packagedir)
+ local package = core_package.load_from_repository(packageinfo.name, packageinfo.packagedir, {repo = packageinfo.repo})
cache:set(packageinfo.name, {
description = package:description(),
versions = package:versions(),