summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-06-15 00:43:18 +0800
committerruki <[email protected]>2024-06-15 00:43:18 +0800
commit6cf3886bd1c113d3189d075cc936fd609e284680 (patch)
tree8b72f20b4927a656e2ea38014c84e006164547db
parenta71bfc26daf8a5f609c8653134ad8124f3870ab0 (diff)
add output kind for xpack
-rw-r--r--tests/plugins/pack/xmake.lua2
-rw-r--r--xmake/plugins/pack/deb/main.lua3
-rw-r--r--xmake/plugins/pack/xpack.lua30
3 files changed, 33 insertions, 2 deletions
diff --git a/tests/plugins/pack/xmake.lua b/tests/plugins/pack/xmake.lua
index 638b6208d..cf07d8ca6 100644
--- a/tests/plugins/pack/xmake.lua
+++ b/tests/plugins/pack/xmake.lua
@@ -34,7 +34,7 @@ xpack("test")
add_components("LongPath")
on_load(function (package)
- if package:from_source() then
+ if package:with_source() then
package:set("basename", "test-$(plat)-src-v$(version)")
else
package:set("basename", "test-$(plat)-$(arch)-v$(version)")
diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua
index 43f30f454..4dc23bc11 100644
--- a/xmake/plugins/pack/deb/main.lua
+++ b/xmake/plugins/pack/deb/main.lua
@@ -223,6 +223,9 @@ function _pack_deb(debuild, package)
-- build package
os.vrunv(debuild, {"-us", "-uc"}, {curdir = sourcedir})
+
+ -- copy deb file
+ os.vcp(path.join(path.directory(sourcedir), "*.deb"), package:outputfile())
end
function main(package)
diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua
index 6d82536d4..89ee5a54b 100644
--- a/xmake/plugins/pack/xpack.lua
+++ b/xmake/plugins/pack/xpack.lua
@@ -206,6 +206,24 @@ function xpack:inputkind()
return inputkind
end
+-- get the output kind
+function xpack:outputkind()
+ local outputkinds = {
+ wix = "binary",
+ nsis = "binary",
+ zip = "binary",
+ targz = "binary",
+ srczip = "source",
+ srctargz = "source",
+ runself = "source",
+ deb = "binary",
+ srpm = "source",
+ rpm = "binary"
+ }
+ local outputkind = outputkinds[self:format()] or "binary"
+ return outputkind
+end
+
-- pack from source files?
function xpack:from_source()
return self:inputkind() == "source"
@@ -216,6 +234,16 @@ function xpack:from_binary()
return self:inputkind() == "binary"
end
+-- pack with source files?
+function xpack:with_source()
+ return self:outputkind() == "source"
+end
+
+-- pack with binary files?
+function xpack:with_binary()
+ return self:outputkind() == "binary"
+end
+
-- get the build directory
function xpack:buildir()
return path.join(config.buildir(), ".xpack", self:name())
@@ -235,7 +263,7 @@ function xpack:basename()
local basename = option.get("basename") or self:get("basename")
if basename == nil then
basename = self:name()
- if self:from_source() then
+ if self:with_source() then
basename = basename .. "-src"
end
local version = self:version()