summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-14 22:28:41 +0800
committerruki <[email protected]>2025-12-14 22:28:41 +0800
commit85f1ef3e70620b3919f4e980eb442025f74d1bdd (patch)
treea15f35c7bf2607ec2988d1b3a1a355ce070472f0
parentc078b92f0153bc2c4f13136646363d5ab0e683c6 (diff)
check package format
-rw-r--r--xmake/actions/package/main.lua9
-rw-r--r--xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua1
2 files changed, 9 insertions, 1 deletions
diff --git a/xmake/actions/package/main.lua b/xmake/actions/package/main.lua
index 5c392f3b4..caf77d465 100644
--- a/xmake/actions/package/main.lua
+++ b/xmake/actions/package/main.lua
@@ -20,8 +20,15 @@
-- imports
import("core.base.option")
+import("core.base.hashset")
-- main entry
function main()
- import(option.get("format") or "local")()
+ local format = option.get("format") or "local"
+ local maps = hashset.from({"local", "remote", "localpkg"})
+ if maps:has(format) then
+ import(format)()
+ else
+ raise("invalid package format: %s", format or "missing")
+ end
end
diff --git a/xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua b/xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua
index dd8ee1eef..58c91afa4 100644
--- a/xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua
+++ b/xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua
@@ -24,6 +24,7 @@ local string = require("base/string")
local raise = require("sandbox/modules/raise")
if not xmake._LUAJIT then
+ print(debug.traceback())
return
end