diff options
| author | ruki <[email protected]> | 2021-08-27 00:47:55 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-08-27 00:47:55 +0800 |
| commit | a5afebd516b2c40895cd709bbbf2ecf3a9e28ef0 (patch) | |
| tree | 417a300ff111fa737dc946c0188fe43e28d9c5fc /xmake/modules/package/manager | |
| parent | 3bcc30765c2a337016ae8a992ce2d5a65ecd2d0a (diff) | |
fix search package
Diffstat (limited to 'xmake/modules/package/manager')
| -rw-r--r-- | xmake/modules/package/manager/xmake/search_package.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/xmake/modules/package/manager/xmake/search_package.lua b/xmake/modules/package/manager/xmake/search_package.lua index 5b633852c..b96dc2203 100644 --- a/xmake/modules/package/manager/xmake/search_package.lua +++ b/xmake/modules/package/manager/xmake/search_package.lua @@ -19,6 +19,7 @@ -- -- imports +import("core.base.semver") import("core.package.package", {alias = "core_package"}) import("private.action.require.impl.repository") @@ -33,6 +34,10 @@ function main(name) if package then local repo = package:repo() local versions = package:versions() + if versions then + versions = table.copy(versions) + table.sort(versions, function (a, b) return semver.compare(a, b) < 0 end) + end table.insert(results, {name = package:name(), version = versions and versions[1], description = package:get("description"), reponame = repo and repo:name()}) end end |
