diff options
| author | ruki <[email protected]> | 2026-01-08 22:53:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-01-09 17:59:09 +0800 |
| commit | 90b6cc257a135cdeafbc542d2ec368250f0ec69d (patch) | |
| tree | b5808ce3c2adbca979fff6d913a6a3f3c14d4627 | |
| parent | 6265a6fcec0471720bf399374ca1078451036c43 (diff) | |
install package from schemes
| -rw-r--r-- | xmake/modules/private/action/require/impl/actions/install.lua | 7 | ||||
| -rw-r--r-- | xmake/modules/private/action/require/impl/install_packages.lua | 35 |
2 files changed, 23 insertions, 19 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua index d7310149a..157424305 100644 --- a/xmake/modules/private/action/require/impl/actions/install.lua +++ b/xmake/modules/private/action/require/impl/actions/install.lua @@ -555,8 +555,11 @@ function main(package) end os.tryrm(installdir) - -- is precompiled package? we can fallback to source package and try reinstall it again - if package:is_precompiled() then + -- is not last scheme? we can fallback to next scheme and try reinstall it again + local current_scheme = package:current_scheme() + local schemes_orderlist = package:schemes_orderlist() + local last_scheme = schemes_orderlist[#schemes_orderlist] + if current_scheme ~= last_scheme then ok = false else -- failed diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua index 39d7d0bd4..1585c55cc 100644 --- a/xmake/modules/private/action/require/impl/install_packages.lua +++ b/xmake/modules/private/action/require/impl/install_packages.lua @@ -495,25 +495,26 @@ function _do_install_packages(packages_install, packages_download, installdeps) packages_in_group[group] = 0 end - -- download this package first - local downloaded = true - if packages_download[tostring(instance)] then - packages_downloading[index] = instance - action_check(instance) - downloaded = action_download(instance) - packages_downloading[index] = nil - end + -- install package from the multiple schemes + for _, scheme in ipairs(instance:schemes_orderlist()) do + instance:current_scheme_set(scheme) - -- install this package - packages_installing[index] = instance - if downloaded then - if not action_install(instance) then - assert(instance:is_precompiled(), "package(%s) should be precompiled", instance:name()) - -- we need to disable built and re-download and re-install it - instance:fallback_build() + -- download this package first + local downloaded = true + if packages_download[tostring(instance)] then + packages_downloading[index] = instance + packages_installing[index] = nil action_check(instance) - action_download(instance) - action_install(instance) + downloaded = action_download(instance) + packages_downloading[index] = nil + end + + packages_installing[index] = instance + if downloaded then + if action_install(instance) then + -- install ok + break + end end end |
