diff options
| author | ruki <[email protected]> | 2024-06-13 22:46:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-06-13 22:46:47 +0800 |
| commit | 392fd0ef66219987f39548716176472fff3e78ad (patch) | |
| tree | a8d655cde0e9449403d8cea507824d8799c9113e | |
| parent | 32aff4807758e70de86bd0c41486a7493dcebb10 (diff) | |
archive deb
| -rw-r--r-- | xmake/plugins/pack/deb/main.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/xmake/plugins/pack/deb/main.lua b/xmake/plugins/pack/deb/main.lua index d64204ae6..2b69a553b 100644 --- a/xmake/plugins/pack/deb/main.lua +++ b/xmake/plugins/pack/deb/main.lua @@ -34,6 +34,11 @@ function _get_debuild() return debuild end +-- get archive file +function _get_archivefile(package) + return path.absolute(path.join(package:buildir(), package:basename() .. ".tar.gz")) +end + -- pack deb package function _pack_deb(debuild, package) @@ -44,6 +49,29 @@ function _pack_deb(debuild, package) os.cp(specfile_template, specfile) end + -- archive source files + local srcfiles, dstfiles = package:sourcefiles() + for idx, srcfile in ipairs(srcfiles) do + os.vcp(srcfile, dstfiles[idx]) + end + for _, component in table.orderpairs(package:components()) do + if component:get("default") ~= false then + local srcfiles, dstfiles = component:sourcefiles() + for idx, srcfile in ipairs(srcfiles) do + os.vcp(srcfile, dstfiles[idx]) + end + end + end + + -- archive install files + local rootdir = package:source_rootdir() + local oldir = os.cd(rootdir) + local archivefiles = os.files("**") + os.cd(oldir) + local archivefile = _get_archivefile(package) + os.tryrm(archivefile) + archive.archive(archivefile, archivefiles, {curdir = rootdir, compress = "best"}) + end function main(package) |
