|
@@ -3,7 +3,7 @@ import("core.package.package")
|
|
import("core.platform.platform")
|
|
import("core.platform.platform")
|
|
|
|
|
|
-- is supported platform and architecture?
|
|
-- is supported platform and architecture?
|
|
-function _is_supported(instance, plat, arch, opt)
|
|
|
|
|
|
+function is_supported(instance, plat, arch, opt)
|
|
|
|
|
|
-- get script
|
|
-- get script
|
|
local script = instance:get("install")
|
|
local script = instance:get("install")
|
|
@@ -29,17 +29,17 @@ function _is_supported(instance, plat, arch, opt)
|
|
for _pattern, _script in pairs(script) do
|
|
for _pattern, _script in pairs(script) do
|
|
local hosts = {}
|
|
local hosts = {}
|
|
local hosts_spec = false
|
|
local hosts_spec = false
|
|
- _pattern = _pattern:gsub("@(.+)", function (v)
|
|
|
|
|
|
+ _pattern = _pattern:gsub("@(.+)", function (v)
|
|
for _, host in ipairs(v:split(',')) do
|
|
for _, host in ipairs(v:split(',')) do
|
|
hosts[host] = true
|
|
hosts[host] = true
|
|
hosts_spec = true
|
|
hosts_spec = true
|
|
end
|
|
end
|
|
- return ""
|
|
|
|
|
|
+ return ""
|
|
end)
|
|
end)
|
|
if _pattern:trim() == "" and opt and opt.onlyhost then
|
|
if _pattern:trim() == "" and opt and opt.onlyhost then
|
|
_pattern = os.subhost()
|
|
_pattern = os.subhost()
|
|
end
|
|
end
|
|
- if not _pattern:startswith("__") and (not hosts_spec or hosts[os.subhost() .. '|' .. os.subarch()] or hosts[os.subhost()])
|
|
|
|
|
|
+ if not _pattern:startswith("__") and (not hosts_spec or hosts[os.subhost() .. '|' .. os.subarch()] or hosts[os.subhost()])
|
|
and (_pattern:trim() == "" or (plat .. '|' .. arch):find('^' .. _pattern .. '$') or plat:find('^' .. _pattern .. '$')) then
|
|
and (_pattern:trim() == "" or (plat .. '|' .. arch):find('^' .. _pattern .. '$') or plat:find('^' .. _pattern .. '$')) then
|
|
result = _script
|
|
result = _script
|
|
break
|
|
break
|
|
@@ -65,7 +65,7 @@ function main(opt)
|
|
if archs then
|
|
if archs then
|
|
local package_archs = {}
|
|
local package_archs = {}
|
|
for _, arch in ipairs(archs) do
|
|
for _, arch in ipairs(archs) do
|
|
- if _is_supported(instance, plat, arch, opt) then
|
|
|
|
|
|
+ if is_supported(instance, plat, arch, opt) then
|
|
table.insert(package_archs, arch)
|
|
table.insert(package_archs, arch)
|
|
end
|
|
end
|
|
end
|
|
end
|