stage: add module information about itself

Add a new `info` property that holds the `meta.ModuleInfo` info
for the stage. This gives each instance of a stage access to
meta (or class) information about it, i.e. its schema, docs but,
more importantly, also its name and path to the executable.
Thefore the `name` property is coverted into a transient property
which access the `name` member of `info`.
Change the `formats/v1` load mechanism to carry a new `index`
argument which is used to load the `ModuleInfo` for each stage.
Adapt all tests to load the info as well when creating stages.
This commit is contained in:
Christian Kellner 2021-01-05 19:43:11 +01:00 committed by Tom Gundersen
parent a26b7291d1
commit 7a6c2df910
6 changed files with 41 additions and 20 deletions

View file

@ -11,6 +11,7 @@ import sys
import tempfile
import unittest
import osbuild.meta
from osbuild.formats import v1 as fmt
from osbuild.util import linux
@ -352,9 +353,11 @@ class OSBuild(contextlib.AbstractContextManager):
are defined.
"""
index = osbuild.meta.Index(os.curdir)
manifest_json = json.loads(manifest_data)
manifest = fmt.load(manifest_json)
manifest = fmt.load(manifest_json, index)
tree_id, _ = fmt.get_ids(manifest)
return tree_id