diff --git a/osbuild.py b/osbuild.py index 7cf7190e..8b799e91 100644 --- a/osbuild.py +++ b/osbuild.py @@ -209,7 +209,8 @@ class Pipeline: m.update(json.dumps(pipeline, sort_keys=True).encode()) self.id = m.hexdigest() - self.stages = pipeline["stages"] + self.base = pipeline.get("base") + self.stages = pipeline.get("stages", []) self.assembler = pipeline.get("assembler") self.objects = objects @@ -220,6 +221,11 @@ class Pipeline: "stages": [] } with BuildRoot() as buildroot, tmpfs() as tree: + if self.base: + input_tree = os.path.join(self.objects, self.base) + + subprocess.run(["cp", "-a", f"{input_tree}/.", tree], check=True) + for i, stage in enumerate(self.stages, start=1): name = stage["name"] options = stage.get("options", {}) diff --git a/samples/base-qcow2.json b/samples/base-qcow2.json index f328531f..161ed603 100644 --- a/samples/base-qcow2.json +++ b/samples/base-qcow2.json @@ -1,13 +1,6 @@ { "name": "base-qcow2", - "stages": [ - { - "name": "io.weldr.untree", - "options": { - "tree": "efc7b094c174d9f5fd66c863db7128415f5df0f073125716f5279554f13a659f" - } - } - ], + "base": "f571638c0a21a7141e2391d476433c1679831e4f21df6555c2ef53c4446b7603", "assembler": { "name": "io.weldr.qcow2", diff --git a/samples/base-targz.json b/samples/base-targz.json index afddb1ff..52f4a949 100644 --- a/samples/base-targz.json +++ b/samples/base-targz.json @@ -1,13 +1,6 @@ { "name": "base-targz", - "stages": [ - { - "name": "io.weldr.untree", - "options": { - "tree": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e" - } - } - ], + "base": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e" "assembler": { "name": "io.weldr.targz", "options": { diff --git a/samples/base-with-grub2.json b/samples/base-with-grub2.json index ac3461e4..7a898bc7 100644 --- a/samples/base-with-grub2.json +++ b/samples/base-with-grub2.json @@ -1,12 +1,7 @@ { "name": "base-with-grub2", + "base": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e", "stages": [ - { - "name": "io.weldr.untree", - "options": { - "tree": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e" - } - }, { "name": "io.weldr.grub2", "systemResourcesFromEtc": ["/etc/grub.d"], diff --git a/samples/base-with-locale.json b/samples/base-with-locale.json index b64ba71f..fb1bb261 100644 --- a/samples/base-with-locale.json +++ b/samples/base-with-locale.json @@ -1,12 +1,7 @@ { "name": "base-with-locale", + "base": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e", "stages": [ - { - "name": "io.weldr.untree", - "options": { - "tree": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e" - } - }, { "name": "io.weldr.locale", "options": { diff --git a/samples/base-with-selinux.json b/samples/base-with-selinux.json index 11fcc9ce..f72dcac0 100644 --- a/samples/base-with-selinux.json +++ b/samples/base-with-selinux.json @@ -1,12 +1,7 @@ { "name": "base-with-selinux", + "base": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e", "stages": [ - { - "name": "io.weldr.untree", - "options": { - "tree": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e" - } - }, { "name": "io.weldr.selinux", "options": {