summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-12-18 22:47:03 +0800
committerruki <[email protected]>2023-12-18 22:47:03 +0800
commiteaa87e0bd00f1af071c777aedfe6d7ad4c562760 (patch)
treec3e6d3f57b646e55cc587be792cdd207f92de0ad
parentc1bba747f0859fb6f559169563973f28905c71f7 (diff)
archive src file
-rw-r--r--xmake/plugins/pack/srpm/main.lua17
-rw-r--r--xmake/scripts/xpack/srpm/srpm.spec2
2 files changed, 17 insertions, 2 deletions
diff --git a/xmake/plugins/pack/srpm/main.lua b/xmake/plugins/pack/srpm/main.lua
index 8963db272..b342bf6f2 100644
--- a/xmake/plugins/pack/srpm/main.lua
+++ b/xmake/plugins/pack/srpm/main.lua
@@ -22,6 +22,7 @@
import("core.base.option")
import("core.base.semver")
import("lib.detect.find_tool")
+import("utils.archive")
import("private.action.require.impl.packagenv")
import("private.action.require.impl.install_packages")
import(".batchcmds")
@@ -52,10 +53,15 @@ function _get_rpmbuild()
return rpmbuild, oldenvs
end
+-- get archive file
+function _get_archivefile(package)
+ return path.absolute(path.join(package:buildir(), package:basename() .. ".tar.gz"))
+end
+
-- get specvars
function _get_specvars(package)
local specvars = table.clone(package:specvars())
- specvars.PACKAGE_SOURCEDIR = package:sourcedir()
+ specvars.PACKAGE_ARCHIVEFILE = _get_archivefile(package)
return specvars
end
@@ -101,6 +107,15 @@ function _pack_srpm(rpmbuild, package)
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"})
+
-- do pack
os.vrunv(rpmbuild, {"-bs", specfile, "--define", "_srcrpmdir " .. package:outputfile()})
end
diff --git a/xmake/scripts/xpack/srpm/srpm.spec b/xmake/scripts/xpack/srpm/srpm.spec
index bde3d768a..d31679ad0 100644
--- a/xmake/scripts/xpack/srpm/srpm.spec
+++ b/xmake/scripts/xpack/srpm/srpm.spec
@@ -9,7 +9,7 @@ Summary: ${PACKAGE_TITLE}
License: ${PACKAGE_LICENSE}
URL: ${PACKAGE_HOMEPAGE}
-Source0: ${PACKAGE_SOURCEDIR}
+Source0: ${PACKAGE_ARCHIVEFILE}
BuildRequires: gcc
BuildRequires: gcc-c++