Skip to content

Commit 4123ba5

Browse files
committed
More refinements on the reproducible build script
1 parent 92e42c0 commit 4123ba5

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

standalone-contract/scripts/reproducible_build_docker

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -ex
88

99
DOCKER="${DOCKER:-docker}"
1010
DOCKER_IMAGE="${DOCKER_IMAGE:-docker.io/cryptape/llvm-n-rust:20240630}"
11-
CHECKSUM_FILE_PATH="checksums.txt"
11+
CHECKSUM_FILE_PATH="${CHECKSUM_FILE_PATH:-checksums.txt}"
1212

1313
# We are parsing command line arguments based on tips from:
1414
# https://stackoverflow.com/a/14203146
@@ -24,10 +24,6 @@ while [[ $# -gt 0 ]]; do
2424
UPDATE="yes"
2525
shift # past argument
2626
;;
27-
-s|--sudo)
28-
SUDO="yes"
29-
shift # past argument
30-
;;
3127
--no-clean)
3228
NOCLEAN="yes"
3329
shift # past argument
@@ -44,7 +40,7 @@ while [[ $# -gt 0 ]]; do
4440
done
4541

4642
if [[ -n "${PROXY}" ]]; then
47-
PROXY_ARGS="-e ALL_PROXY=${PROXY} -e HTTPS_PROXY=${PROXY} -e HTTP_PROXY=${PROXY}"
43+
DOCKER_RUN_ARGS="-e ALL_PROXY=${PROXY} -e HTTPS_PROXY=${PROXY} -e HTTP_PROXY=${PROXY} ${DOCKER_RUN_ARGS}"
4844
fi
4945

5046
TASKS=""
@@ -58,13 +54,9 @@ else
5854
TASKS+=" build "
5955
fi
6056

61-
if [[ "${SUDO}" = "yes" ]]; then
62-
PREFIX="sudo"
63-
fi
64-
65-
$PREFIX $DOCKER run --rm $DOCKER_RUN_ARGS $PROXY_ARGS -v `pwd`:/code $DOCKER_IMAGE make $TASKS
57+
$DOCKER run --rm $DOCKER_RUN_ARGS -v `pwd`:/code $DOCKER_IMAGE make $TASKS
6658
# Reset file ownerships for all files docker might touch
67-
$PREFIX $DOCKER run --rm $DOCKER_RUN_ARGS $PROXY_ARGS -e UID=`id -u` -e GID=`id -g` -v `pwd`:/code $DOCKER_IMAGE bash -c 'chown -R -f $UID:$GID checksums.txt build target'
59+
$DOCKER run --rm $DOCKER_RUN_ARGS -e UID=`id -u` -e GID=`id -g` -v `pwd`:/code $DOCKER_IMAGE bash -c 'chown -R -f $UID:$GID checksums.txt build target'
6860

6961
if [[ "${UPDATE}" = "yes" ]]; then
7062
echo "${CHECKSUM_FILE_PATH} file is updated with latest binary hashes!"

workspace/scripts/reproducible_build_docker

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -ex
88

99
DOCKER="${DOCKER:-docker}"
1010
DOCKER_IMAGE="${DOCKER_IMAGE:-docker.io/cryptape/llvm-n-rust:20240630}"
11-
CHECKSUM_FILE_PATH="checksums.txt"
11+
CHECKSUM_FILE_PATH="${CHECKSUM_FILE_PATH:-checksums.txt}"
1212

1313
# We are parsing command line arguments based on tips from:
1414
# https://stackoverflow.com/a/14203146
@@ -24,10 +24,6 @@ while [[ $# -gt 0 ]]; do
2424
UPDATE="yes"
2525
shift # past argument
2626
;;
27-
-s|--sudo)
28-
SUDO="yes"
29-
shift # past argument
30-
;;
3127
--no-clean)
3228
NOCLEAN="yes"
3329
shift # past argument
@@ -44,7 +40,7 @@ while [[ $# -gt 0 ]]; do
4440
done
4541

4642
if [[ -n "${PROXY}" ]]; then
47-
PROXY_ARGS="-e ALL_PROXY=${PROXY} -e HTTPS_PROXY=${PROXY} -e HTTP_PROXY=${PROXY}"
43+
DOCKER_RUN_ARGS="-e ALL_PROXY=${PROXY} -e HTTPS_PROXY=${PROXY} -e HTTP_PROXY=${PROXY} ${DOCKER_RUN_ARGS}"
4844
fi
4945

5046
TASKS=""
@@ -58,13 +54,9 @@ else
5854
TASKS+=" build "
5955
fi
6056

61-
if [[ "${SUDO}" = "yes" ]]; then
62-
PREFIX="sudo"
63-
fi
64-
65-
$PREFIX $DOCKER run --rm $DOCKER_RUN_ARGS $PROXY_ARGS -v `pwd`:/code $DOCKER_IMAGE make $TASKS
57+
$DOCKER run --rm $DOCKER_RUN_ARGS -v `pwd`:/code $DOCKER_IMAGE make $TASKS
6658
# Reset file ownerships for all files docker might touch
67-
$PREFIX $DOCKER run --rm $DOCKER_RUN_ARGS $PROXY_ARGS -e UID=`id -u` -e GID=`id -g` -v `pwd`:/code $DOCKER_IMAGE bash -c 'chown -R -f $UID:$GID checksums.txt build target'
59+
$DOCKER run --rm $DOCKER_RUN_ARGS -e UID=`id -u` -e GID=`id -g` -v `pwd`:/code $DOCKER_IMAGE bash -c 'chown -R -f $UID:$GID checksums.txt build target'
6860

6961
if [[ "${UPDATE}" = "yes" ]]; then
7062
echo "${CHECKSUM_FILE_PATH} file is updated with latest binary hashes!"

0 commit comments

Comments
 (0)