osbuild-mpp: Add mpp-join
This allows you to join a set of lists, its very nice to use e.g. when constructing the package-list for a depsolve node.
This commit is contained in:
parent
01fbc8c136
commit
cedb2426c7
1 changed files with 11 additions and 2 deletions
|
|
@ -675,14 +675,23 @@ class ManifestFile:
|
||||||
def _is_format(node):
|
def _is_format(node):
|
||||||
if not isinstance(node, dict):
|
if not isinstance(node, dict):
|
||||||
return False
|
return False
|
||||||
if "mpp-eval" in node:
|
for m in ("mpp-eval", "mpp-join"):
|
||||||
return True
|
if m in node:
|
||||||
|
return True
|
||||||
for m in ("int", "string", "json"):
|
for m in ("int", "string", "json"):
|
||||||
if f"mpp-format-{m}" in node:
|
if f"mpp-format-{m}" in node:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _eval_format(node, local_vars):
|
def _eval_format(node, local_vars):
|
||||||
|
if "mpp-join" in node:
|
||||||
|
to_merge_list = node["mpp-join"]
|
||||||
|
self._process_format(to_merge_list)
|
||||||
|
res = []
|
||||||
|
for to_merge in to_merge_list:
|
||||||
|
res.extend(to_merge)
|
||||||
|
return res
|
||||||
|
|
||||||
if "mpp-eval" in node:
|
if "mpp-eval" in node:
|
||||||
code = node["mpp-eval"]
|
code = node["mpp-eval"]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue