summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-09-11 22:47:35 +0800
committerruki <[email protected]>2020-09-11 22:47:35 +0800
commitfa0db916184f7b7b27af79eb4c184c163f547902 (patch)
treed6a2e04786ff5526b4ea271662910c7f61d6627d
parent02433ff768af0842de49d3901df973c57bb43a5a (diff)
improve checksum
-rw-r--r--xmake/actions/require/impl/action/download.lua3
-rw-r--r--xmake/actions/require/impl/action/download_resources.lua5
-rw-r--r--xmake/actions/require/impl/action/patch_sources.lua5
3 files changed, 13 insertions, 0 deletions
diff --git a/xmake/actions/require/impl/action/download.lua b/xmake/actions/require/impl/action/download.lua
index d3c8ad1a4..1b297c04a 100644
--- a/xmake/actions/require/impl/action/download.lua
+++ b/xmake/actions/require/impl/action/download.lua
@@ -94,6 +94,9 @@ function _download(package, url, sourcedir, url_alias, url_excludes)
-- @see https://github.com/xmake-io/xmake/issues/930
--
local sourcehash = package:sourcehash(url_alias)
+ if sourcehash then
+ sourcehash = sourcehash:lower()
+ end
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?
diff --git a/xmake/actions/require/impl/action/download_resources.lua b/xmake/actions/require/impl/action/download_resources.lua
index df560b3d3..a06905c6e 100644
--- a/xmake/actions/require/impl/action/download_resources.lua
+++ b/xmake/actions/require/impl/action/download_resources.lua
@@ -34,6 +34,11 @@ function _download(package, resource_name, resource_url, resource_hash)
-- get the resource file
local resource_file = assert(package:resourcefile(resource_name), "invalid resource file!")
+ -- ensure lower hash
+ if resource_hash then
+ resource_hash = resource_hash:lower()
+ end
+
-- the package file have been downloaded?
local cached = true
if option.get("force") or not os.isfile(resource_file) or resource_hash ~= hash.sha256(resource_file) then
diff --git a/xmake/actions/require/impl/action/patch_sources.lua b/xmake/actions/require/impl/action/patch_sources.lua
index 55c21abf3..d4ab76d07 100644
--- a/xmake/actions/require/impl/action/patch_sources.lua
+++ b/xmake/actions/require/impl/action/patch_sources.lua
@@ -32,6 +32,11 @@ function _patch(package, patch_url, patch_hash)
-- get the patch file
local patch_file = path.join(os.tmpdir(), "patches", package:name(), package:version_str(), (path.filename(patch_url):gsub("%?.+$", "")))
+ -- ensure lower hash
+ if patch_hash then
+ patch_hash = patch_hash:lower()
+ end
+
-- the package file have been downloaded?
local cached = true
if option.get("force") or not os.isfile(patch_file) or patch_hash ~= hash.sha256(patch_file) then