From 85f1ef3e70620b3919f4e980eb442025f74d1bdd Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 14 Dec 2025 22:28:41 +0800 Subject: check package format --- xmake/actions/package/main.lua | 9 ++++++++- xmake/core/sandbox/modules/import/lib/luajit/bcsave.lua | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1