pipeline: run method takes store object not dir

Instead of passing the store directory to Pipeline.run, pass an
already initialized ObjectStore object. This binds the lifetime
of the store and its (temporary) objects to the run of osbuild
not the run of the pipeline.
This prepares re-using the stores with multiple (non-nested)
pipelines.
This commit is contained in:
Christian Kellner 2020-12-17 12:54:19 +01:00 committed by Tom Gundersen
parent 8d2c7f8160
commit f38c48086e
3 changed files with 38 additions and 35 deletions

View file

@ -14,6 +14,7 @@ import sys
import osbuild
import osbuild.meta
import osbuild.monitor
from osbuild.objectstore import ObjectStore
from osbuild.formats import v1 as fmt
@ -114,12 +115,13 @@ def osbuild_cli():
monitor = osbuild.monitor.make(monitor_name, sys.stdout.fileno())
try:
r = manifest.build(
args.store,
monitor,
args.libdir,
output_directory=args.output_directory
)
with ObjectStore(args.store) as object_store:
r = manifest.build(
object_store,
monitor,
args.libdir,
output_directory=args.output_directory
)
except KeyboardInterrupt:
print()
print(f"{RESET}{BOLD}{RED}Aborted{RESET}")