Skip to content

Commit 9502c2c

Browse files
committed
Enhance reproducible build script with ownership resetting & docker command adjustment
1 parent 13b5e42 commit 9502c2c

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

standalone-contract/scripts/reproducible_build_docker

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# to do reproducible build.
77
set -ex
88

9-
DOCKER_IMAGE="docker.io/cryptape/llvm-n-rust:20240630"
9+
DOCKER="${DOCKER:-docker}"
10+
DOCKER_IMAGE="${DOCKER_IMAGE:-docker.io/cryptape/llvm-n-rust:20240630}"
1011
CHECKSUM_FILE_PATH="checksums.txt"
1112

1213
# We are parsing command line arguments based on tips from:
@@ -23,6 +24,10 @@ while [[ $# -gt 0 ]]; do
2324
UPDATE="yes"
2425
shift # past argument
2526
;;
27+
-s|--sudo)
28+
SUDO="yes"
29+
shift # past argument
30+
;;
2631
--no-clean)
2732
NOCLEAN="yes"
2833
shift # past argument
@@ -53,7 +58,13 @@ else
5358
TASKS+=" build "
5459
fi
5560

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

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

workspace/scripts/reproducible_build_docker

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# to do reproducible build.
77
set -ex
88

9-
DOCKER_IMAGE="docker.io/cryptape/llvm-n-rust:20240630"
9+
DOCKER="${DOCKER:-docker}"
10+
DOCKER_IMAGE="${DOCKER_IMAGE:-docker.io/cryptape/llvm-n-rust:20240630}"
1011
CHECKSUM_FILE_PATH="checksums.txt"
1112

1213
# We are parsing command line arguments based on tips from:
@@ -23,6 +24,10 @@ while [[ $# -gt 0 ]]; do
2324
UPDATE="yes"
2425
shift # past argument
2526
;;
27+
-s|--sudo)
28+
SUDO="yes"
29+
shift # past argument
30+
;;
2631
--no-clean)
2732
NOCLEAN="yes"
2833
shift # past argument
@@ -53,7 +58,13 @@ else
5358
TASKS+=" build "
5459
fi
5560

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

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

0 commit comments

Comments
 (0)