summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-03-14 22:52:07 +0800
committerruki <[email protected]>2024-03-14 22:52:07 +0800
commitff083f97e3e1b99faa6ab78e157e9e36c25ab20e (patch)
treebe9c78e5a4f828cea86f2f51faf9a2c4dbb4751c
parent7cf2ec4434e99b302031e829400b72225f19b909 (diff)
fix package cachedir
-rw-r--r--xmake/core/package/package.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index c8560a859..c480d9b6c 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -749,7 +749,18 @@ function _instance:cachedir()
if not cachedir then
cachedir = self:get("cachedir")
if not cachedir then
- local name = self:name():lower():gsub("::", "_")
+ -- we need to use displayname (with package id) to avoid
+ -- multiple processes accessing it at the same time.
+ --
+ -- @see https://github.com/libbpf/libbpf-bootstrap/pull/259#issuecomment-1994914188
+ --
+ -- e.g.
+ --
+ -- lock elfutils#1 /home/runner/.xmake/cache/packages/2403/e/elfutils/0.189
+ -- lock elfutils /home/runner/.xmake/cache/packages/2403/e/elfutils/0.189
+ -- package(elfutils) is being accessed by other processes, please wait!
+ --
+ local name = self:displayname():lower():gsub("::", "_"):gsub("#", "_")
local version_str = self:version_str()
if self:is_thirdparty() then
-- strip `>= <=`