Skip to content

Commit

Permalink
flow/util/generate-vars: Fix absolute paths conversion
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
lpawelcz committed Apr 26, 2024
1 parent 2f1417b commit d2b7866
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions flow/util/generate-vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d2b7866

Please sign in to comment.