diff options
| author | ruki <[email protected]> | 2020-08-29 22:59:49 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-08-29 22:59:49 +0800 |
| commit | 871ebb19fae313ef795e0fb60e78aa9cb1c94fa8 (patch) | |
| tree | 698ccedeb22428b9e4c5beea37b4382f22706d2f | |
| parent | 745c05312734df8408974eeed9e26b424770bb80 (diff) | |
improve to download package
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | xmake/actions/require/impl/action/download.lua | 10 | ||||
| -rw-r--r-- | xmake/actions/require/impl/package.lua | 5 |
3 files changed, 14 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e3c80f447..5b9431a2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * Improve Qt support for ubuntu/apt * Improve CMake project generator * [#931](https://github.com/xmake-io/xmake/issues/931): Support to export packages with all dependences +* [#930](https://github.com/xmake-io/xmake/issues/930): Support to download package without version list directly ### Bugs fixed @@ -821,6 +822,7 @@ * 改进Qt支持,对通过 ubuntu/apt 安装的Qt sdk也进行了探测支持,并且检测效率也优化了下 * 改进 CMake 工程文件生成器 * [#931](https://github.com/xmake-io/xmake/issues/931): 改进导出包,支持导出所有依赖包 +* [#930](https://github.com/xmake-io/xmake/issues/930): 如果私有包定义没有版本定义,支持直接尝试下载包 ### Bugs修复 diff --git a/xmake/actions/require/impl/action/download.lua b/xmake/actions/require/impl/action/download.lua index cb973ba3b..d3c8ad1a4 100644 --- a/xmake/actions/require/impl/action/download.lua +++ b/xmake/actions/require/impl/action/download.lua @@ -88,9 +88,13 @@ function _download(package, url, sourcedir, url_alias, url_excludes) -- get package file local packagefile = package:name() .. "-" .. package:version_str() .. archive.extension(url) - -- get sourcehash + -- get sourcehash from the given url + -- + -- we need not sourcehash and skip checksum to try download it directly if no version list in package() + -- @see https://github.com/xmake-io/xmake/issues/930 + -- local sourcehash = package:sourcehash(url_alias) - assert(sourcehash, "cannot get source hash of %s in package(%s)", url, package:name()) + assert(not package:get("versions") or sourcehash, "cannot get source hash of %s in package(%s)", url, package:name()) -- the package file have been downloaded? local cached = true @@ -149,7 +153,7 @@ function _urls(package) for _, url in ipairs(package:urls()) do if git.checkurl(url) then table.insert(urls[1], url) - elseif package:sourcehash(package:url_alias(url)) then + elseif not package:get("versions") or package:sourcehash(package:url_alias(url)) then table.insert(urls[2], url) end end diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua index 50b739026..cc9d51d6f 100644 --- a/xmake/actions/require/impl/package.lua +++ b/xmake/actions/require/impl/package.lua @@ -243,6 +243,11 @@ function _select_package_version(package, requireinfo) version, source = semver.select(require_version, package:versions()) elseif has_giturl then -- select branch? version, source = require_version ~= "latest" and require_version or "master", "branches" + elseif not package:get("versions") and semver.is_valid(require_version) then + -- no version list in package()? try this version directly + -- @see https://github.com/xmake-io/xmake/issues/930 + version = require_version + source = "versions" else raise("package(%s %s): not found!", package:name(), require_version) end |
