sources/ostree: add documentation and schema

Add a brief documentation text and its JSON schema so that osbuild
can verify options org.osbuild.ostree source entries.
This commit is contained in:
Christian Kellner 2020-05-29 15:49:34 +02:00 committed by David Rheinsberg
parent e7b480895f
commit 66d1dc1206

View file

@ -1,4 +1,11 @@
#!/usr/bin/python3
"""Fetch OSTree commits from an repository
Uses ostree to pull specific commits from (remote) repositories
at the provided `url`. Can verify the commit, if one or more
gpg keys are provided via `gpgkeys`.
"""
import json
import os
@ -7,6 +14,45 @@ import subprocess
import uuid
SCHEMA = """
"additionalProperties": false,
"properties": {
"commits": {
"description": "The commits to fetch indexed their checksum",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"[0-9a-f]{5,64}": {
"type": "object",
"additionalProperties": false,
"required": ["remote"],
"properties": {
"remote": {
"type": "object",
"additionalProperties": false,
"required": ["url"],
"properties": {
"url": {
"type": "string",
"description": "URL of the repository."
},
"gpgkeys": {
"type": "array",
"items": {
"type": "string",
"description": "GPG keys to verify the commits"
}
}
}
}
}
}
}
}
}
"""
def ostree(*args, _input=None, **kwargs):
args = list(args) + [f'--{k}={v}' for k, v in kwargs.items()]
print("ostree " + " ".join(args), file=sys.stderr)