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

View File

@@ -9,7 +9,7 @@ do-build: |
objs = []
objs.append(self.cc(bld, bic, path + "dl01-o1.c"))
tar = path + "dl01.tar"
self.pax(bld, objs, [path], tar)
self.tar(bld, objs, [path], tar)
tar_c, tar_h = self.bin2c(bld, tar)
objs = []
objs.append(self.cc(bld, bic, tar_c))

View File

@@ -10,7 +10,7 @@ do-build: |
objs.append(self.cc(bld, bic, path + "dl02-o1.c"))
objs.append(self.cc(bld, bic, path + "dl02-o2.c"))
tar = path + "dl02.tar"
self.pax(bld, objs, [path], tar)
self.tar(bld, objs, [path], tar)
tar_c, tar_h = self.bin2c(bld, tar)
objs = []
objs.append(self.cc(bld, bic, tar_c))

View File

@@ -10,7 +10,7 @@ do-build: |
objs = []
objs.append(self.cxx(bld, bic, path + "dl04-o4.cc"))
tar = path + "dl04.tar"
self.pax(bld, objs, [path], tar)
self.tar(bld, objs, [path], tar)
tar_c, tar_h = self.bin2c(bld, tar)
objs = []
objs.append(self.cc(bld, bic, tar_c))

View File

@@ -10,7 +10,7 @@ do-build: |
objs = []
objs.append(self.cxx(bld, bic, path + "dl05-o5.cc"))
tar = path + "dl05.tar"
self.pax(bld, objs, [path], tar)
self.tar(bld, objs, [path], tar)
tar_c, tar_h = self.bin2c(bld, tar)
objs = []
objs.append(self.cc(bld, bic, tar_c))

View File

@@ -7,7 +7,7 @@ cppflags: []
do-build: |
path = "testsuites/libtests/dl06/"
pre_tar = path + "dl06-pre.tar"
self.pax(bld, path + "dl06_pre_file", [path], pre_tar)
self.tar(bld, path + "dl06_pre_file", [path], pre_tar)
pre_tar_c, pre_tar_h = self.bin2c(bld, pre_tar, name="dl06_tar")
objs = []
objs.append(self.cc(bld, bic, pre_tar_c))
@@ -22,7 +22,7 @@ do-build: |
dl06_rap = path + "dl06.rap"
self.rtems_rap(bld, dl06_pre, objs, ["m"], dl06_rap)
tar = path + "dl06.tar"
self.pax(bld, dl06_rap, [path], tar)
self.tar(bld, dl06_rap, [path], tar)
tar_c, tar_h = self.bin2c(bld, tar)
objs.append(self.cc(bld, bic, tar_c))
objs.append(self.cc(bld, bic, path + "init.c", deps=[tar_h], cppflags=bld.env.TEST_DL06_CPPFLAGS))

View File

@@ -13,7 +13,7 @@ do-build: |
objs.append(self.cc(bld, bic, path + "dl07-o4.c"))
objs.append(self.cc(bld, bic, path + "dl07-o5.c"))
tar = path + "dl07.tar"
self.pax(bld, objs, [path], tar)
self.tar(bld, objs, [path], tar)
tar_c, tar_h = self.bin2c(bld, tar)
objs = []
objs.append(self.cc(bld, bic, tar_c))

View File

@@ -18,7 +18,7 @@ do-build: |
objs.append(self.ar(bld, lib_objs, path + "libdl08_2.a"))
objs.append(self.cc(bld, bic, path + "dl08-o1.c"))
tar = path + "dl08.tar"
self.pax(bld, [path + "etc/libdl.conf"] + objs, [path], tar)
self.tar(bld, [path + "etc/libdl.conf"] + objs, [path], tar)
tar_c, tar_h = self.bin2c(bld, tar)
objs = []
objs.append(self.cc(bld, bic, tar_c))

View File

@@ -13,7 +13,7 @@ do-build: |
objs.append(self.cc(bld, bic, path + "dl09-o4.c"))
objs.append(self.cc(bld, bic, path + "dl09-o5.c"))
tar = path + "dl09.tar"
self.pax(bld, objs, [path], tar)
self.tar(bld, objs, [path], tar)
tar_c, tar_h = self.bin2c(bld, tar)
objs = []
objs.append(self.cc(bld, bic, tar_c))

View File

@@ -18,7 +18,7 @@ do-build: |
objs.append(self.ar(bld, lib_objs, path + "libdl10_2.a"))
objs.append(self.cc(bld, bic, path + "dl10-o1.c"))
tar = path + "dl10.tar"
self.pax(bld, [path + "etc/libdl.conf"] + objs, [path], tar)
self.tar(bld, [path + "etc/libdl.conf"] + objs, [path], tar)
tar_c, tar_h = self.bin2c(bld, tar)
objs = []
objs.append(self.cc(bld, bic, tar_c))

View File

@@ -16,8 +16,6 @@ links:
uid: optbin2c
- role: build-dependency
uid: optgzip
- role: build-dependency
uid: optpax
- role: build-dependency
uid: optrtemsld
- role: build-dependency

View File

@@ -1,14 +0,0 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
actions:
- set-value: pax
- find-program: null
- env-assign: PAX
build-type: option
copyrights:
- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
default: null
default-by-variant: []
description: ''
enabled-by: true
links: []
type: build

25
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 src in task.inputs:
src = src.abspath()
dst = src
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)
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