test: support v2 format for tree-id detection
In the function `treeid_from_manifest`, use dynamic format detection instead of hard-coding the use of the version 1 format. Additionally, directly access the `tree` pipeline and its `id` instead of going via the `get_ids` helper function, which is only present in v1.py.
This commit is contained in:
parent
7576191c2d
commit
427266c583
1 changed files with 8 additions and 2 deletions
10
test/test.py
10
test/test.py
|
|
@ -12,7 +12,6 @@ import tempfile
|
|||
import unittest
|
||||
|
||||
import osbuild.meta
|
||||
from osbuild.formats import v1 as fmt
|
||||
from osbuild.util import linux
|
||||
|
||||
|
||||
|
|
@ -356,10 +355,17 @@ class OSBuild(contextlib.AbstractContextManager):
|
|||
|
||||
index = osbuild.meta.Index(os.curdir)
|
||||
|
||||
|
||||
manifest_json = json.loads(manifest_data)
|
||||
|
||||
info = index.detect_format_info(manifest_json)
|
||||
if not info:
|
||||
raise RuntimeError("Unsupported manifest format")
|
||||
|
||||
fmt = info.module
|
||||
|
||||
manifest = fmt.load(manifest_json, index)
|
||||
tree_id, _ = fmt.get_ids(manifest)
|
||||
tree_id = manifest["tree"].id
|
||||
return tree_id
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue