Skip to content

Commit c4bf768

Browse files
oharboeclaude
andcommitted
makeIssue: run-me finds the archive's root from a relative WORK_HOME
The run-me script changes to its own directory and sources the vars file from there, and the vars' paths are relative to the archive's root. With an absolute WORK_HOME, its prefix is stripped from the archive's member names, so run-me lands at the root and that works. With WORK_HOME=. it is at the root too. A relative WORK_HOME such as work/gcd keeps its place under the root, and run-me then failed: couldn't read file "./scripts/detail_place.tcl" run-me now climbs from its directory back to the archive's root and sources the vars by their path from there. An absolute WORK_HOME and WORK_HOME=. produce the same run-me as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent f23e2bc commit c4bf768

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

‎flow/util/makeIssue.sh‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,32 @@ fi
8484
# Source the vars file relative to the run-me script itself, so the
8585
# reproducible works out of the box wherever the tarball is extracted
8686
# (WORK_HOME is an absolute CI path that does not exist elsewhere).
87+
# The vars' paths are relative to the archive's root, where an absolute
88+
# WORK_HOME lands (stripped below) and where a relative one does not: a
89+
# relative WORK_HOME keeps its place under the root, and run-me climbs
90+
# back to the root from it before sourcing the vars from there.
91+
case "${WORK_HOME:-.}" in
92+
/*)
93+
RUN_ME_ROOT=.
94+
RUN_ME_VARS=./$(basename ${VARS_BASENAME}).sh
95+
;;
96+
*)
97+
RUN_ME_ROOT=$(realpath -m --relative-to="$(realpath -m "${WORK_HOME:-.}")" .)
98+
RUN_ME_VARS=./$(realpath -m --relative-to=. "${VARS_BASENAME}").sh
99+
;;
100+
esac
87101
if [ "$IS_YOSYS" -eq 1 ]; then
88102
cat > ${RUN_ME_SCRIPT} <<EOF
89103
#!/usr/bin/env bash
90-
cd "\$(dirname "\$0")"
91-
source ./$(basename ${VARS_BASENAME}).sh
104+
cd "\$(dirname "\$0")/${RUN_ME_ROOT}"
105+
source ${RUN_ME_VARS}
92106
yosys ${YOSYS_FLAGS:-} -c \${SCRIPTS_DIR}/${ISSUE_TARGET}.tcl
93107
EOF
94108
else
95109
cat > ${RUN_ME_SCRIPT} <<EOF
96110
#!/usr/bin/env bash
97-
cd "\$(dirname "\$0")"
98-
source ./$(basename ${VARS_BASENAME}).sh
111+
cd "\$(dirname "\$0")/${RUN_ME_ROOT}"
112+
source ${RUN_ME_VARS}
99113
if [[ ! -z \${GDB+x} ]]; then
100114
gdb --args openroad -no_init -threads ${NUM_CORES:-1} \${SCRIPTS_DIR}/${ISSUE_TARGET}.tcl
101115
else

0 commit comments

Comments
 (0)