From d2b786687628df1c6afeb2cda14d2fea865d8544 Mon Sep 17 00:00:00 2001 From: Pawel Czarnecki Date: Fri, 26 Apr 2024 13:49:34 +0200 Subject: [PATCH] flow/util/generate-vars: Fix absolute paths conversion Fixes the conversion of absolute paths for the .sh file. Applies to cases when the environment variable has the absolute path but it does not start at the very beginning of the env var value. Example: * before the fix: export SYNTH_ARGS="-flatten -extra-map /home/tester/OpenROAD-flow-scripts/flow/designs/src/lcu/lcu_kogge_stone.v" * after the fix: export SYNTH_ARGS="-flatten -extra-map ${FLOW_HOME}/designs/src/lcu/lcu_kogge_stone.v" Signed-off-by: Pawel Czarnecki --- flow/util/generate-vars.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flow/util/generate-vars.sh b/flow/util/generate-vars.sh index 143df79e9b..dc71505919 100755 --- a/flow/util/generate-vars.sh +++ b/flow/util/generate-vars.sh @@ -53,11 +53,11 @@ while read -r VAR; do echo "set env ${name} ${value}" >> $1.gdb continue fi - if [[ ${value} == /* ]]; then - # convert absolute paths if possible to use FLOW_HOME variable - value=$(sed -e "s,${FLOW_ROOT},\${FLOW_HOME},g" <<< "${value}") - value=$(sed -e "s,${ORFS_ROOT},\${FLOW_HOME}/\.\.,g" <<< "${value}") - fi + + # convert absolute paths if possible to use FLOW_HOME variable + value=$(sed -e "s,${FLOW_ROOT},\${FLOW_HOME},g" <<< "${value}") + value=$(sed -e "s,${ORFS_ROOT},\${FLOW_HOME}/\.\.,g" <<< "${value}") + echo "export ${name}=\"${value}\"" >> $1.sh if [[ "${value}" == *'$'* ]]; then echo "set env ${name} $(sed -e 's,${FLOW_HOME},getenv("FLOW_HOME"),' <<< ${value})" >> $1.gdb