diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-11-03 12:49:48 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-11-20 16:01:56 +0100 |
commit | 527de836e8b7217145ccbc2bc27c7bc87e3dc7f6 (patch) | |
tree | b2ac69c7a15d4f6009f53f16902d81723bc62554 | |
parent | 4e86f756bddca8db402502be47c0825e1e2aeb0d (diff) | |
download | rules-cc-527de836e8b7217145ccbc2bc27c7bc87e3dc7f6.tar.gz |
foreign: Only resolve symlinks on user request
-rw-r--r-- | CC/foreign/cmake/EXPRESSIONS | 11 | ||||
-rw-r--r-- | CC/foreign/cmake/RULES | 12 | ||||
-rw-r--r-- | CC/foreign/make/EXPRESSIONS | 11 | ||||
-rw-r--r-- | CC/foreign/make/RULES | 12 | ||||
-rw-r--r-- | CC/foreign/shell/EXPRESSIONS | 11 | ||||
-rw-r--r-- | CC/foreign/shell/RULES | 7 |
6 files changed, 54 insertions, 10 deletions
diff --git a/CC/foreign/cmake/EXPRESSIONS b/CC/foreign/cmake/EXPRESSIONS index 3d277fe..b4a9147 100644 --- a/CC/foreign/cmake/EXPRESSIONS +++ b/CC/foreign/cmake/EXPRESSIONS @@ -24,6 +24,7 @@ , "BUILD_POSITION_INDEPENDENT" , "defaults-transition" , "expand_exec" + , "resolve_symlinks" ] , "imports": { "artifacts": ["", "field_artifacts"] @@ -336,9 +337,13 @@ } } } - , [ "mv install install_with_symlinks" - , "cp -rL install_with_symlinks install" - ] + , { "type": "if" + , "cond": {"type": "var", "name": "resolve_symlinks"} + , "then": + [ "mv install install_with_symlinks" + , "cp -rL install_with_symlinks install >copy.log 2>&1 || (echo 'ERROR: symlink resolve failed with:' && cat copy.log && exit 1)" + ] + } , { "type": "if" , "cond": {"type": "var", "name": "post_cmds"} , "then": diff --git a/CC/foreign/cmake/RULES b/CC/foreign/cmake/RULES index b36bc73..166e2d6 100644 --- a/CC/foreign/cmake/RULES +++ b/CC/foreign/cmake/RULES @@ -18,6 +18,7 @@ , "post_cmds" , "out_files" , "out_dirs" + , "resolve_symlinks" ] , "config_vars": [ "ARCH" @@ -78,6 +79,10 @@ , "accessed via \"$CMAKE_SOURCE_DIR\" and \"$CMAKE_BINARY_DIR\"," , "respectively." ] + , "resolve_symlinks": + [ "Resolve all symlinks in the install directory. This operation is" + , "performed immediately after the install, before \"post_cmds\" are run." + ] , "out_files": [ "Paths to the produced output files. The paths are considered relative" , "to the install directory." @@ -204,6 +209,7 @@ , ["cmake_jobs", {"type": "FIELD", "name": "jobs"}] , ["pre_cmds", {"type": "FIELD", "name": "pre_cmds"}] , ["post_cmds", {"type": "FIELD", "name": "post_cmds"}] + , ["resolve_symlinks", {"type": "FIELD", "name": "resolve_symlinks"}] , ["defaults-transition", {"type": "empty_map"}] , [ "expand_exec" , { "type": "let*" @@ -291,6 +297,7 @@ , "hdr_prefix" , "lib_prefix" , "pc_prefix" + , "resolve_symlinks" ] , "config_vars": [ "ARCH" @@ -358,6 +365,10 @@ , "source and build directory can be accessed via \"$CMAKE_SOURCE_DIR\"" , "and \"$CMAKE_BINARY_DIR\", respectively." ] + , "resolve_symlinks": + [ "Resolve all symlinks in the install directory. This operation is" + , "performed immediately after the install, before \"post_cmds\" are run." + ] , "out_hdrs": [ "Paths to produced public header files. The path is considered" , "relative to the include directory, which be set via \"hdr_prefix\"." @@ -607,6 +618,7 @@ , ["cmake_jobs", {"type": "FIELD", "name": "jobs"}] , ["pre_cmds", {"type": "FIELD", "name": "pre_cmds"}] , ["post_cmds", {"type": "FIELD", "name": "post_cmds"}] + , ["resolve_symlinks", {"type": "FIELD", "name": "resolve_symlinks"}] , ["defaults-transition", {"type": "empty_map"}] , [ "expand_exec" , { "type": "let*" diff --git a/CC/foreign/make/EXPRESSIONS b/CC/foreign/make/EXPRESSIONS index 6a213a7..b03e056 100644 --- a/CC/foreign/make/EXPRESSIONS +++ b/CC/foreign/make/EXPRESSIONS @@ -26,6 +26,7 @@ , "TIMEOUT_SCALE" , "defaults-transition" , "expand_exec" + , "resolve_symlinks" ] , "imports": { "artifacts": ["", "field_artifacts"] @@ -304,9 +305,13 @@ ] } } - , [ "mv install install_with_symlinks" - , "cp -rL install_with_symlinks install" - ] + , { "type": "if" + , "cond": {"type": "var", "name": "resolve_symlinks"} + , "then": + [ "mv install install_with_symlinks" + , "cp -rL install_with_symlinks install >copy.log 2>&1 || (echo 'ERROR: symlink resolve failed with:' && cat copy.log && exit 1)" + ] + } , { "type": "if" , "cond": {"type": "var", "name": "post_cmds"} , "then": diff --git a/CC/foreign/make/RULES b/CC/foreign/make/RULES index 76fca18..e3c28db 100644 --- a/CC/foreign/make/RULES +++ b/CC/foreign/make/RULES @@ -20,6 +20,7 @@ , "post_cmds" , "out_files" , "out_dirs" + , "resolve_symlinks" ] , "config_vars": [ "ARCH" @@ -89,6 +90,10 @@ , "\"post_cmds\" can be exchanged via \"$TMPDIR\", which is uniquely" , "reserved for this action." ] + , "resolve_symlinks": + [ "Resolve all symlinks in the install directory. This operation is" + , "performed immediately after the install, before \"post_cmds\" are run." + ] , "out_files": [ "Paths to the produced output files. The paths are considered relative" , "to the install directory." @@ -222,6 +227,7 @@ , ["make_jobs", {"type": "FIELD", "name": "jobs"}] , ["pre_cmds", {"type": "FIELD", "name": "pre_cmds"}] , ["post_cmds", {"type": "FIELD", "name": "post_cmds"}] + , ["resolve_symlinks", {"type": "FIELD", "name": "resolve_symlinks"}] , ["defaults-transition", {"type": "empty_map"}] , [ "expand_exec" , { "type": "let*" @@ -310,6 +316,7 @@ , "hdr_prefix" , "lib_prefix" , "pc_prefix" + , "resolve_symlinks" ] , "config_vars": [ "ARCH" @@ -383,6 +390,10 @@ , "that data between \"pre_cmds\" and \"post_cmds\" can be exchanged via" , "\"$TMPDIR\", which is uniquely reserved for this action." ] + , "resolve_symlinks": + [ "Resolve all symlinks in the install directory. This operation is" + , "performed immediately after the install, before \"post_cmds\" are run." + ] , "out_hdrs": [ "Paths to produced public header files. The path is considered" , "relative to the include directory, which be set via \"hdr_prefix\"." @@ -640,6 +651,7 @@ , ["make_jobs", {"type": "FIELD", "name": "jobs"}] , ["pre_cmds", {"type": "FIELD", "name": "pre_cmds"}] , ["post_cmds", {"type": "FIELD", "name": "post_cmds"}] + , ["resolve_symlinks", {"type": "FIELD", "name": "resolve_symlinks"}] , ["defaults-transition", {"type": "empty_map"}] , [ "expand_exec" , { "type": "let*" diff --git a/CC/foreign/shell/EXPRESSIONS b/CC/foreign/shell/EXPRESSIONS index be6f797..3836388 100644 --- a/CC/foreign/shell/EXPRESSIONS +++ b/CC/foreign/shell/EXPRESSIONS @@ -19,6 +19,7 @@ , "BUILD_POSITION_INDEPENDENT" , "TIMEOUT_SCALE" , "expand_exec" + , "resolve_symlinks" ] , "imports": { "artifacts": ["", "field_artifacts"] @@ -287,9 +288,13 @@ , ["(", "set --", "cd ./work"] , {"type": "var", "name": "cmds"} , [")"] - , [ "mv install install_with_symlinks" - , "cp -rL install_with_symlinks install" - ] + , { "type": "if" + , "cond": {"type": "var", "name": "resolve_symlinks"} + , "then": + [ "mv install install_with_symlinks" + , "cp -rL install_with_symlinks install >copy.log 2>&1 || (echo 'ERROR: symlink resolve failed with:' && cat copy.log && exit 1)" + ] + } ] } } diff --git a/CC/foreign/shell/RULES b/CC/foreign/shell/RULES index ffffc26..82a7d05 100644 --- a/CC/foreign/shell/RULES +++ b/CC/foreign/shell/RULES @@ -10,7 +10,7 @@ , "current action directory, if needed for achieving reproducibility." ] , "target_fields": ["project", "localbase", "deps"] - , "string_fields": ["cmds", "outs", "out_dirs"] + , "string_fields": ["cmds", "outs", "out_dirs", "resolve_symlinks"] , "config_vars": [ "CC" , "CXX" @@ -42,6 +42,10 @@ [ "List of commands to execute by \"sh\". Multiple commands will be" , "joined with the newline character." ] + , "resolve_symlinks": + [ "Resolve all symlinks in the install directory. This operation is" + , "performed immediately after \"cmds\" were executed." + ] , "outs": ["Paths to the produced output files in \"DESTDIR\"."] , "out_dirs": ["Paths to the produced output directories in \"DESTDIR\"."] } @@ -161,6 +165,7 @@ , "body": {"type": "CALL_EXPRESSION", "name": "stage_field"} } ] + , ["resolve_symlinks", {"type": "FIELD", "name": "resolve_symlinks"}] ] , "body": { "type": "RESULT" |