From c89bfcbb2b991a57d0f829e49d91f0f7c00531b7 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Fri, 4 Mar 2022 15:47:26 +0100 Subject: Add rule ["patch", "file"] ... to patch a single file, logically in place. --- rules/EXPRESSIONS | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'rules/EXPRESSIONS') diff --git a/rules/EXPRESSIONS b/rules/EXPRESSIONS index d9b85620..8c536124 100644 --- a/rules/EXPRESSIONS +++ b/rules/EXPRESSIONS @@ -95,4 +95,54 @@ } } } +, "stage_artifact_to_singleton_field": + { "vars": ["artifact", "fieldname", "transition"] + , "expression": + { "type": "let*" + , "bindings": + [ [ "location" + , { "type": "++" + , "$1": + { "type": "foreach" + , "var": "src" + , "range": + {"type": "FIELD", "name": {"type": "var", "name": "fieldname"}} + , "body": + { "type": "keys" + , "$1": + { "type": "DEP_ARTIFACTS" + , "dep": {"type": "var", "name": "src"} + , "transition": + { "type": "var" + , "name": "transition" + , "default": {"type": "empty_map"} + } + } + } + } + } + ] + , [ "staged_artifact" + , { "type": "foreach_map" + , "range": {"type": "var", "name": "artifact"} + , "var_val": "val" + , "body": + { "type": "foreach" + , "range": {"type": "var", "name": "location"} + , "var": "pos" + , "body": + { "type": "singleton_map" + , "key": {"type": "var", "name": "pos"} + , "value": {"type": "var", "name": "val"} + } + } + } + ] + ] + , "body": + { "type": "disjoint_map_union" + , "$1": {"type": "++", "$1": {"type": "var", "name": "staged_artifact"}} + } + } + } } -- cgit v1.2.3