diff options
| author | ruki <[email protected]> | 2020-09-24 22:49:46 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-09-24 22:49:46 +0800 |
| commit | f1642e450812a6128941eeae4bafba523215ec50 (patch) | |
| tree | 09b6934644c00f7d6a3f1e6d422557c5b19f7da4 | |
| parent | 00c3ea3a17594bbfd566f9dc5b592abdee4e66a2 (diff) | |
fix package/buildhash
| -rw-r--r-- | xmake/core/package/package.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index c7fe2e034..69d92ff6e 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -681,7 +681,18 @@ function _instance:buildhash() local str = self:plat() .. self:arch() local configs = self:configs() if configs then - str = str .. string.serialize(configs, true) + -- since luajit v2.1, the key order of the table is random and undefined. + -- We cannot directly deserialize the table, so the result may be different each time + local configs_order = {} + for k, v in pairs(table.wrap(configs)) do + table.insert(configs_order, k .. "=" .. tostring(v)) + end + table.sort(configs_order) + + -- We need to be compatible with the hash value string for the previous luajit version + local configs_str = string.serialize(configs_order, true) + configs_str = configs_str:gsub("\"", "") + str = str .. configs_str end self._BUILDHASH = hash.uuid4(str):gsub('-', ''):lower() end |
