osbuild.py/pipeline: introduce the concept of a base pipeline

This allows one pipline to build on top of another. When the pipeline
id of one pipeline is specified in another, the tree is initialized
with the output of the given pipeline.

The caller must ensure that the base pipeline has alreday been run,
and its content is in the content-store.

This renders the io.weldr.untree stage and the --input argument both
redundant.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-07-02 22:38:20 +02:00 committed by Lars Karlitski
parent e607053c32
commit ffffb87dea
6 changed files with 12 additions and 35 deletions

View file

@ -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", {})

View file

@ -1,13 +1,6 @@
{
"name": "base-qcow2",
"stages": [
{
"name": "io.weldr.untree",
"options": {
"tree": "efc7b094c174d9f5fd66c863db7128415f5df0f073125716f5279554f13a659f"
}
}
],
"base": "f571638c0a21a7141e2391d476433c1679831e4f21df6555c2ef53c4446b7603",
"assembler":
{
"name": "io.weldr.qcow2",

View file

@ -1,13 +1,6 @@
{
"name": "base-targz",
"stages": [
{
"name": "io.weldr.untree",
"options": {
"tree": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e"
}
}
],
"base": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e"
"assembler": {
"name": "io.weldr.targz",
"options": {

View file

@ -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"],

View file

@ -1,12 +1,7 @@
{
"name": "base-with-locale",
"base": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e",
"stages": [
{
"name": "io.weldr.untree",
"options": {
"tree": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e"
}
},
{
"name": "io.weldr.locale",
"options": {

View file

@ -1,12 +1,7 @@
{
"name": "base-with-selinux",
"base": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e",
"stages": [
{
"name": "io.weldr.untree",
"options": {
"tree": "1f663f817473ffa5b01241b17adbd71bc734962313f5d4eef230073c0ac5884e"
}
},
{
"name": "io.weldr.selinux",
"options": {