build: Use Python tarfile instead of pax

This patch is for the new build system.
This commit is contained in:
Sebastian Huber
2020-08-18 13:14:48 +02:00
parent f3f0370f10
commit aa27a85a83
12 changed files with 24 additions and 39 deletions

27
wscript
View File

@@ -405,22 +405,23 @@ class Item(object):
bld(rule="${XZ} < ${SRC} > ${TGT}", source=source, target=target)
return target
def pax(self, bld, source, remove, target):
def tar(self, bld, source, remove, target):
def run(task):
import tarfile
tar = tarfile.TarFile(
task.outputs[0].abspath(), "w", format=tarfile.USTAR_FORMAT
)
srcpath = bld.path.abspath() + "/"
bldpath = bld.bldnode.abspath() + "/"
cmd = [bld.env.PAX[0], "-w", "-f", task.outputs[0].abspath()]
for r in remove:
cmd.extend(
[
"-s",
"," + srcpath + r + ",,",
"-s",
"," + bldpath + r + ",,",
]
)
cmd.extend([i.abspath() for i in task.inputs])
return task.exec_command(cmd)
for src in task.inputs:
src = src.abspath()
dst = src
for r in remove:
dst = src.replace(srcpath + r, "").replace(bldpath + r, "")
tar.add(src, dst)
tar.close()
return 0
bld(rule=run, source=source, target=target)
return target