summaryrefslogtreecommitdiff
path: root/shell/EXPRESSIONS
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-05-28 09:57:05 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-05-28 16:00:01 +0200
commitdaeedba20ada9dc40e892725a857c41e484b2a28 (patch)
tree1b94617255f915552df6896518225cbec712d5e5 /shell/EXPRESSIONS
parent50fe455e91eba52fb429f8d09890e3a419841ebf (diff)
downloadrules-cc-daeedba20ada9dc40e892725a857c41e484b2a28.tar.gz
New rule ["shell", "cmds"]
Add a new rule to execute shell comands, honoring the shell tool chain. Is is done in such a way, that coreutils (in particular, pwd) can also come from the binary dirs of the shell tool chain.
Diffstat (limited to 'shell/EXPRESSIONS')
-rw-r--r--shell/EXPRESSIONS69
1 files changed, 69 insertions, 0 deletions
diff --git a/shell/EXPRESSIONS b/shell/EXPRESSIONS
index 722e897..34a5c92 100644
--- a/shell/EXPRESSIONS
+++ b/shell/EXPRESSIONS
@@ -99,4 +99,73 @@
, "body": {"type": "CALL_EXPRESSION", "name": "list_provider"}
}
}
+, "prolog":
+ { "vars": ["fieldname", "TOOLCHAIN_DIR"]
+ , "imports": {"list_provider": ["./", "..", "field_list_provider"]}
+ , "expression":
+ { "type": "let*"
+ , "bindings":
+ [ ["provider", "bin dirs"]
+ , ["bin dirs", {"type": "CALL_EXPRESSION", "name": "list_provider"}]
+ , [ "relative paths"
+ , { "type": "foreach"
+ , "range": {"type": "var", "name": "bin dirs"}
+ , "body":
+ { "type": "join"
+ , "separator": "/"
+ , "$1":
+ [ "."
+ , { "type": "var"
+ , "name": "TOOLCHAIN_DIR"
+ , "default": "toolchain"
+ }
+ , {"type": "var", "name": "_"}
+ ]
+ }
+ }
+ ]
+ , [ "pwd paths"
+ , { "type": "foreach"
+ , "range": {"type": "var", "name": "bin dirs"}
+ , "body":
+ { "type": "join"
+ , "separator": "/"
+ , "$1":
+ [ "$(pwd)"
+ , { "type": "var"
+ , "name": "TOOLCHAIN_DIR"
+ , "default": "toolchain"
+ }
+ , {"type": "var", "name": "_"}
+ ]
+ }
+ }
+ ]
+ ]
+ , "body":
+ [ "__PATH=$PATH"
+ , { "type": "join"
+ , "$1":
+ [ "export PATH="
+ , { "type": "join"
+ , "separator": ":"
+ , "$1": {"type": "var", "name": "relative paths"}
+ }
+ , "${PATH:+:}${PATH}"
+ ]
+ }
+ , { "type": "join"
+ , "$1":
+ [ "export PATH="
+ , { "type": "join"
+ , "separator": ":"
+ , "$1": {"type": "var", "name": "pwd paths"}
+ }
+ , "${__PATH:+:}${__PATH}"
+ ]
+ }
+ , "unset __PATH"
+ ]
+ }
+ }
}