diff options
| author | ruki <[email protected]> | 2018-10-29 23:59:08 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-10-29 17:54:51 +0800 |
| commit | 3482c270e2d95680d7aebda29cc11b2eb5009dfc (patch) | |
| tree | 2d331c336d43087153ad2afdf103eb65713f897a | |
| parent | bc3459d5969a9f8956c2387f04bd6519650532ad (diff) | |
support package revision
| -rw-r--r-- | xmake/actions/require/impl/action/download.lua | 8 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/xmake/actions/require/impl/action/download.lua b/xmake/actions/require/impl/action/download.lua index 6fc0d5f3c..3c93e0bdf 100644 --- a/xmake/actions/require/impl/action/download.lua +++ b/xmake/actions/require/impl/action/download.lua @@ -44,7 +44,7 @@ function _emptychars() end -- checkout codes from git -function _checkout(package, url, sourcedir) +function _checkout(package, url, sourcedir, url_alias) -- use previous source directory if exists local packagedir = path.join(sourcedir, package:name()) @@ -65,14 +65,14 @@ function _checkout(package, url, sourcedir) -- only shadow clone this branch git.clone(url, {depth = 1, branch = package:version_str(), outputdir = packagedir}) - -- download package from tags or versions? + -- download package from revision, tag or version? else -- clone whole history and tags git.clone(url, {outputdir = packagedir}) -- attempt to checkout the given version - git.checkout(package:version_str(), {repodir = packagedir}) + git.checkout(package:revision(url_alias) or package:version_str(), {repodir = packagedir}) end -- move to source directory @@ -180,7 +180,7 @@ function main(package) -- download package local sourcedir = "source" if git.checkurl(url) then - _checkout(package, url, sourcedir) + _checkout(package, url, sourcedir, url_alias) else _download(package, url, sourcedir, url_alias, url_excludes) end diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index a4ab50855..3554c0e72 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -177,6 +177,11 @@ function _instance:sha256(url_alias) end end +-- get revision(commit, tag, branch) of the url_alias@version_str, only for git url +function _instance:revision(url_alias) + return self:sha256(url_alias) +end + -- this package is from system/local/global? -- -- @param kind the from kind |
