diff options
| author | ruki <[email protected]> | 2021-08-18 00:53:03 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-08-18 00:53:03 +0800 |
| commit | 723dca1ac294cccd66f5b3dd0661299fd197f476 (patch) | |
| tree | fdcce708c72ccf1ea8fc008573616fdf8bea3d9a | |
| parent | 00107046b0c8eb07185b24783b2d32114f9ed760 (diff) | |
improve version source
| -rw-r--r-- | core/src/xmake/semver/select.c | 6 | ||||
| -rw-r--r-- | tests/projects/package/toolchain_muslcc/xmake-requires.lock | 86 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 39 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/base/semver.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/private/action/require/impl/package.lua | 12 |
5 files changed, 72 insertions, 73 deletions
diff --git a/core/src/xmake/semver/select.c b/core/src/xmake/semver/select.c index 221baf46d..6b2a13031 100644 --- a/core/src/xmake/semver/select.c +++ b/core/src/xmake/semver/select.c @@ -68,7 +68,7 @@ static tb_bool_t xm_semver_select_from_versions_tags1(lua_State* lua, tb_int_t f lua_pushstring(lua, top.raw); lua_setfield(lua, -2, "version"); - lua_pushstring(lua, fromidx == 2? "versions" : "tags"); + lua_pushstring(lua, fromidx == 2? "version" : "tag"); lua_setfield(lua, -2, "source"); // exit the popped semver @@ -92,7 +92,7 @@ static tb_bool_t xm_semver_select_from_versions_tags2(lua_State* lua, tb_int_t f lua_createtable(lua, 0, 2); lua_pushstring(lua, source_str); lua_setfield(lua, -2, "version"); - lua_pushstring(lua, fromidx == 2? "versions" : "tags"); + lua_pushstring(lua, fromidx == 2? "version" : "tag"); lua_setfield(lua, -2, "source"); return tb_true; } @@ -162,7 +162,7 @@ static tb_bool_t xm_semver_select_latest_from_versions_tags(lua_State* lua, tb_i lua_pushstring(lua, top.raw); lua_setfield(lua, -2, "version"); - lua_pushstring(lua, fromidx == 2? "versions" : "tags"); + lua_pushstring(lua, fromidx == 2? "version" : "tag"); lua_setfield(lua, -2, "source"); // exit the popped semver diff --git a/tests/projects/package/toolchain_muslcc/xmake-requires.lock b/tests/projects/package/toolchain_muslcc/xmake-requires.lock index 0f835d3d4..5ae48eeb9 100644 --- a/tests/projects/package/toolchain_muslcc/xmake-requires.lock +++ b/tests/projects/package/toolchain_muslcc/xmake-requires.lock @@ -1,188 +1,188 @@ { - ["autoconf#fd74da7781d54dddb234cfb6eae7be34"] = { + ["autoconf#f9faf630133045aab06d08087de4bc33"] = { arch = "x86_64", buildhash = "01974c48f52d4d658f58852351743754", deps = { - "m4#fd74da7781d54dddb234cfb6eae7be34" + "m4#f9faf630133045aab06d08087de4bc33" }, is_built = true, kind = "binary", name = "autoconf", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { - "http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz#954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969", "https://mirrors.ustc.edu.cn/gnu/autoconf/autoconf-2.69.tar.gz#954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969", - "git://git.sv.gnu.org/autoconf#2.69" + "git://git.sv.gnu.org/autoconf#2.69", + "http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz#954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969" }, version = "2.69" }, - ["automake#fd74da7781d54dddb234cfb6eae7be34"] = { + ["automake#f9faf630133045aab06d08087de4bc33"] = { arch = "x86_64", buildhash = "7a090c93706241f983f0d821a162e8a5", deps = { - "autoconf#fd74da7781d54dddb234cfb6eae7be34" + "autoconf#f9faf630133045aab06d08087de4bc33" }, is_built = true, kind = "binary", name = "automake", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { - "http://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz#608a97523f97db32f1f5d5615c98ca69326ced2054c9f82e65bade7fc4c9dea8", - "https://mirrors.ustc.edu.cn/gnu/automake/automake-1.16.1.tar.gz#608a97523f97db32f1f5d5615c98ca69326ced2054c9f82e65bade7fc4c9dea8" + "https://mirrors.ustc.edu.cn/gnu/automake/automake-1.16.1.tar.gz#608a97523f97db32f1f5d5615c98ca69326ced2054c9f82e65bade7fc4c9dea8", + "http://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz#608a97523f97db32f1f5d5615c98ca69326ced2054c9f82e65bade7fc4c9dea8" }, version = "1.16.1" }, - ["cmake#fd74da7781d54dddb234cfb6eae7be34"] = { + ["cmake#f9faf630133045aab06d08087de4bc33"] = { arch = "x86_64", buildhash = "a6d18f8c0bf347d980f8bb762583c91a", is_built = true, kind = "binary", name = "cmake", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { - "https://cmake.org/files/v3.21/cmake-3.21.0-macos-universal-Darwin-x86_64.tar.gz#c1c6f19dfc9c658a48b5aed22806595b2337bb3aedb71ab826552f74f568719f", - "https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0-macos-universal.tar.gz#c1c6f19dfc9c658a48b5aed22806595b2337bb3aedb71ab826552f74f568719f" + "https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0-macos-universal.tar.gz#c1c6f19dfc9c658a48b5aed22806595b2337bb3aedb71ab826552f74f568719f", + "https://cmake.org/files/v3.21/cmake-3.21.0-macos-universal-Darwin-x86_64.tar.gz#c1c6f19dfc9c658a48b5aed22806595b2337bb3aedb71ab826552f74f568719f" }, version = "3.21.0" }, - ["gmp#fd74da7781d54dddb234cfb6eae7be34"] = { + ["gmp#f9faf630133045aab06d08087de4bc33"] = { arch = "x86_64", buildhash = "7dd9c224447e46698ac73d29f58b1d73", deps = { - "autoconf#fd74da7781d54dddb234cfb6eae7be34" + "autoconf#f9faf630133045aab06d08087de4bc33" }, is_built = true, name = "gmp", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { "https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz#fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2" }, version = "6.2.1" }, - ["libisl 0.22#11f62b7b062648cebf81bd6623721f7d"] = { + ["libisl 0.22#3dd996fa365042e39791030c4e1cad52"] = { arch = "x86_64", buildhash = "f649e1fb365e442e8f79f372fd91483b", deps = { - "autoconf#fd74da7781d54dddb234cfb6eae7be34", - "gmp#fd74da7781d54dddb234cfb6eae7be34" + "autoconf#f9faf630133045aab06d08087de4bc33", + "gmp#f9faf630133045aab06d08087de4bc33" }, is_built = true, name = "libisl", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { "http://isl.gforge.inria.fr/isl-0.22.tar.xz#6c8bc56c477affecba9c59e2c9f026967ac8bad01b51bdd07916db40a517b9fa" }, version = "0.22" }, - ["libogg#265260a3b33e47f189d65373131d1f08"] = { + ["libogg#30fe400ff5234914998bd7d8c177621c"] = { arch = "arm", buildhash = "d894fc29f2fb4c45a0f48bc2c6ece273", deps = { - "cmake#fd74da7781d54dddb234cfb6eae7be34" + "cmake#f9faf630133045aab06d08087de4bc33" }, is_built = true, name = "libogg", plat = "cross", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { "https://gitlab.xiph.org/xiph/ogg/-/archive/v1.3.4/ogg-v1.3.4.tar.gz#62cc64b9fd3cf57bde3a9033e94534ba34313d2bb9698029f623121a4e47bb9b", "https://gitlab.xiph.org/xiph/ogg.git#v1.3.4" }, version = "v1.3.4" }, - ["libplist#265260a3b33e47f189d65373131d1f08"] = { + ["libplist#30fe400ff5234914998bd7d8c177621c"] = { arch = "arm", buildhash = "0c01b22920be4876b1de74629194eb8f", deps = { - "autoconf#fd74da7781d54dddb234cfb6eae7be34", - "automake#fd74da7781d54dddb234cfb6eae7be34", - "libtool#fd74da7781d54dddb234cfb6eae7be34", - "pkg-config#fd74da7781d54dddb234cfb6eae7be34" + "autoconf#f9faf630133045aab06d08087de4bc33", + "automake#f9faf630133045aab06d08087de4bc33", + "libtool#f9faf630133045aab06d08087de4bc33", + "pkg-config#f9faf630133045aab06d08087de4bc33" }, is_built = true, name = "libplist", plat = "cross", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { "https://github.com/libimobiledevice/libplist/archive/2.2.0.tar.gz#7e654bdd5d8b96f03240227ed09057377f06ebad08e1c37d0cfa2abe6ba0cee2", "https://github.com/libimobiledevice/libplist.git#2.2.0" }, version = "2.2.0" }, - ["libtool#fd74da7781d54dddb234cfb6eae7be34"] = { + ["libtool#f9faf630133045aab06d08087de4bc33"] = { arch = "x86_64", buildhash = "64584ec84a4743ecb740b598b263ffa6", deps = { - "autoconf#fd74da7781d54dddb234cfb6eae7be34" + "autoconf#f9faf630133045aab06d08087de4bc33" }, is_built = true, kind = "binary", name = "libtool", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { - "http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz#e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3", "https://mirrors.ustc.edu.cn/gnu/libtool/libtool-2.4.6.tar.gz#e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3", + "http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz#e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3", "git://git.savannah.gnu.org/libtool.git#2.4.6" }, version = "2.4.6" }, - ["m4#fd74da7781d54dddb234cfb6eae7be34"] = { + ["m4#f9faf630133045aab06d08087de4bc33"] = { arch = "x86_64", buildhash = "fd0e83e5759b442a970327ebb1c89793", is_built = true, kind = "binary", name = "m4", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { "https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz#63aede5c6d33b6d9b13511cd0be2cac046f2e70fd0a07aa9573a04a82783af96", "https://ftpmirror.gnu.org/m4/m4-1.4.19.tar.xz#63aede5c6d33b6d9b13511cd0be2cac046f2e70fd0a07aa9573a04a82783af96" }, version = "1.4.19" }, - ["muslcc#fd74da7781d54dddb234cfb6eae7be34"] = { + ["muslcc#f9faf630133045aab06d08087de4bc33"] = { arch = "x86_64", buildhash = "11062c09ebeb484594488ad73ddbcd1f", deps = { - "libisl 0.22#11f62b7b062648cebf81bd6623721f7d" + "libisl 0.22#3dd996fa365042e39791030c4e1cad52" }, is_built = true, kind = "toolchain", name = "muslcc", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { "https://github.com/xmake-mirror/musl.cc/releases/download/20210202/arm-linux-musleabi-cross.mac.tgz#a177df3f847181c0c7f2b34b9bd7725b4c556c11a347aa0ae36e09ebf23fb480" }, version = "20210202" }, - ["pkg-config#fd74da7781d54dddb234cfb6eae7be34"] = { + ["pkg-config#f9faf630133045aab06d08087de4bc33"] = { arch = "x86_64", buildhash = "84fd7f9b9f7a47709512cfc85cd9e5f7", is_built = true, kind = "binary", name = "pkg-config", plat = "macosx", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { "https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz#6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591", "http://fco.it.distfiles.macports.org/mirrors/macports-distfiles/pkgconfig/pkg-config-0.29.2.tar.gz#6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591" }, version = "0.29.2" }, - ["zlib#265260a3b33e47f189d65373131d1f08"] = { + ["zlib#30fe400ff5234914998bd7d8c177621c"] = { arch = "arm", buildhash = "be90a245b8bb48e6b08a1a15bdcad467", is_built = true, name = "zlib", plat = "cross", - repo = "https://gitee.com/tboox/xmake-repo.git#d5113078b850efb476f1730b8cd31d1f47691f00", + repo = "https://gitee.com/tboox/xmake-repo.git#e87effa464611cecf28dfced70cbe491a08fe99d", urls = { "https://github.com/madler/zlib/archive/v1.2.11.tar.gz#629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff" }, diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 5724da656..f7b2b7884 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -855,22 +855,7 @@ function _instance:version_str() return self._VERSION_STR end --- get branch version -function _instance:branch() - return self._BRANCH -end - --- get tag version -function _instance:tag() - return self._TAG -end - --- is git ref? -function _instance:gitref() - return self:branch() or self:tag() -end - --- set the version, source: branches, tags, versions +-- set the version, source: branch, tag, version function _instance:version_set(version, source) -- save the semver version @@ -880,17 +865,31 @@ function _instance:version_set(version, source) end -- save branch and tag - if source == "branches" then + if source == "branch" then self._BRANCH = version - elseif source == "tags" then + elseif source == "tag" then self._TAG = version end - -- save source and version string - self._SOURCE = source + -- save version string self._VERSION_STR = version end +-- get branch version +function _instance:branch() + return self._BRANCH +end + +-- get tag version +function _instance:tag() + return self._TAG +end + +-- is git ref? +function _instance:gitref() + return self:branch() or self:tag() +end + -- get the require info function _instance:requireinfo() return self._REQUIREINFO diff --git a/xmake/core/sandbox/modules/import/core/base/semver.lua b/xmake/core/sandbox/modules/import/core/base/semver.lua index edaf61470..eadcfb702 100644 --- a/xmake/core/sandbox/modules/import/core/base/semver.lua +++ b/xmake/core/sandbox/modules/import/core/base/semver.lua @@ -80,7 +80,7 @@ end -- local version, source = semver.select(">=1.5.0 <1.6", {"1.5.0", "1.5.1"}, {"v1.5.0", ..}, {"master", "dev"}) -- -- @version the selected version number --- @source the version source, e.g. versions, tags, branchs +-- @source the version source, e.g. version, tag, branch -- function sandbox_core_base_semver.select(range, versions, tags, branches) local verinfo, errors = semver.select(range, table.wrap(versions), table.wrap(tags), table.wrap(branches)) diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 53e978f9a..fb84dea5f 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -293,12 +293,12 @@ function _select_package_version(package, requireinfo) -- @see https://github.com/xmake-io/xmake/issues/930 -- https://github.com/xmake-io/xmake/issues/1009 version = require_version - source = "versions" + source = "version" elseif #package:versions() > 0 then -- select version? version, source = try { function () return semver.select(require_version, package:versions()) end } end if not version and has_giturl and not require_version:find('.', 1, true) then -- select branch? - version, source = require_version ~= "latest" and require_version or "master", "branches" + version, source = require_version ~= "latest" and require_version or "master", "branch" end if not version then raise("package(%s): version(%s) not found!", package:name(), require_version) @@ -667,12 +667,12 @@ function _load_package(packagename, requireinfo, opt) -- finish requireinfo _finish_requireinfo(requireinfo, package) - --[[ - -- get requirekey + -- get locked requireinfo + local locked_requireinfo if _has_locked_requires() then local requirekey = _get_packagelock_key(requireinfo) - print("requirekey", requirekey) - end]] + locked_requireinfo = _get_locked_requires(requirekey) + end -- select package version local version, source = _select_package_version(package, requireinfo) |
