osbuild-pipeline: always pass repositories as input

Require repository informaiton to be passed as input, rather than
read from the current directory.

Reading from the repository informaiton meant to be used by weldr
has several drawbacks.
 - it makes it impractical to use the tool outside a git checkout
 - it makes it awkward to adapt the repositories to different use
   cases
 - it means that the shipped repositories cannot be extended with
   update repos, as the same repos are used for testing, and that
   would render our tests non-reproducible.

Overall, we are moving towards making repositories something the
caller must always pass in, rather than something that composer
maintains. For the weldr API we need to keep working as before,
but for new APIs we are avoiding that.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-03-29 01:08:11 +01:00
parent 7825132ae2
commit f945c5057e
2 changed files with 52 additions and 38 deletions

View file

@ -34,19 +34,19 @@ def run_osbuild(manifest, store):
def main(test_case, store):
boot_type = test_case["boot"]["type"]
compose_request = test_case["compose-request"]
compose_request = json.dumps(test_case["compose-request"])
blueprint = json.dumps(compose_request["blueprint"])
pipeline_command = ["go", "run", "./cmd/osbuild-pipeline", "-"]
test_case["manifest"] = json.loads(subprocess.check_output(pipeline_command, input=compose_request, encoding="utf-8"))
pipeline_command = ["go", "run", "./cmd/osbuild-pipeline", "-distro", compose_request["distro"], "-arch", compose_request["arch"], "-image-type", compose_request["image-type"], "-"]
test_case["manifest"] = json.loads(subprocess.check_output(pipeline_command, input=blueprint, encoding="utf-8"))
pipeline_command = ["go", "run", "./cmd/osbuild-pipeline", "-rpmmd", "-"]
test_case["rpmmd"] = json.loads(subprocess.check_output(pipeline_command, input=compose_request, encoding="utf-8"))
pipeline_command = ["go", "run", "./cmd/osbuild-pipeline", "-distro", compose_request["distro"], "-arch", compose_request["arch"], "-image-type", compose_request["image-type"], "-rpmmd", "-"]
test_case["rpmmd"] = json.loads(subprocess.check_output(pipeline_command, input=blueprint, encoding="utf-8"))
return test_case
if boot_type != "nspawn-extract":
output_id = run_osbuild(test_case["manifest"], store)
image_file = os.path.join(store, "refs", output_id, compose_request["filename"])
image_file = os.path.join(store, "refs", output_id, test_case["compose-request"]["filename"])
# we don't yet support image-info on directory trees
if boot_type == "qemu-extract":