diff options
| author | ruki <[email protected]> | 2021-08-19 22:35:29 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-08-19 22:35:29 +0800 |
| commit | 9112276d8065c9fdc0428bb4b44cf1b5794ab6d8 (patch) | |
| tree | ea019e85323c9455fab2b0c162afc16c42f56e1f | |
| parent | 7d85d8190b2e650ad02552c4935092a6d732206d (diff) | |
improve xmake-requires.lock
4 files changed, 85 insertions, 21 deletions
diff --git a/tests/projects/package/multiconfig/xmake-requires.lock b/tests/projects/package/multiconfig/xmake-requires.lock index 8e4e4127c..6adbab999 100644 --- a/tests/projects/package/multiconfig/xmake-requires.lock +++ b/tests/projects/package/multiconfig/xmake-requires.lock @@ -1,11 +1,17 @@ { - version = "1.0", + __meta__ = { + version = "1.0" + }, ["zlib#ddbdd8b8f76d455a8c0ef45fffe37160"] = { arch = "x86_64", buildhash = "b76a297309d14c09b42cfe3927260a51", name = "zlib", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "1.2.11" }, ["zlib~debug#d72a8a937b694e449bce540c8eb65a8a"] = { @@ -13,7 +19,11 @@ buildhash = "e6a6fa6a86ad4fc7ae3c2cf7c60cc084", name = "zlib", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "1.2.11" }, ["zlib~shared#b286744a1898416faad2e5cab0104b2f"] = { @@ -21,7 +31,11 @@ buildhash = "8e5b898b0f344715bac89cc6a1577506", name = "zlib", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "1.2.11" } }
\ No newline at end of file diff --git a/tests/projects/package/toolchain_muslcc/xmake-requires.lock b/tests/projects/package/toolchain_muslcc/xmake-requires.lock index fb9cfad02..9509b8501 100644 --- a/tests/projects/package/toolchain_muslcc/xmake-requires.lock +++ b/tests/projects/package/toolchain_muslcc/xmake-requires.lock @@ -1,10 +1,17 @@ { + __meta__ = { + version = "1.0" + }, ["autoconf#ddbdd8b8f76d455a8c0ef45fffe37160"] = { arch = "x86_64", buildhash = "01974c48f52d4d658f58852351743754", name = "autoconf", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "2.69" }, ["automake#ddbdd8b8f76d455a8c0ef45fffe37160"] = { @@ -12,7 +19,11 @@ buildhash = "7a090c93706241f983f0d821a162e8a5", name = "automake", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "1.16.1" }, ["cmake#ddbdd8b8f76d455a8c0ef45fffe37160"] = { @@ -20,7 +31,11 @@ buildhash = "a6d18f8c0bf347d980f8bb762583c91a", name = "cmake", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "3.21.0" }, ["gmp#ddbdd8b8f76d455a8c0ef45fffe37160"] = { @@ -28,7 +43,11 @@ buildhash = "7dd9c224447e46698ac73d29f58b1d73", name = "gmp", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "6.2.1" }, ["libisl 0.22#3dd996fa365042e39791030c4e1cad52"] = { @@ -36,7 +55,11 @@ buildhash = "f649e1fb365e442e8f79f372fd91483b", name = "libisl", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "0.22" }, ["libogg#ddbdd8b8f76d455a8c0ef45fffe37160"] = { @@ -44,7 +67,11 @@ buildhash = "d894fc29f2fb4c45a0f48bc2c6ece273", name = "libogg", plat = "cross", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "v1.3.4" }, ["libplist#ddbdd8b8f76d455a8c0ef45fffe37160"] = { @@ -52,7 +79,11 @@ buildhash = "0c01b22920be4876b1de74629194eb8f", name = "libplist", plat = "cross", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "2.2.0" }, ["libtool#ddbdd8b8f76d455a8c0ef45fffe37160"] = { @@ -60,7 +91,11 @@ buildhash = "64584ec84a4743ecb740b598b263ffa6", name = "libtool", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "2.4.6" }, ["m4#ddbdd8b8f76d455a8c0ef45fffe37160"] = { @@ -68,7 +103,11 @@ buildhash = "fd0e83e5759b442a970327ebb1c89793", name = "m4", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "1.4.19" }, ["muslcc#ddbdd8b8f76d455a8c0ef45fffe37160"] = { @@ -76,7 +115,11 @@ buildhash = "11062c09ebeb484594488ad73ddbcd1f", name = "muslcc", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "20210202" }, ["pkg-config#ddbdd8b8f76d455a8c0ef45fffe37160"] = { @@ -84,16 +127,23 @@ buildhash = "84fd7f9b9f7a47709512cfc85cd9e5f7", name = "pkg-config", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "0.29.2" }, - version = "1.0", ["zlib#ddbdd8b8f76d455a8c0ef45fffe37160"] = { arch = "arm", buildhash = "be90a245b8bb48e6b08a1a15bdcad467", name = "zlib", plat = "cross", - repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", + repo = { + branch = "master", + commit = "e87effa464611cecf28dfced70cbe491a08fe99d", + url = "https://gitee.com/tboox/xmake-repo.git" + }, version = "1.2.11" } }
\ No newline at end of file diff --git a/xmake/modules/private/action/require/impl/lock_packages.lua b/xmake/modules/private/action/require/impl/lock_packages.lua index 52141d7db..18dabcac4 100644 --- a/xmake/modules/private/action/require/impl/lock_packages.lua +++ b/xmake/modules/private/action/require/impl/lock_packages.lua @@ -44,7 +44,7 @@ function _lock_package(instance) result.tag = instance:tag() if repo then local lastcommit = git.lastcommit({repodir = repo:directory()}) - result.repo = repo:url() .. "#" .. lastcommit + result.repo = {url = repo:url(), commit = lastcommit, branch = repo:branch()} end return result end @@ -52,8 +52,8 @@ end -- lock all required packages function main(packages) if project.policy("package.requires_lock") then - local results = {} - results.version = project.requireslock_version() + local results = {__meta__ = {}} + results.__meta__.version = project.requireslock_version() for _, instance in ipairs(packages) do local packagelock_key = _get_packagelock_key(instance) results[packagelock_key] = _lock_package(instance) diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index ade76e9d9..e1c8d87cb 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -219,7 +219,7 @@ function _get_locked_requires(requirekey) _memcache():set("requireslock", requireslock or false) end if requireslock then - return requireslock[requirekey], requireslock.version + return requireslock[requirekey], requireslock.__meta__.version end end |
