diff options
| author | ruki <[email protected]> | 2022-06-08 17:51:20 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-08 17:51:20 +0800 |
| commit | 1ca252a54b87d986a1e20238b0bf872ca64c5e36 (patch) | |
| tree | db2296a3f052d6590a6eb2bf96af39c3ca95dbb5 | |
| parent | a3f81d902ec232527f7b21e08b33d97936fc98d2 (diff) | |
| parent | 7c16e0f2ed8303f42ae43128c16cf83640759632 (diff) | |
Merge pull request #2440 from SirLynix/patch-11
Improve package installation error messages
| -rw-r--r-- | xmake/modules/private/action/require/impl/install_packages.lua | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua index b45e56b1a..d5116ade5 100644 --- a/xmake/modules/private/action/require/impl/install_packages.lua +++ b/xmake/modules/private/action/require/impl/install_packages.lua @@ -669,6 +669,7 @@ function main(requires, opt) local packages_download = {} local packages_unsupported = {} local packages_not_found = {} + local packages_unknown = {} for _, instance in ipairs(packages) do if package.should_install(instance) then if instance:is_supported() then @@ -677,7 +678,11 @@ function main(requires, opt) end table.insert(packages_install, instance) elseif not instance:is_optional() then - table.insert(packages_unsupported, instance) + if not instance:exists() and instance:is_system() then + table.insert(packages_unknown, instance) + else + table.insert(packages_unsupported, instance) + end end -- @see https://github.com/xmake-io/xmake/issues/2050 elseif not instance:exists() and not instance:is_optional() then @@ -688,21 +693,36 @@ function main(requires, opt) end end + local has_errors = false + + -- exists unknown packages? + if #packages_unknown > 0 then + cprint("${bright color.warning}note: ${clear}the following packages were not found in any repository (check if they are spelled correctly):") + for _, instance in ipairs(packages_unknown) do + print(" -> %s", instance:displayname()) + end + has_errors = true + end + -- exists unsupported packages? if #packages_unsupported > 0 then - cprint("${bright color.warning}note: ${clear}the following packages are unsupported for $(plat)/$(arch)!") + cprint("${bright color.warning}note: ${clear}the following packages are unsupported on $(plat)/$(arch):") for _, instance in ipairs(packages_unsupported) do print(" -> %s %s", instance:displayname(), instance:version_str() or "") end - raise() + has_errors = true end -- exists not found packages? if #packages_not_found > 0 then - cprint("${bright color.warning}note: ${clear}the following packages are not found for $(plat)/$(arch)!") + cprint("${bright color.warning}note: ${clear}the following packages were not found on your system, try again after installing them:") for _, instance in ipairs(packages_not_found) do print(" -> %s %s", instance:displayname(), instance:version_str() or "") end + has_errors = true + end + + if has_errors then raise() end |
