Skip to content

Commit 239852e

Browse files
committed
fix(docker): address review feedback on tools image
- Exclude tools/install from the orfs-tools build context so stale local install output cannot leak into the image. - Hash the effective Docker ignore file in the -tools tag. - Use git submodule status for the yosys/kepler-formal commits so an uninitialized submodule does not error. - Reject --openroad_only without --local or with --skip_openroad. Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
1 parent 01db8dc commit 239852e

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

‎build_openroad.sh‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Options:
5959
-s, --skip_openroad Skip building and all git operations on OpenROAD.
6060
6161
--openroad_only Build only OpenROAD; skip Yosys, Verific and
62-
kepler-formal.
62+
kepler-formal. Requires --local.
6363
6464
--or_branch BRANCH_NAME Use the head of branch BRANCH for tools/OpenROAD.
6565
@@ -240,6 +240,17 @@ while (( "$#" )); do
240240
shift
241241
done
242242

243+
if [ ! -z "${OPENROAD_ONLY+x}" ]; then
244+
if [ -z "${LOCAL_BUILD+x}" ]; then
245+
echo "[ERROR FLW-0033] --openroad_only requires --local." >&2
246+
exit 1
247+
fi
248+
if [ ! -z "${SKIP_OPENROAD+x}" ]; then
249+
echo "[ERROR FLW-0033] --openroad_only and --skip_openroad are mutually exclusive." >&2
250+
exit 1
251+
fi
252+
fi
253+
243254
if [[ "$PROC" == "-1" ]]; then
244255
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
245256
PROC=$(nproc --all)

‎docker/Dockerfile.builder‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ ENV PATH="/usr/local/bin/wrapped-cc:$PATH"
2727

2828
FROM orfs-builder-base AS orfs-tools-builder
2929

30-
COPY --link --exclude=OpenROAD --exclude=AutoTuner tools tools
30+
# Exclude install so a local build's output (e.g. tools/install/OpenROAD)
31+
# cannot leak into the image; the build below starts from an empty install.
32+
COPY --link --exclude=OpenROAD --exclude=AutoTuner --exclude=install tools tools
3133
ARG numThreads=$(nproc)
3234
ARG verificPath=""
3335

‎etc/DockerTag.sh‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ if [[ "$@" == "-dev" ]]; then
1515
cat "${file_list[@]}" | sha256sum | awk '{print substr($1, 1, 6)}'
1616
elif [[ "$@" == "-tools" ]]; then
1717
# Everything the orfs-tools target of Dockerfile.builder depends on:
18-
# the dev image, the build scripts, and the checked-out tools except
19-
# OpenROAD.
18+
# the dev image, the build scripts, the ignore file that filters the
19+
# build context, and the checked-out tools except OpenROAD.
20+
ignore_file=./docker/Dockerfile.builder.dockerignore
21+
if [[ ! -f "${ignore_file}" ]]; then
22+
ignore_file=./.dockerignore
23+
fi
2024
{
2125
./etc/DockerTag.sh -dev
2226
cat ./build_openroad.sh ./dev_env.sh ./etc/setup_compiler_wrappers.sh
23-
git -C tools/yosys rev-parse HEAD
24-
git -C tools/kepler-formal rev-parse HEAD
27+
cat "${ignore_file}"
28+
# Drop the trailing describe output, which depends on fetched tags.
29+
git submodule status tools/yosys tools/kepler-formal | awk '{print $1, $2}'
2530
git ls-tree HEAD tools/ | grep -v -e 'tools/OpenROAD$' -e 'tools/AutoTuner$' \
2631
-e 'tools/yosys$' -e 'tools/kepler-formal$'
2732
} | sha256sum | awk '{print substr($1, 1, 6)}'

0 commit comments

Comments
 (0)