Stage: Schema migration to separated JSON files

In the past input schema for stages has been moved to standalone
JSON files. Looks like org.osbuild.tar was missed during the migration.
This commit is contained in:
Paweł Poławski 2024-03-29 22:45:07 +01:00 committed by Simon de Vlieger
parent 9a4f4552f5
commit ae8f3f4a1e

View file

@ -1,105 +1,10 @@
#!/usr/bin/python3
"""
Assembles the tree into a tar archive named `filename`.
Uses the buildhost's `tar` command, like: `tar -cf $FILENAME -C $TREE`
The compression of the tar archive if determined by the suffix, i.e.
the `--auto-compress` option is used. See tar(1) for details.
By default POSIX ACLs, SELinux contexts and extended attributes are included,
in order to preserve the tree as closely as possible. It is possible to opt
out of any of those by supplying the corresponding option.
Buildhost commands used: `tar` and any needed compression program.
"""
import os
import subprocess
import sys
import osbuild.api
SCHEMA_2 = """
"options": {
"additionalProperties": false,
"anyOf": [
{
"required": ["root-node"],
"not": {
"required": ["paths"]
}
},
{
"required": ["paths"],
"not": {
"required": ["root-node"]
}
},
{
"not": {
"required": ["paths", "root-node"]
}
}
],
"required": ["filename"],
"properties": {
"filename": {
"description": "Filename for tar archive",
"type": "string"
},
"format": {
"description": "Archive format to use",
"type": "string",
"enum": ["gnu", "oldgnu", "posix", "ustar", "v7"],
"default": "gnu"
},
"acls": {
"description": "Enable support for POSIX ACLs",
"type": "boolean",
"default": true
},
"selinux": {
"description": "Enable support for SELinux contexts",
"type": "boolean",
"default": true
},
"xattrs": {
"description": "Enable support for extended attributes",
"type": "boolean",
"default": true
},
"root-node": {
"description": "How to handle the root node: include or omit, mutually exclusive with paths",
"enum": ["include", "omit"]
},
"paths": {
"type": "array",
"items": {
"type": "string",
"description": "If specified, the archive will only contain the specified paths, in the specified order"
}
},
"sparse": {
"description": "Make archive files sparse",
"type": "boolean",
"default": false
}
}
},
"inputs": {
"type": "object",
"additionalProperties": false,
"required": ["tree"],
"properties": {
"tree": {
"type": "object",
"additionalProperties": true
}
}
}
"""
def main(inputs, output_dir, options):
tree = inputs["tree"]["path"]