Skip to content

Commit 6740689

Browse files
committed
fix(util): always start in /OpenROAD-flow-scripts/flow with WORK_HOME=/work
Signed-off-by: Jack Luar <jluar@precisioninno.com>
1 parent d60aa13 commit 6740689

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

‎flow/util/docker_shell‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ set -ex
88
# Options:
99
# -i, --image IMAGE Docker image (overrides $OR_IMAGE and default)
1010
# --user Map host UID/GID into the container via entrypoint.sh
11-
# --orfs-flow Mount pwd to /OpenROAD-flow-scripts/flow instead of /work
1211
# -p, --port SPEC Forward a port, e.g. --port 8265:8265 (repeatable)
1312
# --dry-run Print the docker command without executing it
1413
# -h|--help Show this help and exit
@@ -32,7 +31,7 @@ get_container_engine () {
3231
}
3332

3433
DEFAULT_IMAGE="openroad/orfs:latest"
35-
MOUNT_TARGET="/work"
34+
FLOW_DIR="/OpenROAD-flow-scripts/flow"
3635
USE_USER=false
3736
DRY_RUN=false
3837
PORTS=()
@@ -48,7 +47,6 @@ while [[ $# -gt 0 ]]; do
4847
case "$1" in
4948
-i|--image) IMAGE="$2"; shift 2 ;;
5049
--user) USE_USER=true; shift ;;
51-
--orfs-flow) MOUNT_TARGET="/OpenROAD-flow-scripts/flow"; shift ;;
5250
-p|--port) PORTS+=("$2"); shift 2 ;;
5351
--dry-run) DRY_RUN=true; shift ;;
5452
-h|--help) usage ;;
@@ -99,11 +97,7 @@ done
9997
CMD_STR=
10098
[[ ${#CMD_ARGS[@]} -gt 0 ]] && CMD_STR="${CMD_ARGS[*]}"
10199

102-
# Source env.sh only when mounting to ORFS flow dir (adds OR tools to PATH).
103-
# AutoTuner images install binaries in /usr/local/bin so env.sh is not needed
104-
# and would error out if absent.
105-
ENV_SH_CMD=
106-
[[ "$MOUNT_TARGET" == "/OpenROAD-flow-scripts/flow" ]] && ENV_SH_CMD=". ../env.sh;"
100+
ENV_SH_CMD='if [ -f ../env.sh ]; then . ../env.sh; fi;'
107101

108102
# Build the command once; dry-run prints it, otherwise exec it.
109103
DOCKER_CMD=(
@@ -119,14 +113,15 @@ DOCKER_CMD=(
119113
-v "$XAUTH:$XAUTH"
120114
-e "XAUTHORITY=$XAUTH"
121115
-e FLOW_HOME=/OpenROAD-flow-scripts/flow/
116+
-e WORK_HOME=/work
122117
-e "YOSYS_EXE=$YOSYS_EXE"
123118
-e "OPENROAD_EXE=$OPENROAD_EXE"
124119
-e "KLAYOUT_CMD=$KLAYOUT_CMD"
125-
-v "$WORKSPACE:${MOUNT_TARGET}"
120+
-v "$WORKSPACE:/work"
126121
--network host
127122
"${PORT_ARGS[@]}"
128123
"$IMAGE"
129-
bash -c "set -ex; mkdir /tmp/xdg-run; cd ${MOUNT_TARGET}; ${ENV_SH_CMD}$CMD_STR"
124+
bash -c "set -ex; mkdir /tmp/xdg-run; cd ${FLOW_DIR}; ${ENV_SH_CMD}$CMD_STR"
130125
)
131126

132127
if $DRY_RUN; then

0 commit comments

Comments
 (0)