formats/v1: remove implicit assembler export
When building a version 1 manifest, the assembler would always be exported, even when not requested via the `--export` command line option. This was done for backwards compatibility so to not break tools relying on that behavior. The problem is that support for this uses a completely different code path and might also now be confusing behavior. Thus remove the implicit and really only ever export what was explicitly requested by the caller.
This commit is contained in:
parent
17136a70e4
commit
8770bdf10a
5 changed files with 8 additions and 20 deletions
|
|
@ -73,7 +73,6 @@ def load_assembler(description: Dict, index: Index, manifest: Manifest):
|
|||
|
||||
# Add a pipeline with one stage for our assembler
|
||||
pipeline = manifest.add_pipeline("assembler", runner, build)
|
||||
pipeline.export = True
|
||||
|
||||
info = index.get_module_info("Assembler", name)
|
||||
|
||||
|
|
|
|||
|
|
@ -152,8 +152,7 @@ def osbuild_cli():
|
|||
r = manifest.build(
|
||||
object_store,
|
||||
monitor,
|
||||
args.libdir,
|
||||
output_directory=output_directory
|
||||
args.libdir
|
||||
)
|
||||
|
||||
if r["success"] and args.export:
|
||||
|
|
|
|||
|
|
@ -196,7 +196,6 @@ class Pipeline:
|
|||
self.runner = runner
|
||||
self.stages = []
|
||||
self.assembler = None
|
||||
self.export = False
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
|
|
@ -298,7 +297,7 @@ class Pipeline:
|
|||
|
||||
return results, build_tree, tree
|
||||
|
||||
def run(self, store, monitor, libdir, output_directory):
|
||||
def run(self, store, monitor, libdir):
|
||||
results = {"success": True}
|
||||
|
||||
monitor.begin(self)
|
||||
|
|
@ -316,10 +315,6 @@ class Pipeline:
|
|||
if not results["success"]:
|
||||
return results
|
||||
|
||||
if self.export and obj:
|
||||
if output_directory:
|
||||
obj.export(output_directory)
|
||||
|
||||
monitor.finish(results)
|
||||
|
||||
return results
|
||||
|
|
@ -349,11 +344,11 @@ class Manifest:
|
|||
for source in self.sources:
|
||||
source.download(mgr, store, libdir)
|
||||
|
||||
def build(self, store, monitor, libdir, output_directory):
|
||||
def build(self, store, monitor, libdir):
|
||||
results = {"success": True}
|
||||
|
||||
for pl in self.pipelines.values():
|
||||
res = pl.run(store, monitor, libdir, output_directory)
|
||||
res = pl.run(store, monitor, libdir)
|
||||
results[pl.id] = res
|
||||
if not res["success"]:
|
||||
results["success"] = False
|
||||
|
|
|
|||
|
|
@ -81,10 +81,8 @@ class TestFormatV1(unittest.TestCase):
|
|||
monitor = NullMonitor(sys.stderr.fileno())
|
||||
libdir = os.path.abspath(os.curdir)
|
||||
store = ObjectStore(storedir)
|
||||
outdir = pathlib.Path(tmpdir, "out")
|
||||
outdir.mkdir()
|
||||
|
||||
res = manifest.build(store, monitor, libdir, outdir)
|
||||
res = manifest.build(store, monitor, libdir)
|
||||
return res
|
||||
|
||||
def test_canonical(self):
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ from .. import test
|
|||
|
||||
class TapeMonitor(osbuild.monitor.BaseMonitor):
|
||||
"""Record the usage of all called functions"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(sys.stderr.fileno())
|
||||
self.counter = defaultdict(int)
|
||||
|
|
@ -62,7 +63,6 @@ class TestMonitor(unittest.TestCase):
|
|||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
storedir = os.path.join(tmpdir, "store")
|
||||
outputdir = os.path.join(tmpdir, "output")
|
||||
|
||||
logfile = os.path.join(tmpdir, "log.txt")
|
||||
|
||||
|
|
@ -70,8 +70,7 @@ class TestMonitor(unittest.TestCase):
|
|||
monitor = LogMonitor(log.fileno())
|
||||
res = pipeline.run(store,
|
||||
monitor,
|
||||
libdir=os.path.abspath(os.curdir),
|
||||
output_directory=outputdir)
|
||||
libdir=os.path.abspath(os.curdir))
|
||||
|
||||
with open(logfile) as f:
|
||||
log = f.read()
|
||||
|
|
@ -97,14 +96,12 @@ class TestMonitor(unittest.TestCase):
|
|||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
storedir = os.path.join(tmpdir, "store")
|
||||
outputdir = os.path.join(tmpdir, "output")
|
||||
|
||||
tape = TapeMonitor()
|
||||
with ObjectStore(storedir) as store:
|
||||
res = pipeline.run(store,
|
||||
tape,
|
||||
libdir=os.path.abspath(os.curdir),
|
||||
output_directory=outputdir)
|
||||
libdir=os.path.abspath(os.curdir))
|
||||
|
||||
assert res
|
||||
self.assertEqual(tape.counter["begin"], 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue