diff options
| -rw-r--r-- | tests/plugins/pack/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/plugins/pack/deb/main.lua | 3 | ||||
| -rw-r--r-- | xmake/plugins/pack/xpack.lua | 30 |
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() |
